From 0d74ffd52fe731b0124cdab43a311af57ab966cb Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Fri, 30 Jun 2023 14:19:07 +0500 Subject: [PATCH] Shape builder - detect AdvancedSweptSolid To avoid validation errors on creating wall mounted railings #143=IfcShapeRepresentation(#15,'Body','SweptSolid',(#116,#126,#129,#139,#142)) Rule IfcShapeRepresentation.CorrectItemsForType: IfcShapeRepresentationTypes(self.RepresentationType, self.Items) Violated by: False + where False = IfcShapeRepresentationTypes('SweptSolid', (#116=IfcSweptDiskSolid(#115,10.,$,$,$), #126=IfcExtrudedAreaSolid(#120,#124,#125,20.), #129=IfcSweptDiskSolid(#128,10.,$,$,$), #139=IfcExtrudedAreaSolid(#133,#137,#138,20.), #142=IfcSweptDiskSolid(#141,25.000000372529,$,$,$))) + where 'SweptSolid' = #143=IfcShapeRepresentation(#15,'Body','SweptSolid',(#116,#126,#129,#139,#142)).RepresentationType + and (#116=IfcSweptDiskSolid(#115,10.,$,$,$), #126=IfcExtrudedAreaSolid(#120,#124,#125,20.), #129=IfcSweptDiskSolid(#128,10.,$,$,$), #139=IfcExtrudedAreaSolid(#133,#137,#138,20.), #142=IfcSweptDiskSolid(#141,25.000000372529,$,$,$)) = #143=IfcShapeRepresentation(#15,'Body','SweptSolid',(#116,#126,#129,#139,#142)).Items --- src/ifcopenshell-python/ifcopenshell/util/shape_builder.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ifcopenshell-python/ifcopenshell/util/shape_builder.py b/src/ifcopenshell-python/ifcopenshell/util/shape_builder.py index c49c06b3f8..02a0d01f53 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/shape_builder.py +++ b/src/ifcopenshell-python/ifcopenshell/util/shape_builder.py @@ -562,8 +562,11 @@ class ShapeBuilder: if not isinstance(items, collections.abc.Iterable): items = [items] + item_types = set([i.is_a() for i in items]) if not representation_type: - if items[0].is_a() in ("IfcExtrudedAreaSolid", "IfcSweptDiskSolid"): + if "IfcSweptDiskSolid" in item_types: + representation_type = "AdvancedSweptSolid" + elif "IfcExtrudedAreaSolid" in item_types: representation_type = "SweptSolid" elif items[0].is_a("IfcCurve") and items[0].Dim == 3: representation_type = "Curve3D"