Detect BBIM railings at import to import as meshes not curves #3144

Sometimes railing could consist just of one IFCSWEPTDISKSOLID then it will be considered native swept disk solid and imported as a curve.

But when user create BBIM railing they edit it as a mesh and curve might look a bit different. Therefore we detect it now at import to make sure it's going to be reprsented the same way as it was saved.
This commit is contained in:
Andrej730
2023-05-19 17:28:58 +05:00
parent 3601a1d43b
commit f7b2a68ed3
+6 -2
View File
@@ -381,7 +381,7 @@ class IfcImporter:
representations = self.get_transformed_body_representations(element.Representation.Representations)
# Single swept disk solids (e.g. rebar) are better natively represented as beveled curves
if self.is_native_swept_disk_solid(representations):
if self.is_native_swept_disk_solid(element, representations):
self.native_data[element.GlobalId] = {
"representations": representations,
"representation": self.get_body_representation(element.Representation.Representations),
@@ -409,7 +409,11 @@ class IfcImporter:
}
return True
def is_native_swept_disk_solid(self, representations):
def is_native_swept_disk_solid(self, element, representations):
# detect BBIM Railings to represent them with meshes and not curves
if tool.Pset.get_element_pset(element, "BBIM_Railing"):
return False
for representation in representations:
items = representation["raw"].Items or [] # Be forgiving of invalid IFCs because Revit :(
if len(items) == 1 and items[0].is_a("IfcSweptDiskSolid"):