From 23fee9c8c8a6321f054fbffeca808bab02738f3a Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sun, 2 Jun 2024 17:43:25 +1000 Subject: [PATCH] Bring back formwork calculation feature that uses remesh --- .../blenderbim/bim/module/qto/__init__.py | 1 + .../blenderbim/bim/module/qto/operator.py | 15 +++++++++++++++ src/blenderbim/blenderbim/bim/module/qto/ui.py | 10 ++++++---- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/qto/__init__.py b/src/blenderbim/blenderbim/bim/module/qto/__init__.py index dada98ae88..a86ca04195 100644 --- a/src/blenderbim/blenderbim/bim/module/qto/__init__.py +++ b/src/blenderbim/blenderbim/bim/module/qto/__init__.py @@ -23,6 +23,7 @@ classes = ( operator.CalculateCircleRadius, operator.CalculateEdgeLengths, operator.CalculateFaceAreas, + operator.CalculateFormworkArea, operator.CalculateObjectVolumes, operator.CalculateSingleQuantity, operator.PerformQuantityTakeOff, diff --git a/src/blenderbim/blenderbim/bim/module/qto/operator.py b/src/blenderbim/blenderbim/bim/module/qto/operator.py index de6d270d89..c07df67466 100644 --- a/src/blenderbim/blenderbim/bim/module/qto/operator.py +++ b/src/blenderbim/blenderbim/bim/module/qto/operator.py @@ -84,6 +84,21 @@ class CalculateObjectVolumes(bpy.types.Operator): return {"FINISHED"} +class CalculateFormworkArea(bpy.types.Operator): + bl_idname = "bim.calculate_formwork_area" + bl_label = "Calculate Formwork Area" + bl_options = {"REGISTER", "UNDO"} + + @classmethod + def poll(cls, context): + return context.selected_objects and context.active_object + + def execute(self, context): + result = helper.calculate_formwork_area([o for o in context.selected_objects if o.type == "MESH"], context) + context.scene.BIMQtoProperties.qto_result = str(round(result, 3)) + return {"FINISHED"} + + class CalculateSingleQuantity(bpy.types.Operator, tool.Ifc.Operator): bl_idname = "bim.calculate_single_quantity" bl_label = "Calculate Single Quantity" diff --git a/src/blenderbim/blenderbim/bim/module/qto/ui.py b/src/blenderbim/blenderbim/bim/module/qto/ui.py index c7f4863463..70c03b1496 100644 --- a/src/blenderbim/blenderbim/bim/module/qto/ui.py +++ b/src/blenderbim/blenderbim/bim/module/qto/ui.py @@ -87,14 +87,16 @@ class BIM_PT_qto_simple(bpy.types.Panel): row = layout.row() row.prop(props, "qto_result", text="Results") - row = layout.row(align=True) + row = layout.row() row.operator("bim.calculate_circle_radius") - row = layout.row(align=True) + row = layout.row() row.operator("bim.calculate_edge_lengths") - row = layout.row(align=True) + row = layout.row() row.operator("bim.calculate_face_areas") - row = layout.row(align=True) + row = layout.row() row.operator("bim.calculate_object_volumes") + row = layout.row() + row.operator("bim.calculate_formwork_area") class BIM_PT_qto_cost(bpy.types.Panel):