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.
This commit is contained in:
Andrej730
2024-12-30 12:45:09 +05:00
parent 6965399b2a
commit 8f4b0f1fd6
@@ -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))