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
+1 -1
View File
@@ -347,6 +347,6 @@ for i in range(0, 4):
location = np.eye(4)
location[1][3] += i * 1
ifcopenshell.api.run("geometry.edit_object_placement", model, product=wall, matrix=location)
ifcopenshell.api.run("spatial.assign_container", model, relating_structure=storey, product=wall)
ifcopenshell.api.run("spatial.assign_container", model, relating_structure=storey, products=[wall])
model.write(os.path.join(outdir, "library", "sample.ifc"))
+3 -3
View File
@@ -1495,14 +1495,14 @@ class TestPartOf:
container = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcSpace")
facet = PartOf(name="IFCSPACE", relation="IFCRELCONTAINEDINSPATIALSTRUCTURE")
run("Any contained element passes a containment relationship 1/2", facet=facet, inst=element, expected=False)
ifcopenshell.api.run("spatial.assign_container", ifc, product=element, relating_structure=container)
ifcopenshell.api.run("spatial.assign_container", ifc, products=[element], relating_structure=container)
run("Any contained element passes a containment relationship 2/2", facet=facet, inst=element, expected=True)
run("The container itself always fails", facet=facet, inst=container, expected=False)
ifc = ifcopenshell.file()
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcElementAssembly")
container = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcSpace")
ifcopenshell.api.run("spatial.assign_container", ifc, product=element, relating_structure=container)
ifcopenshell.api.run("spatial.assign_container", ifc, products=[element], relating_structure=container)
facet = PartOf(relation="IFCRELCONTAINEDINSPATIALSTRUCTURE", name="IFCSITE")
run("The container entity must match exactly 1/2", facet=facet, inst=element, expected=False)
facet = PartOf(relation="IFCRELCONTAINEDINSPATIALSTRUCTURE", name="IFCSPACE")
@@ -1519,7 +1519,7 @@ class TestPartOf:
subelement = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcBeam")
ifcopenshell.api.run("aggregate.assign_object", ifc, product=subelement, relating_object=element)
container = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcSpace")
ifcopenshell.api.run("spatial.assign_container", ifc, product=element, relating_structure=container)
ifcopenshell.api.run("spatial.assign_container", ifc, products=[element], relating_structure=container)
facet = PartOf(relation="IFCRELCONTAINEDINSPATIALSTRUCTURE", name="IFCSPACE")
run("The container may be indirect", facet=facet, inst=subelement, expected=True)