From 8f4b0f1fd64278283bca0c5b7ff178ba2e618075 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 30 Dec 2024 12:45:09 +0500 Subject: [PATCH] Fix error refresh linked aggregate with 2+ levels of aggregates #5911 Error occurred if IfcElementAssembly, that was currently refreshed, had another IfcElementAssembly as it's part. Then, it was removed twice - once during delete_objects and another time during delete_ifc_object, leading to the error. --- src/bonsai/bonsai/bim/module/geometry/operator.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bonsai/bonsai/bim/module/geometry/operator.py b/src/bonsai/bonsai/bim/module/geometry/operator.py index 6242f1d35c..df46e775f0 100644 --- a/src/bonsai/bonsai/bim/module/geometry/operator.py +++ b/src/bonsai/bonsai/bim/module/geometry/operator.py @@ -1402,11 +1402,13 @@ class RefreshLinkedAggregate(bpy.types.Operator, tool.Ifc.Operator): original_names: dict[int, dict[int, str]] = {} def delete_objects(element: ifcopenshell.entity_instance) -> None: + """Remove IfcElementAssembly and it's parts.""" parts = ifcopenshell.util.element.get_parts(element) if parts: for part in parts: if part.is_a("IfcElementAssembly"): delete_objects(part) + continue tool.Geometry.delete_ifc_object(tool.Ifc.get_object(part))