Changing aggregation now ensures spatial containment is mutually exclusive to prevent invalid IFC data

This commit is contained in:
Dion Moult
2021-10-06 12:52:01 +11:00
parent f21005c29e
commit 3aa36dd4b7
7 changed files with 141 additions and 7 deletions
@@ -10,8 +10,11 @@ class TestAssignContainer(test.bootstrap.IFC4):
def test_assigning_a_container(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuilding")
subelement = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
ifcopenshell.api.run("spatial.assign_container", self.file, product=subelement, relating_structure=element)
rel = ifcopenshell.api.run(
"spatial.assign_container", self.file, product=subelement, relating_structure=element
)
assert ifcopenshell.util.element.get_container(subelement) == element
assert rel.is_a("IfcRelContainedInSpatialStructure")
def test_doing_nothing_if_the_container_is_already_assigned(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuilding")