Prevent removing rel when is still valid after IfcCostItem removal #6769

This commit is contained in:
Andrej
2025-06-06 14:32:53 +05:00
parent bf4a3f074f
commit 72cf77690e
2 changed files with 12 additions and 0 deletions
@@ -51,6 +51,8 @@ def remove_cost_item(file: ifcopenshell.file, cost_item: ifcopenshell.entity_ins
if history:
ifcopenshell.util.element.remove_deep2(file, history)
elif inverse.is_a("IfcRelAssignsToControl"):
if len(inverse.RelatedObjects) >= 2 or inverse.RelatingControl == cost_item:
continue
history = inverse.OwnerHistory
file.remove(inverse)
if history: