mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Removing an element now also purges connection relationships
This commit is contained in:
@@ -70,4 +70,6 @@ class Usecase:
|
||||
elif inverse.is_a("IfcRelContainedInSpatialStructure"):
|
||||
if inverse.RelatingStructure == self.settings["product"] or len(inverse.RelatedElements) == 1:
|
||||
self.file.remove(inverse)
|
||||
elif inverse.is_a("IfcRelConnectsPathElements"):
|
||||
self.file.remove(inverse)
|
||||
self.file.remove(self.settings["product"])
|
||||
|
||||
@@ -184,3 +184,14 @@ class TestRemoveProduct(test.bootstrap.IFC4):
|
||||
assert len(self.file.by_type("IfcRelContainedInSpatialStructure")) == 0
|
||||
assert len(self.file.by_type("IfcSpace")) == 1
|
||||
assert len(self.file.by_type("IfcWall")) == 0
|
||||
|
||||
def test_removing_path_connection_relationships_of_an_element(self):
|
||||
element1 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBeam")
|
||||
element2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcColumn")
|
||||
ifcopenshell.api.run("geometry.connect_path", self.file, relating_element=element1, related_element=element2)
|
||||
total_entities = len(list(self.file))
|
||||
ifcopenshell.api.run("root.remove_product", self.file, product=element1)
|
||||
assert len(list(self.file)) == total_entities - 2
|
||||
assert len(self.file.by_type("IfcRelConnectsPathElements")) == 0
|
||||
assert len(self.file.by_type("IfcColumn")) == 1
|
||||
assert len(self.file.by_type("IfcBeam")) == 0
|
||||
|
||||
Reference in New Issue
Block a user