You can now change wall heights in bulk

This commit is contained in:
Dion Moult
2022-09-19 16:29:43 +10:00
parent 18387e7732
commit e5719bd3c6
4 changed files with 44 additions and 0 deletions
@@ -27,6 +27,7 @@ classes = (
product.DynamicallyVoidProduct,
workspace.Hotkey,
wall.AlignWall,
wall.ChangeExtrusionDepth,
wall.FlipWall,
wall.JoinWall,
wall.MergeWall,
@@ -120,6 +120,7 @@ class BIMModelProperties(PropertyGroup):
)
occurrence_name_function: bpy.props.StringProperty(name="Occurrence Name Function")
getter_enum = {"ifc_class": get_ifc_class, "relating_type": get_relating_type}
extrusion_depth: bpy.props.FloatProperty(default=42.0)
def get_relating_type_info(self, context):
@@ -215,6 +215,43 @@ class RecalculateWall(bpy.types.Operator):
return {"FINISHED"}
class ChangeExtrusionDepth(bpy.types.Operator):
bl_idname = "bim.change_extrusion_depth"
bl_label = "Change Extrusion Depth"
bl_options = {"REGISTER", "UNDO"}
depth: bpy.props.FloatProperty()
@classmethod
def poll(cls, context):
return context.selected_objects
def execute(self, context):
for obj in context.selected_objects:
element = tool.Ifc.get_entity(obj)
if not element:
return
representation = ifcopenshell.util.representation.get_representation(element, "Model", "Body", "MODEL_VIEW")
if not representation:
return
extrusion = self.get_extrusion(representation)
if not extrusion:
return
print(extrusion)
extrusion.Depth = self.depth
print(extrusion)
DumbWallRecalculator().recalculate(context.selected_objects)
return {"FINISHED"}
def get_extrusion(self, representation):
item = representation.Items[0]
while True:
if item.is_a("IfcExtrudedAreaSolid"):
return item
elif item.is_a("IfcBooleanClippingResult"):
item = item.FirstOperand
else:
break
def recalculate_dumb_wall_origin(wall, new_origin=None):
if new_origin is None:
new_origin = wall.matrix_world @ Vector(wall.bound_box[0])
@@ -131,6 +131,11 @@ class BimTool(WorkSpaceTool):
if ifc_classes:
if ifc_class == "IfcWallType":
row = layout.row(align=True)
row.prop(data=props, property="extrusion_depth", text="Height")
op = row.operator("bim.change_extrusion_depth", icon="FILE_REFRESH", text="")
op.depth = props.extrusion_depth
row = layout.row()
row.label(text="Join")
row = layout.row(align=True)