Fix #2787. Fix creating invalid orphaned property and group relationships when removing systems / groups / elements.

This commit is contained in:
Dion Moult
2023-02-21 10:59:47 +11:00
parent 9d8551cb48
commit 03a66d2806
7 changed files with 118 additions and 5 deletions
@@ -238,3 +238,10 @@ class TestRemoveProduct(test.bootstrap.IFC4):
)
ifcopenshell.api.run("root.remove_product", self.file, product=element)
assert not self.file.by_type("IfcRelSpaceBoundary")
def test_removing_orphaned_group_relationships(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
group = ifcopenshell.api.run("group.add_group", self.file, Name="Unit 1A")
ifcopenshell.api.run("group.assign_group", self.file, products=[element], group=group)
ifcopenshell.api.run("root.remove_product", self.file, product=element)
assert not self.file.by_type("IfcRelAssignsToGroup")