mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Fix #2787. Fix creating invalid orphaned property and group relationships when removing systems / groups / elements.
This commit is contained in:
@@ -25,3 +25,19 @@ class TestRemoveSystem(test.bootstrap.IFC4):
|
||||
system = ifcopenshell.api.run("system.add_system", self.file, ifc_class="IfcSystem")
|
||||
ifcopenshell.api.run("system.remove_system", self.file, system=system)
|
||||
assert len(self.file.by_type("IfcSystem")) == 0
|
||||
|
||||
def test_removing_orphaned_group_relationships(self):
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcPump")
|
||||
system = ifcopenshell.api.run("system.add_system", self.file, ifc_class="IfcSystem")
|
||||
ifcopenshell.api.run("system.assign_system", self.file, product=element, system=system)
|
||||
ifcopenshell.api.run("system.remove_system", self.file, system=system)
|
||||
assert not self.file.by_type("IfcRelAssignsToGroup")
|
||||
|
||||
def test_removing_orphaned_property_relationships(self):
|
||||
system = ifcopenshell.api.run("system.add_system", self.file, ifc_class="IfcSystem")
|
||||
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=system, name="Foo_Bar")
|
||||
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Foo": "Bar"})
|
||||
ifcopenshell.api.run("system.remove_system", self.file, system=system)
|
||||
assert not self.file.by_type("IfcRelDefinesByProperties")
|
||||
assert not self.file.by_type("IfcPropertySet")
|
||||
assert not self.file.by_type("IfcPropertySingleValue")
|
||||
|
||||
Reference in New Issue
Block a user