Fix #4740. Bug where building element proxies didn't work for the auto calculate all button.

This commit is contained in:
Dion Moult
2024-05-27 11:02:23 +10:00
parent 7142f3856c
commit 70a4af2605
3 changed files with 9 additions and 4 deletions
@@ -170,6 +170,7 @@ class QuantifyObjects(bpy.types.Operator):
ifcopenshell.api.run("pset.edit_qto", self.file, qto=qto, properties={props.prop_name: result})
return {"FINISHED"}
class AssignBaseQto(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.assign_objects_base_qto"
bl_label = "Assign IFC Object Quantity Set"
@@ -181,9 +182,10 @@ class AssignBaseQto(bpy.types.Operator, tool.Ifc.Operator):
return tool.Ifc.get() and context.selected_objects
def _execute(self, context):
core.assign_objects_base_qto(tool.Ifc, tool.Qto, selected_objects = context.selected_objects)
core.assign_objects_base_qto(tool.Ifc, tool.Qto, selected_objects=context.selected_objects)
return {"FINISHED"}
class CalculateAllQuantities(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.calculate_all_quantities"
bl_label = "Calculate All Quantities"
@@ -195,5 +197,7 @@ class CalculateAllQuantities(bpy.types.Operator, tool.Ifc.Operator):
return tool.Ifc.get() and context.selected_objects
def _execute(self, context):
core.calculate_objects_base_quantities(tool.Ifc, tool.Cost, tool.Qto, QtoCalculator(), selected_objects = context.selected_objects)
core.calculate_objects_base_quantities(
tool.Ifc, tool.Cost, tool.Qto, QtoCalculator(), selected_objects=context.selected_objects
)
return {"FINISHED"}
+1 -1
View File
@@ -65,4 +65,4 @@ def calculate_object_base_quantities(ifc, cost, qto, calculator, obj):
)
calculated_quantities = qto.get_calculated_object_quantities(calculator, base_quantity_name, obj)
ifc.run("pset.edit_qto", qto=base_qto, properties=calculated_quantities)
cost.update_cost_items(product=product)
cost.update_cost_items(product=product)
+2 -1
View File
@@ -78,7 +78,8 @@ class Qto(blenderbim.core.tool.Qto):
applicable_qto_names = blenderbim.bim.schema.ifc.psetqto.get_applicable_names(
product.is_a(), ifcopenshell.util.element.get_predefined_type(product), qto_only=True
)
return next((qto_name for qto_name in applicable_qto_names if "Qto_" in qto_name and "Base" in qto_name), None)
# See https://github.com/buildingSMART/IFC4.3.x-development/issues/851 for anomalies in Qto naming
return next((qto_name for qto_name in applicable_qto_names if "Qto_" in qto_name), None)
@classmethod
def get_new_calculated_quantity(cls, qto_name: str, quantity_name: str, obj: bpy.types.Object) -> float: