From 9f453d54d89f98a11dc1ac9c38a12c4d1e165ce3 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sun, 16 Feb 2025 15:43:03 +1100 Subject: [PATCH] Piles should also default to vertical, just like columns --- src/bonsai/bonsai/bim/module/model/polyline.py | 9 +++++---- src/bonsai/bonsai/bim/module/model/profile.py | 3 +-- src/bonsai/bonsai/bim/module/model/workspace.py | 15 ++++++++++----- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/model/polyline.py b/src/bonsai/bonsai/bim/module/model/polyline.py index d12417637e..2f780015a1 100644 --- a/src/bonsai/bonsai/bim/module/model/polyline.py +++ b/src/bonsai/bonsai/bim/module/model/polyline.py @@ -886,10 +886,11 @@ class PolylineOperator: tool.Blender.update_viewport() def get_product_preview_data(self, context: bpy.types.Context, relating_type: ifcopenshell.entity_isntance): - if tool.Model.get_usage_type(relating_type) == "PROFILE" and relating_type.is_a() not in {"IfcColumnType"}: - data = get_horizontal_profile_preview_data(context, relating_type) - elif tool.Model.get_usage_type(relating_type) == "PROFILE" and relating_type.is_a() in {"IfcColumnType"}: - data = get_vertical_profile_preview_data(context, relating_type) + if tool.Model.get_usage_type(relating_type) == "PROFILE": + if relating_type.is_a() in {"IfcColumnType", "IfcPileType"}: + data = get_vertical_profile_preview_data(context, relating_type) + else: + data = get_horizontal_profile_preview_data(context, relating_type) elif tool.Model.get_usage_type(relating_type) == "LAYER2": data = get_wall_preview_data(context, relating_type) elif tool.Model.get_usage_type(relating_type) == "LAYER3": diff --git a/src/bonsai/bonsai/bim/module/model/profile.py b/src/bonsai/bonsai/bim/module/model/profile.py index 00e594323b..6286422f99 100644 --- a/src/bonsai/bonsai/bim/module/model/profile.py +++ b/src/bonsai/bonsai/bim/module/model/profile.py @@ -105,9 +105,8 @@ class DumbProfileGenerator: obj = bpy.data.objects.new(tool.Model.generate_occurrence_name(self.relating_type, ifc_class), mesh) matrix_world = Matrix() - if not self.relating_type.is_a("IfcColumnType"): + if self.relating_type.is_a() not in ("IfcColumnType", "IfcPileType"): matrix_world = Matrix.Rotation(pi / 2, 4, "Z") @ Matrix.Rotation(pi / 2, 4, "X") @ matrix_world - matrix_world = Matrix.Rotation(self.rotation, 4, "Z") @ matrix_world matrix_world.translation = self.location diff --git a/src/bonsai/bonsai/bim/module/model/workspace.py b/src/bonsai/bonsai/bim/module/model/workspace.py index ffb0737015..ad4446b9b6 100644 --- a/src/bonsai/bonsai/bim/module/model/workspace.py +++ b/src/bonsai/bonsai/bim/module/model/workspace.py @@ -632,11 +632,11 @@ class CreateObjectUI: data=cls.props, property="x_angle", text="Slope" if ui_context != "TOOL_HEADER" else "A", icon="FILE_3D" ) - elif ifc_class in ("IfcColumnType", "IfcMemberType"): + elif ifc_class in ("IfcColumnType", "IfcPileType"): row.prop(data=cls.props, property="cardinal_point", text="Axis") row.prop(data=cls.props, property="extrusion_depth", text="Height" if ui_context != "TOOL_HEADER" else "H") - elif ifc_class in ("IfcBeamType"): + elif ifc_class in ("IfcBeamType", "IfcMemberType"): row.prop(data=cls.props, property="cardinal_point", text="Axis") row.prop(data=cls.props, property="extrusion_depth", text="Length" if ui_context != "TOOL_HEADER" else "L") @@ -817,7 +817,9 @@ class EditObjectUI: op.cardinal_point = int(cls.props.cardinal_point) row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row label = ( - "Height" if AuthoringData.data["active_class"] in ("IfcColumn", "IfcColumnStandardCase") else "Length" + "Height" + if AuthoringData.data["active_class"] in ("IfcColumn", "IfcColumnStandardCase", "IfcPile") + else "Length" ) row.prop( data=cls.props, property="extrusion_depth", text=label if ui_context != "TOOL_HEADER" else label[0] @@ -1168,7 +1170,10 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator): return bpy.ops.bim.draw_polyline_wall("INVOKE_DEFAULT") elif tool.Model.get_usage_type(relating_type) == "LAYER3": return bpy.ops.bim.draw_polyline_slab("INVOKE_DEFAULT") - elif tool.Model.get_usage_type(relating_type) == "PROFILE" and relating_type_class != "IfcColumnType": + elif tool.Model.get_usage_type(relating_type) == "PROFILE" and relating_type_class not in ( + "IfcColumnType", + "IfcPileType", + ): return bpy.ops.bim.draw_polyline_profile("INVOKE_DEFAULT") return bpy.ops.bim.add_occurrence("INVOKE_DEFAULT") @@ -1350,7 +1355,7 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator): return if self.active_material_usage == "LAYER2": bpy.ops.bim.rotate_90(axis="Z") - elif self.active_class in ("IfcColumn", "IfcColumnStandardCase"): + elif self.active_class in ("IfcColumn", "IfcColumnStandardCase", "IfcPile"): bpy.ops.bim.rotate_90(axis="Z") elif self.active_class in ("IfcBeam", "IfcBeamStandardCase", "IfcMember", "IfcMemberStandardCase"): bpy.ops.bim.rotate_90(axis="Y")