From 70a4af260548202fcae084ebdfaf2218007eda52 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Mon, 27 May 2024 11:02:23 +1000 Subject: [PATCH] Fix #4740. Bug where building element proxies didn't work for the auto calculate all button. --- src/blenderbim/blenderbim/bim/module/qto/operator.py | 8 ++++++-- src/blenderbim/blenderbim/core/qto.py | 2 +- src/blenderbim/blenderbim/tool/qto.py | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/qto/operator.py b/src/blenderbim/blenderbim/bim/module/qto/operator.py index 951b541df2..de3084a898 100644 --- a/src/blenderbim/blenderbim/bim/module/qto/operator.py +++ b/src/blenderbim/blenderbim/bim/module/qto/operator.py @@ -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"} diff --git a/src/blenderbim/blenderbim/core/qto.py b/src/blenderbim/blenderbim/core/qto.py index 16ae9719dc..52aacf6e3a 100644 --- a/src/blenderbim/blenderbim/core/qto.py +++ b/src/blenderbim/blenderbim/core/qto.py @@ -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) \ No newline at end of file + cost.update_cost_items(product=product) diff --git a/src/blenderbim/blenderbim/tool/qto.py b/src/blenderbim/blenderbim/tool/qto.py index b96b638907..68893fa661 100644 --- a/src/blenderbim/blenderbim/tool/qto.py +++ b/src/blenderbim/blenderbim/tool/qto.py @@ -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: