From 640320f70d3c9097d6f4e104abb2e0338bf35ec7 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Thu, 25 Apr 2024 16:35:05 +0500 Subject: [PATCH] shape_builder - create non-optional position for profiles in ifc2x3 --- .../ifcopenshell/util/shape_builder.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/util/shape_builder.py b/src/ifcopenshell-python/ifcopenshell/util/shape_builder.py index fdea29fe14..29ed257cc8 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/shape_builder.py +++ b/src/ifcopenshell-python/ifcopenshell/util/shape_builder.py @@ -344,6 +344,16 @@ class ShapeBuilder: "Ref: https://ifc43-docs.standards.buildingsmart.org/IFC/RELEASE/IFC4x3/HTML/lexical/IfcArbitraryClosedProfileDef.htm#8.15.3.1.4-Formal-propositions" ) + kwargs = { + "ProfileName": name, + "ProfileType": profile_type, + "OuterCurve": outer_curve, + } + if self.file.schema == "IFC2X3": + kwargs["Position"] = self.file.create_entity( + "IfcAxis2Placement2D", self.file.create_entity("IfcCartesianPoint", [0.0, 0.0]) + ) + if inner_curves: if not isinstance(inner_curves, collections.abc.Iterable): inner_curves = [inner_curves] @@ -354,13 +364,9 @@ class ShapeBuilder: "Ref: https://ifc43-docs.standards.buildingsmart.org/IFC/RELEASE/IFC4x3/HTML/lexical/IfcArbitraryClosedProfileDef.htm#8.15.3.1.4-Formal-propositions" ) - profile = self.file.createIfcArbitraryProfileDefWithVoids( - ProfileName=name, ProfileType=profile_type, OuterCurve=outer_curve, InnerCurves=inner_curves - ) + profile = self.file.create_entity("IfcArbitraryProfileDefWithVoids", InnerCurves=inner_curves, **kwargs) else: - profile = self.file.createIfcArbitraryClosedProfileDef( - ProfileName=name, ProfileType=profile_type, OuterCurve=outer_curve - ) + profile = self.file.create_entity("IfcArbitraryClosedProfileDef", **kwargs) return profile def translate(self, curve_or_item, translation: Vector, create_copy=False):