spatial.assign_container - support batching #4474

This commit is contained in:
Andrej730
2024-04-05 14:57:11 +05:00
parent 78abca16e6
commit 109787d869
32 changed files with 157 additions and 119 deletions
@@ -28,7 +28,7 @@ class TestAssignContainer(test.bootstrap.IFC4):
def test_unassigning_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)
ifcopenshell.api.run("spatial.assign_container", self.file, products=[subelement], relating_structure=element)
ifcopenshell.api.run("spatial.unassign_container", self.file, product=subelement)
assert not self.file.by_type("IfcRelContainedInSpatialStructure")
@@ -36,8 +36,8 @@ class TestAssignContainer(test.bootstrap.IFC4):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuilding")
subelement = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
subelement2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
ifcopenshell.api.run("spatial.assign_container", self.file, product=subelement, relating_structure=element)
ifcopenshell.api.run("spatial.assign_container", self.file, product=subelement2, relating_structure=element)
ifcopenshell.api.run("spatial.assign_container", self.file, products=[subelement], relating_structure=element)
ifcopenshell.api.run("spatial.assign_container", self.file, products=[subelement2], relating_structure=element)
ifcopenshell.api.run("spatial.unassign_container", self.file, product=subelement)
rel = self.file.by_type("IfcRelContainedInSpatialStructure")[0]
assert list(rel.RelatedElements) == [subelement2]