diff --git a/src/blenderbim/blenderbim/bim/module/model/profile.py b/src/blenderbim/blenderbim/bim/module/model/profile.py index d2576f1185..de5a0a462e 100644 --- a/src/blenderbim/blenderbim/bim/module/model/profile.py +++ b/src/blenderbim/blenderbim/bim/module/model/profile.py @@ -449,6 +449,16 @@ class DumbProfileJoiner: "geometry.assign_representation", tool.Ifc.get(), product=element, representation=new_axis ) + def get_placement_axes(body_representation): + if not body_representation: + return None, None + extrusion = tool.Model.get_extrusion(body_representation) + if not extrusion: + return None, None + position = extrusion.Position + return (position.Axis.DirectionRatios, position.RefDirection.DirectionRatios) + + old_body = ifcopenshell.util.representation.get_representation(element, "Model", "Body", "MODEL_VIEW") new_body = ifcopenshell.api.run( "geometry.add_profile_representation", tool.Ifc.get(), @@ -457,9 +467,9 @@ class DumbProfileJoiner: depth=depth, cardinal_point=usage.CardinalPoint if usage else None, clippings=self.clippings, + placement_zx_axes=get_placement_axes(old_body), ) - old_body = ifcopenshell.util.representation.get_representation(element, "Model", "Body", "MODEL_VIEW") if old_body: for inverse in tool.Ifc.get().get_inverse(old_body): ifcopenshell.util.element.replace_attribute(inverse, old_body, new_body) diff --git a/src/ifcopenshell-python/ifcopenshell/api/geometry/add_profile_representation.py b/src/ifcopenshell-python/ifcopenshell/api/geometry/add_profile_representation.py index b29aaf6cba..35cd187904 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/geometry/add_profile_representation.py +++ b/src/ifcopenshell-python/ifcopenshell/api/geometry/add_profile_representation.py @@ -31,6 +31,7 @@ class Usecase: # Planes are defined as a matrix. The XY plane is the clipping boundary and +Z is removed. # [{"type": "IfcBooleanClippingResult", "operand_type": "IfcHalfSpaceSolid", "matrix": [...]}, {...}] "clippings": [], # A list of planes that define clipping half space solids + "placement_zx_axes": (None, None), } for key, value in settings.items(): self.settings[key] = value @@ -46,13 +47,14 @@ class Usecase: def create_item(self): point = self.get_point() + placement = self.file.createIfcAxis2Placement3D( + point, + self.file.createIfcDirection(self.settings["placement_zx_axes"][0] or (0.0, 0.0, 1.0)), + self.file.createIfcDirection(self.settings["placement_zx_axes"][1] or (1.0, 0.0, 0.0)), + ) extrusion = self.file.createIfcExtrudedAreaSolid( self.settings["profile"], - self.file.createIfcAxis2Placement3D( - point, - self.file.createIfcDirection((0.0, 0.0, 1.0)), - self.file.createIfcDirection((1.0, 0.0, 0.0)), - ), + placement, self.file.createIfcDirection((0.0, 0.0, 1.0)), self.convert_si_to_unit(self.settings["depth"]), )