mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
spatial.assign_container - support batching #4474
This commit is contained in:
@@ -114,6 +114,6 @@ class TestAssignObject(test.bootstrap.IFC4):
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcElementAssembly")
|
||||
container = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuildingStorey")
|
||||
subelement = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, product=subelement, relating_structure=container)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, products=[subelement], relating_structure=container)
|
||||
ifcopenshell.api.run("aggregate.assign_object", self.file, product=subelement, relating_object=element)
|
||||
assert not ifcopenshell.util.element.get_container(subelement, should_get_direct=True)
|
||||
|
||||
@@ -172,7 +172,7 @@ class TestEditObjectPlacement(test.bootstrap.IFC4):
|
||||
ifcopenshell.api.run("unit.assign_unit", self.file)
|
||||
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)
|
||||
matrix1 = numpy.array(
|
||||
(
|
||||
(1.0, 0.0, 0.0, 1.0),
|
||||
@@ -221,7 +221,7 @@ class TestEditObjectPlacement(test.bootstrap.IFC4):
|
||||
(0.0, 0.0, 0.0, 1.0),
|
||||
)
|
||||
)
|
||||
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(
|
||||
"geometry.edit_object_placement", self.file, product=element, matrix=matrix.copy(), is_si=False
|
||||
)
|
||||
@@ -301,7 +301,7 @@ class TestEditObjectPlacement(test.bootstrap.IFC4):
|
||||
site = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcSite")
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
subelement = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcOpeningElement")
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, product=element, relating_structure=site)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, products=[element], relating_structure=site)
|
||||
matrix = numpy.array(
|
||||
(
|
||||
(1.0, 0.0, 0.0, 1.0),
|
||||
@@ -336,8 +336,8 @@ class TestEditObjectPlacement(test.bootstrap.IFC4):
|
||||
wall = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcOpeningElement")
|
||||
subelement = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcDoor")
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, product=wall, relating_structure=site)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, product=subelement, relating_structure=site)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, products=[wall], relating_structure=site)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, products=[subelement], relating_structure=site)
|
||||
matrix = numpy.array(
|
||||
(
|
||||
(1.0, 0.0, 0.0, 1.0),
|
||||
@@ -435,7 +435,7 @@ class TestEditObjectPlacement(test.bootstrap.IFC4):
|
||||
(0.0, 0.0, 0.0, 1.0),
|
||||
)
|
||||
)
|
||||
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(
|
||||
"geometry.edit_object_placement", self.file, product=element, matrix=matrix.copy(), is_si=False
|
||||
)
|
||||
@@ -478,7 +478,7 @@ class TestEditObjectPlacement(test.bootstrap.IFC4):
|
||||
(0.0, 0.0, 0.0, 1.0),
|
||||
)
|
||||
)
|
||||
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(
|
||||
"geometry.edit_object_placement", self.file, product=element, matrix=matrix.copy(), is_si=False
|
||||
)
|
||||
@@ -528,7 +528,7 @@ class TestEditObjectPlacement(test.bootstrap.IFC4):
|
||||
(0.0, 0.0, 0.0, 1.0),
|
||||
)
|
||||
)
|
||||
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(
|
||||
"geometry.edit_object_placement", self.file, product=element, matrix=matrix.copy(), is_si=False
|
||||
)
|
||||
@@ -631,7 +631,7 @@ class TestEditObjectPlacement(test.bootstrap.IFC4):
|
||||
storey = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuildingStorey")
|
||||
ifcopenshell.api.run("aggregate.assign_object", self.file, product=storey, relating_object=building)
|
||||
wall = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, product=wall, relating_structure=storey)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, products=[wall], relating_structure=storey)
|
||||
|
||||
matrix = np_matrix_translation((1, 1, 1))
|
||||
submatrix = np_matrix_translation((1, 2, 3))
|
||||
|
||||
@@ -34,7 +34,7 @@ class TestCopyClass(test.bootstrap.IFC4):
|
||||
ifcopenshell.api.run("unit.assign_unit", self.file)
|
||||
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)
|
||||
matrix = numpy.identity(4)
|
||||
ifcopenshell.api.run("geometry.edit_object_placement", self.file, product=element, matrix=matrix.copy())
|
||||
ifcopenshell.api.run("geometry.edit_object_placement", self.file, product=subelement, matrix=matrix.copy())
|
||||
@@ -74,7 +74,7 @@ class TestCopyClass(test.bootstrap.IFC4):
|
||||
def test_copying_a_container_only_and_not_its_contents(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)
|
||||
new = ifcopenshell.api.run("root.copy_class", self.file, product=element)
|
||||
assert element.ContainsElements
|
||||
assert not new.ContainsElements
|
||||
@@ -82,7 +82,7 @@ class TestCopyClass(test.bootstrap.IFC4):
|
||||
def test_copying_contents_of_a_container_and_maintaining_the_containment_relationship(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)
|
||||
new = ifcopenshell.api.run("root.copy_class", self.file, product=subelement)
|
||||
assert new.ContainedInStructure[0].RelatingStructure == element
|
||||
|
||||
|
||||
@@ -234,7 +234,7 @@ class TestRemoveProduct(test.bootstrap.IFC4):
|
||||
def test_removing_all_containment_relationships_of_a_container(self):
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcSpace")
|
||||
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)
|
||||
total_entities = len(list(self.file))
|
||||
ifcopenshell.api.run("root.remove_product", self.file, product=element)
|
||||
assert len(list(self.file)) == total_entities - 2
|
||||
@@ -245,7 +245,7 @@ class TestRemoveProduct(test.bootstrap.IFC4):
|
||||
def test_removing_all_containment_relationships_of_an_element(self):
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcSpace")
|
||||
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)
|
||||
total_entities = len(list(self.file))
|
||||
ifcopenshell.api.run("root.remove_product", self.file, product=subelement)
|
||||
assert len(list(self.file)) == total_entities - 2
|
||||
|
||||
@@ -28,18 +28,20 @@ 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")
|
||||
subelement2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
rel = ifcopenshell.api.run(
|
||||
"spatial.assign_container", self.file, product=subelement, relating_structure=element
|
||||
"spatial.assign_container", self.file, products=[subelement, subelement2], relating_structure=element
|
||||
)
|
||||
assert ifcopenshell.util.element.get_container(subelement) == element
|
||||
assert ifcopenshell.util.element.get_container(subelement2) == 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")
|
||||
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)
|
||||
total_elements = len([e for e in self.file])
|
||||
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)
|
||||
assert len([e for e in self.file]) == total_elements
|
||||
|
||||
def test_that_old_containment_relationships_are_updated_if_they_still_contain_elements(self):
|
||||
@@ -47,20 +49,20 @@ class TestAssignContainer(test.bootstrap.IFC4):
|
||||
element2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuilding")
|
||||
subelement1 = 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=subelement1, relating_structure=element1)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, product=subelement2, relating_structure=element1)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, products=[subelement1], relating_structure=element1)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, products=[subelement2], relating_structure=element1)
|
||||
rel = subelement1.ContainedInStructure[0]
|
||||
assert len(rel.RelatedElements) == 2
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, product=subelement1, relating_structure=element2)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, products=[subelement1], relating_structure=element2)
|
||||
assert len(rel.RelatedElements) == 1
|
||||
|
||||
def test_that_old_containment_relationships_are_purged_if_no_more_elements_are_contained(self):
|
||||
element1 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuilding")
|
||||
element2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuilding")
|
||||
subelement1 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, product=subelement1, relating_structure=element1)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, products=[subelement1], relating_structure=element1)
|
||||
rel_id = subelement1.ContainedInStructure[0].id()
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, product=subelement1, relating_structure=element2)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, products=[subelement1], relating_structure=element2)
|
||||
with pytest.raises(RuntimeError):
|
||||
self.file.by_id(rel_id)
|
||||
|
||||
@@ -70,7 +72,7 @@ class TestAssignContainer(test.bootstrap.IFC4):
|
||||
element1 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuilding")
|
||||
element2 = 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=element1)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, products=[subelement], relating_structure=element1)
|
||||
matrix1 = numpy.array(
|
||||
(
|
||||
(1.0, 0.0, 0.0, 1.0),
|
||||
@@ -96,7 +98,7 @@ class TestAssignContainer(test.bootstrap.IFC4):
|
||||
ifcopenshell.api.run(
|
||||
"geometry.edit_object_placement", self.file, product=subelement, matrix=matrix1.copy(), is_si=False
|
||||
)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, product=subelement, relating_structure=element2)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, products=[subelement], relating_structure=element2)
|
||||
assert subelement.ObjectPlacement.PlacementRelTo.PlacesObject[0] == element2
|
||||
assert numpy.array_equal(ifcopenshell.util.placement.get_local_placement(subelement.ObjectPlacement), matrix1)
|
||||
|
||||
@@ -107,7 +109,7 @@ class TestAssignContainer(test.bootstrap.IFC4):
|
||||
subelement = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
placement = self.file.createIfcGridPlacement()
|
||||
subelement.ObjectPlacement = placement
|
||||
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)
|
||||
assert subelement.ObjectPlacement == placement
|
||||
|
||||
def test_removing_aggregation_if_it_exists(self):
|
||||
@@ -117,5 +119,5 @@ class TestAssignContainer(test.bootstrap.IFC4):
|
||||
aggregate = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcElementAssembly")
|
||||
subelement = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
ifcopenshell.api.run("aggregate.assign_object", self.file, product=subelement, relating_object=aggregate)
|
||||
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)
|
||||
assert not ifcopenshell.util.element.get_aggregate(subelement)
|
||||
|
||||
@@ -28,7 +28,7 @@ class TestRemoveContainer(test.bootstrap.IFC4):
|
||||
def test_removing_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.remove_container", self.file, product=subelement)
|
||||
assert ifcopenshell.util.element.get_container(subelement) is None
|
||||
|
||||
@@ -41,14 +41,14 @@ class TestRemoveContainer(test.bootstrap.IFC4):
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuilding")
|
||||
subelement1 = 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=subelement1, 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=[subelement1], relating_structure=element)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, products=[subelement2], relating_structure=element)
|
||||
ifcopenshell.api.run("spatial.remove_container", self.file, product=subelement1)
|
||||
assert self.file.by_type("IfcRelContainedInSpatialStructure")[0].RelatedElements == (subelement2,)
|
||||
|
||||
def test_deleting_the_rel_when_a_container_is_removed_with_no_elements(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.remove_container", self.file, product=subelement)
|
||||
assert len(self.file.by_type("IfcRelContainedInSpatialStructure")) == 0
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -698,14 +698,14 @@ class TestGetContainerIFC4(test.bootstrap.IFC4):
|
||||
def test_getting_the_spatial_container_of_an_element(self):
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
building = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuilding")
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, product=element, relating_structure=building)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, products=[element], relating_structure=building)
|
||||
assert subject.get_container(element) == building
|
||||
|
||||
def test_getting_an_indirect_spatial_container_of_an_element(self):
|
||||
subelement = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcElementAssembly")
|
||||
building = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuilding")
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, product=element, relating_structure=building)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, products=[element], relating_structure=building)
|
||||
ifcopenshell.api.run("aggregate.assign_object", self.file, product=subelement, relating_object=element)
|
||||
assert subject.get_container(subelement) == building
|
||||
|
||||
@@ -713,7 +713,7 @@ class TestGetContainerIFC4(test.bootstrap.IFC4):
|
||||
subelement = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcElementAssembly")
|
||||
building = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuilding")
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, product=element, relating_structure=building)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, products=[element], relating_structure=building)
|
||||
ifcopenshell.api.run("aggregate.assign_object", self.file, product=subelement, relating_object=element)
|
||||
assert subject.get_container(subelement, should_get_direct=True) is None
|
||||
|
||||
@@ -735,7 +735,7 @@ class TestGetDecompositionIFC4(test.bootstrap.IFC4):
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcElementAssembly")
|
||||
subelement = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBeam")
|
||||
building = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuilding")
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, product=element, relating_structure=building)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, products=[element], relating_structure=building)
|
||||
ifcopenshell.api.run("aggregate.assign_object", self.file, product=subelement, relating_object=element)
|
||||
results = subject.get_decomposition(building)
|
||||
assert element in results
|
||||
|
||||
@@ -234,8 +234,8 @@ class TestFilterElements(test.bootstrap.IFC4):
|
||||
storey = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuildingStorey", name="G")
|
||||
building = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuilding", name="Building")
|
||||
project = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject", name="Project")
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, product=element, relating_structure=space)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, product=element2, relating_structure=storey)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, products=[element], relating_structure=space)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, products=[element2], relating_structure=storey)
|
||||
ifcopenshell.api.run("aggregate.assign_object", self.file, product=space, relating_object=storey)
|
||||
ifcopenshell.api.run("aggregate.assign_object", self.file, product=storey, relating_object=building)
|
||||
ifcopenshell.api.run("aggregate.assign_object", self.file, product=building, relating_object=project)
|
||||
@@ -468,7 +468,7 @@ class TestSelector(test.bootstrap.IFC4):
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
subelement = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcMember")
|
||||
building = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuilding")
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, product=element, relating_structure=building)
|
||||
ifcopenshell.api.run("spatial.assign_container", self.file, products=[element], relating_structure=building)
|
||||
ifcopenshell.api.run("aggregate.assign_object", self.file, product=subelement, relating_object=element)
|
||||
assert set(subject.Selector.parse(self.file, "@ .IfcBuilding")) == {element, subelement}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user