mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 13:46:54 +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)
|
obj.select_set(False)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if representation.RepresentationType in ("Tessellation", "Brep"):
|
if tool.Geometry.is_meshlike(representation):
|
||||||
if element.HasOpenings:
|
if element.HasOpenings:
|
||||||
# Mesh elements with openings must disable openings
|
# Mesh elements with openings must disable openings
|
||||||
# so that you can edit the original topology.
|
# so that you can edit the original topology.
|
||||||
@@ -837,9 +837,8 @@ class OverrideModeSetObject(bpy.types.Operator):
|
|||||||
|
|
||||||
if obj.data.BIMMeshProperties.ifc_definition_id:
|
if obj.data.BIMMeshProperties.ifc_definition_id:
|
||||||
representation = tool.Ifc.get().by_id(obj.data.BIMMeshProperties.ifc_definition_id)
|
representation = tool.Ifc.get().by_id(obj.data.BIMMeshProperties.ifc_definition_id)
|
||||||
if representation.RepresentationType in (
|
if tool.Geometry.is_meshlike(
|
||||||
"Tessellation",
|
representation
|
||||||
"Brep",
|
|
||||||
) and obj.data.BIMMeshProperties.mesh_checksum != tool.Geometry.get_mesh_checksum(obj.data):
|
) and obj.data.BIMMeshProperties.mesh_checksum != tool.Geometry.get_mesh_checksum(obj.data):
|
||||||
self.edited_objs.append(obj)
|
self.edited_objs.append(obj)
|
||||||
elif element.HasOpenings:
|
elif element.HasOpenings:
|
||||||
|
|||||||
@@ -135,13 +135,13 @@ class Geometry(blenderbim.core.tool.Geometry):
|
|||||||
faces = mesh.polygons[:]
|
faces = mesh.polygons[:]
|
||||||
|
|
||||||
# Convert mesh data to bytes
|
# Convert mesh data to bytes
|
||||||
data_bytes = b''
|
data_bytes = b""
|
||||||
for v in vertices:
|
for v in vertices:
|
||||||
data_bytes += struct.pack('3f', *v.co)
|
data_bytes += struct.pack("3f", *v.co)
|
||||||
for e in edges:
|
for e in edges:
|
||||||
data_bytes += struct.pack('2i', *e.vertices)
|
data_bytes += struct.pack("2i", *e.vertices)
|
||||||
for f in faces:
|
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
|
# Generate hash of mesh data
|
||||||
hasher = hashlib.sha1()
|
hasher = hashlib.sha1()
|
||||||
@@ -261,6 +261,30 @@ class Geometry(blenderbim.core.tool.Geometry):
|
|||||||
def is_mapped_representation(cls, representation):
|
def is_mapped_representation(cls, representation):
|
||||||
return representation.RepresentationType == "MappedRepresentation"
|
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
|
@classmethod
|
||||||
def is_type_product(cls, element):
|
def is_type_product(cls, element):
|
||||||
return element.is_a("IfcTypeProduct")
|
return element.is_a("IfcTypeProduct")
|
||||||
|
|||||||
Reference in New Issue
Block a user