diff --git a/src/blenderbim/blenderbim/bim/module/model/workspace.py b/src/blenderbim/blenderbim/bim/module/model/workspace.py index f2a8b0d52f..86c8c8214d 100644 --- a/src/blenderbim/blenderbim/bim/module/model/workspace.py +++ b/src/blenderbim/blenderbim/bim/module/model/workspace.py @@ -109,7 +109,7 @@ class BimToolUI: row = cls.layout.row(align=True) row.prop(data=cls.props, property="x_angle", text="X Angle") - elif cls.props.ifc_class == "IfcSlabType": + elif cls.props.ifc_class in ("IfcSlabType", "IfcRampType", "IfcRoofType"): row = cls.layout.row(align=True) row.prop(data=cls.props, property="x_angle", text="X Angle") elif cls.props.ifc_class in ("IfcColumnType", "IfcBeamType", "IfcMemberType"): @@ -177,7 +177,7 @@ class BimToolUI: row.label(text="", icon="EVENT_G") row.operator("bim.hotkey", text="Regen").hotkey = "S_G" row.operator("bim.join_wall", icon="X", text="").join_type = "" - elif AuthoringData.data["active_class"] in ("IfcSlab", "IfcSlabStandardCase"): + elif AuthoringData.data["active_class"] in ("IfcSlab", "IfcSlabStandardCase", "IfcRamp", "IfcRoof"): if context.active_object.mode == "OBJECT": row = cls.layout.row(align=True) row.label(text="", icon="EVENT_SHIFT") @@ -414,7 +414,7 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator): def hotkey_S_E(self): if self.active_class in ("IfcWall", "IfcWallStandardCase"): bpy.ops.bim.join_wall(join_type="T") - elif self.active_class in ("IfcSlab", "IfcSlabStandardCase"): + elif self.active_class in ("IfcSlab", "IfcSlabStandardCase", "IfcRamp", "IfcRoof"): if not bpy.context.active_object: pass elif bpy.context.active_object.mode == "OBJECT": diff --git a/src/ifcopenshell-python/ifcopenshell/api/geometry/add_slab_representation.py b/src/ifcopenshell-python/ifcopenshell/api/geometry/add_slab_representation.py index f0ecff352f..91152d5c4f 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/geometry/add_slab_representation.py +++ b/src/ifcopenshell-python/ifcopenshell/api/geometry/add_slab_representation.py @@ -17,6 +17,7 @@ # along with IfcOpenShell. If not, see . import ifcopenshell.util.unit +from math import sin, cos class Usecase: @@ -25,6 +26,7 @@ class Usecase: self.settings = { "context": None, # IfcGeometricRepresentationContext "depth": 0.2, + "x_angle": 0, # Radians # Planes are defined as a matrix. The XY plane is the clipping boundary and +Z is removed. "clippings": [], # A list of planes that define clipping half space solids } @@ -47,10 +49,16 @@ class Usecase: curve = self.file.createIfcPolyline([self.file.createIfcCartesianPoint(p) for p in points]) else: curve = self.file.createIfcIndexedPolyCurve(self.file.createIfcCartesianPointList3D(points)) + if self.settings["x_angle"]: + extrusion_direction = self.file.createIfcDirection( + (0.0, sin(self.settings["x_angle"]), cos(self.settings["x_angle"])) + ) + else: + extrusion_direction = self.file.createIfcDirection((0.0, 0.0, 1.0)) extrusion = self.file.createIfcExtrudedAreaSolid( self.file.createIfcArbitraryClosedProfileDef("AREA", None, curve), None, - self.file.createIfcDirection((0.0, 0.0, 1.0)), + extrusion_direction, self.convert_si_to_unit(self.settings["depth"]), ) if self.settings["clippings"]: diff --git a/src/ifcopenshell-python/ifcopenshell/api/geometry/add_wall_representation.py b/src/ifcopenshell-python/ifcopenshell/api/geometry/add_wall_representation.py index 20a4e5da52..549141679c 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/geometry/add_wall_representation.py +++ b/src/ifcopenshell-python/ifcopenshell/api/geometry/add_wall_representation.py @@ -16,8 +16,8 @@ # You should have received a copy of the GNU Lesser General Public License # along with IfcOpenShell. If not, see . -from math import sin, cos import ifcopenshell.util.unit +from math import sin, cos class Usecase: