diff --git a/src/bonsai/bonsai/bim/module/model/polyline.py b/src/bonsai/bonsai/bim/module/model/polyline.py index 4c1b06b0f6..5243ec24ca 100644 --- a/src/bonsai/bonsai/bim/module/model/polyline.py +++ b/src/bonsai/bonsai/bim/module/model/polyline.py @@ -61,20 +61,21 @@ def create_bmesh_from_vertices(vertices, is_closed=False): def get_wall_preview_data(context, relating_type): # Get properties from object type - layers = tool.Model.get_material_layer_parameters(relating_type) - if not layers["thickness"]: - return - thickness = layers["thickness"] model_props = context.scene.BIMModelProperties direction_sense = model_props.direction_sense direction = 1 if direction_sense == "NEGATIVE": direction = -1 - offset_type = model_props.offset_type + layers = tool.Model.get_material_layer_parameters(relating_type) + if not layers["thickness"]: + return + thickness = layers["thickness"] + thickness *= direction + + offset_type = model_props.offset_type_vertical unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get()) offset = model_props.offset * unit_scale - thickness *= direction offset *= direction height = float(model_props.extrusion_depth) diff --git a/src/bonsai/bonsai/bim/module/model/prop.py b/src/bonsai/bonsai/bim/module/model/prop.py index 76c0cd9db2..c6f56c207a 100644 --- a/src/bonsai/bonsai/bim/module/model/prop.py +++ b/src/bonsai/bonsai/bim/module/model/prop.py @@ -200,9 +200,9 @@ class BIMModelProperties(PropertyGroup): name="Material Usage Direction Sense", default="POSITIVE", ) - offset_type: bpy.props.EnumProperty( + offset_type_vertical: bpy.props.EnumProperty( items=[("EXTERIOR", "Exterior", ""), ("CENTER", "Center", ""), ("INTERIOR", "Interior", "")], - name="Layer Offset Type", + name="Vertical Layer Offset Type", default="EXTERIOR", description="It's a convention that affects the offset to reference line", ) diff --git a/src/bonsai/bonsai/bim/module/model/wall.py b/src/bonsai/bonsai/bim/module/model/wall.py index 1c479c63c6..3f92331d78 100644 --- a/src/bonsai/bonsai/bim/module/model/wall.py +++ b/src/bonsai/bonsai/bim/module/model/wall.py @@ -422,20 +422,10 @@ class DrawPolylineWall(bpy.types.Operator, PolylineOperator): props = bpy.context.scene.BIMModelProperties if event.value == "RELEASE" and event.type == "O": items = ["EXTERIOR", "CENTER", "INTERIOR"] - index = items.index(props.offset_type) + index = items.index(props.offset_type_vertical) size = len(items) - props.offset_type = items[((index + 1) % size)] - - layers = tool.Model.get_material_layer_parameters(self.relating_type) - thickness = layers["thickness"] - offset = 0 - if props.offset_type == "CENTER": - offset = -thickness / 2 - elif props.offset_type == "INTERIOR": - offset = -thickness - props.offset = offset / self.unit_scale - - tool.Blender.update_viewport() + props.offset_type_vertical = items[((index + 1) % size)] + self.set_offset(context, self.relating_type) custom_instructions = { 'Choose Axis': {'icons':True, 'keys': ['EVENT_X', 'EVENT_Y']} @@ -443,7 +433,7 @@ class DrawPolylineWall(bpy.types.Operator, PolylineOperator): wall_config = [ f"Direction: {props.direction_sense}", - f"Offset Type: {props.offset_type}", + f"Offset Type: {props.offset_type_vertical}", f"Offset Value: {tool.Polyline.format_input_ui_units(props.offset * self.unit_scale)}", ] @@ -486,6 +476,7 @@ class DrawPolylineWall(bpy.types.Operator, PolylineOperator): ProductDecorator.install(context) self.tool_state.use_default_container = True self.tool_state.plane_method = "XY" + self.set_offset(context, self.relating_type) return {"RUNNING_MODAL"}