Shift-A now triggers the wall polyline tool for all LAYER2 elements

This commit is contained in:
Dion Moult
2024-09-29 18:11:08 +10:00
parent 905044f0d7
commit 275d615d42
4 changed files with 22 additions and 12 deletions
@@ -210,7 +210,7 @@ class PolylineOperator:
PolylineDecorator.update(event, self.tool_state, self.input_ui, self.snapping_points[0]) PolylineDecorator.update(event, self.tool_state, self.input_ui, self.snapping_points[0])
tool.Blender.update_viewport() tool.Blender.update_viewport()
if event.value == "RELEASE" and event.type in {"D", "A"}: if event.value == "RELEASE" and event.type == "D":
self.recalculate_inputs(context) self.recalculate_inputs(context)
self.tool_state.mode = "Edit" self.tool_state.mode = "Edit"
self.tool_state.is_input_on = True self.tool_state.is_input_on = True
+5 -11
View File
@@ -456,26 +456,20 @@ class AddConstrTypeInstance(bpy.types.Operator, tool.Ifc.Operator):
def generate_layered_element(ifc_class: str, relating_type: ifcopenshell.entity_instance) -> bool: def generate_layered_element(ifc_class: str, relating_type: ifcopenshell.entity_instance) -> bool:
layer_set_direction = None layer_set_direction = None
parametric = ifcopenshell.util.element.get_psets(relating_type).get("EPset_Parametric") usage = tool.Model.get_usage_type(relating_type)
if parametric: print('usage', usage)
layer_set_direction = parametric.get("LayerSetDirection", layer_set_direction)
if layer_set_direction is None:
if ifc_class in ["IfcSlabType", "IfcRoofType", "IfcRampType", "IfcPlateType"]:
layer_set_direction = "AXIS3"
else:
layer_set_direction = "AXIS2"
obj = None obj = None
if layer_set_direction == "AXIS3": if usage == "LAYER3":
obj = slab.DumbSlabGenerator(relating_type).generate() obj = slab.DumbSlabGenerator(relating_type).generate()
elif layer_set_direction == "AXIS2": elif usage == "LAYER2":
obj = wall.DumbWallGenerator(relating_type).generate() obj = wall.DumbWallGenerator(relating_type).generate()
else: else:
pass # Dumb block generator? Eh? :) pass # Dumb block generator? Eh? :)
if obj: if obj:
material = ifcopenshell.util.element.get_material(tool.Ifc.get_entity(obj)) material = ifcopenshell.util.element.get_material(tool.Ifc.get_entity(obj))
material.LayerSetDirection = layer_set_direction material.LayerSetDirection = f"AXIS{usage[-1]}"
return True return True
return False return False
@@ -847,8 +847,14 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
row.prop(self, "z") row.prop(self, "z")
def hotkey_S_A(self): def hotkey_S_A(self):
props = bpy.context.scene.BIMModelProperties
if bpy.context.scene.BIMGeometryProperties.mode == "ITEM": if bpy.context.scene.BIMGeometryProperties.mode == "ITEM":
bpy.ops.wm.call_menu(name="BIM_MT_add_representation_item") bpy.ops.wm.call_menu(name="BIM_MT_add_representation_item")
elif (
props.relating_type_id
and tool.Model.get_usage_type(tool.Ifc.get().by_id(int(props.relating_type_id))) == "LAYER2"
):
bpy.ops.bim.draw_polyline_wall("INVOKE_DEFAULT")
else: else:
bpy.ops.bim.add_occurrence("INVOKE_DEFAULT") bpy.ops.bim.add_occurrence("INVOKE_DEFAULT")
+10
View File
@@ -556,6 +556,14 @@ class Model(bonsai.core.tool.Model):
if material: if material:
if material.is_a("IfcMaterialLayerSetUsage"): if material.is_a("IfcMaterialLayerSetUsage"):
return f"LAYER{material.LayerSetDirection[-1]}" return f"LAYER{material.LayerSetDirection[-1]}"
elif material.is_a("IfcMaterialLayerSet"):
axis = ifcopenshell.util.element.get_pset(element, "EPset_Parametric", "LayerSetDirection")
if axis is None:
if element.is_a() in ["IfcSlabType", "IfcRoofType", "IfcRampType", "IfcPlateType"]:
axis = "AXIS3"
else:
axis = "AXIS2"
return f"LAYER{axis[-1]}"
elif material.is_a("IfcMaterialProfileSetUsage"): elif material.is_a("IfcMaterialProfileSetUsage"):
# TODO: remove after we support editing profile usages with IfcRevolvedAreaSolid. # TODO: remove after we support editing profile usages with IfcRevolvedAreaSolid.
# Revolved area check should happen inside bim.enable_editing_extrusion_axis # Revolved area check should happen inside bim.enable_editing_extrusion_axis
@@ -567,6 +575,8 @@ class Model(bonsai.core.tool.Model):
): ):
return return
return "PROFILE" return "PROFILE"
elif material.is_a("IfcMaterialProfileSet"):
return "PROFILE"
@classmethod @classmethod
def get_wall_axis(cls, obj, layers=None): def get_wall_axis(cls, obj, layers=None):