mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Shortlist which IFC geometries may be treated as a meshlike object.
This commit is contained in:
@@ -747,7 +747,7 @@ class OverrideModeSetEdit(bpy.types.Operator):
|
||||
obj.select_set(False)
|
||||
continue
|
||||
|
||||
if representation.RepresentationType in ("Tessellation", "Brep"):
|
||||
if tool.Geometry.is_meshlike(representation):
|
||||
if element.HasOpenings:
|
||||
# Mesh elements with openings must disable openings
|
||||
# so that you can edit the original topology.
|
||||
@@ -837,9 +837,8 @@ class OverrideModeSetObject(bpy.types.Operator):
|
||||
|
||||
if obj.data.BIMMeshProperties.ifc_definition_id:
|
||||
representation = tool.Ifc.get().by_id(obj.data.BIMMeshProperties.ifc_definition_id)
|
||||
if representation.RepresentationType in (
|
||||
"Tessellation",
|
||||
"Brep",
|
||||
if tool.Geometry.is_meshlike(
|
||||
representation
|
||||
) and obj.data.BIMMeshProperties.mesh_checksum != tool.Geometry.get_mesh_checksum(obj.data):
|
||||
self.edited_objs.append(obj)
|
||||
elif element.HasOpenings:
|
||||
|
||||
@@ -135,13 +135,13 @@ class Geometry(blenderbim.core.tool.Geometry):
|
||||
faces = mesh.polygons[:]
|
||||
|
||||
# Convert mesh data to bytes
|
||||
data_bytes = b''
|
||||
data_bytes = b""
|
||||
for v in vertices:
|
||||
data_bytes += struct.pack('3f', *v.co)
|
||||
data_bytes += struct.pack("3f", *v.co)
|
||||
for e in edges:
|
||||
data_bytes += struct.pack('2i', *e.vertices)
|
||||
data_bytes += struct.pack("2i", *e.vertices)
|
||||
for f in faces:
|
||||
data_bytes += struct.pack('%di' % len(f.vertices), *f.vertices)
|
||||
data_bytes += struct.pack("%di" % len(f.vertices), *f.vertices)
|
||||
|
||||
# Generate hash of mesh data
|
||||
hasher = hashlib.sha1()
|
||||
@@ -261,6 +261,30 @@ class Geometry(blenderbim.core.tool.Geometry):
|
||||
def is_mapped_representation(cls, representation):
|
||||
return representation.RepresentationType == "MappedRepresentation"
|
||||
|
||||
@classmethod
|
||||
def is_meshlike(cls, representation):
|
||||
if representation.RepresentationType in (
|
||||
"AdvancedBrep",
|
||||
"Annotation2D",
|
||||
"BoundingBox",
|
||||
"Brep",
|
||||
"Curve",
|
||||
"Curve2D",
|
||||
"Curve3D",
|
||||
"FillArea",
|
||||
"GeometricCurveSet",
|
||||
"GeometricSet",
|
||||
"Point",
|
||||
"PointCloud",
|
||||
"Surface",
|
||||
"Surface2D",
|
||||
"Surface3D",
|
||||
"SurfaceModel",
|
||||
"Tessellation",
|
||||
):
|
||||
return True
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def is_type_product(cls, element):
|
||||
return element.is_a("IfcTypeProduct")
|
||||
|
||||
Reference in New Issue
Block a user