aggregate.assign_object - support batching #4474

This commit is contained in:
Andrej730
2024-04-08 16:23:48 +05:00
parent d764c0af23
commit cd11d2de27
34 changed files with 187 additions and 143 deletions
+3 -3
View File
@@ -320,9 +320,9 @@ site = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcSite", na
building = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcBuilding", name="Building A")
storey = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcBuildingStorey", name="Ground Floor")
ifcopenshell.api.run("aggregate.assign_object", model, relating_object=project, product=site)
ifcopenshell.api.run("aggregate.assign_object", model, relating_object=site, product=building)
ifcopenshell.api.run("aggregate.assign_object", model, relating_object=building, product=storey)
ifcopenshell.api.run("aggregate.assign_object", model, relating_object=project, products=[site])
ifcopenshell.api.run("aggregate.assign_object", model, relating_object=site, products=[building])
ifcopenshell.api.run("aggregate.assign_object", model, relating_object=building, products=[storey])
wall_types = []
for i in range(0, 4):
+5 -5
View File
@@ -1428,7 +1428,7 @@ class TestPartOf:
subelement = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
facet = PartOf(name="IFCELEMENTASSEMBLY", relation="IFCRELAGGREGATES")
run("A non aggregated element fails an aggregate relationship", facet=facet, inst=subelement, expected=False)
ifcopenshell.api.run("aggregate.assign_object", ifc, product=subelement, relating_object=element)
ifcopenshell.api.run("aggregate.assign_object", ifc, products=[subelement], relating_object=element)
run("The aggregated whole fails an aggregate relationship", facet=facet, inst=element, expected=False)
run("The aggregated part passes an aggregate relationship", facet=facet, inst=subelement, expected=True)
@@ -1439,7 +1439,7 @@ class TestPartOf:
ifc = ifcopenshell.file()
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcSlab")
subelement = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcBeam")
ifcopenshell.api.run("aggregate.assign_object", ifc, product=subelement, relating_object=element)
ifcopenshell.api.run("aggregate.assign_object", ifc, products=[subelement], relating_object=element)
facet = PartOf(name="IFCSLAB", relation="IFCRELAGGREGATES")
run("An aggregate may specify the entity of the whole 1/2", facet=facet, inst=subelement, expected=True)
facet = PartOf(name="IFCWALL", relation="IFCRELAGGREGATES")
@@ -1462,8 +1462,8 @@ class TestPartOf:
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcElementAssembly")
subelement = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcSlab")
subsubelement = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcBeam")
ifcopenshell.api.run("aggregate.assign_object", ifc, product=subelement, relating_object=element)
ifcopenshell.api.run("aggregate.assign_object", ifc, product=subsubelement, relating_object=subelement)
ifcopenshell.api.run("aggregate.assign_object", ifc, products=[subelement], relating_object=element)
ifcopenshell.api.run("aggregate.assign_object", ifc, products=[subsubelement], relating_object=subelement)
facet = PartOf(name="IFCELEMENTASSEMBLY", relation="IFCRELAGGREGATES")
run("An aggregate entity may pass any ancestral whole passes", facet=facet, inst=subsubelement, expected=True)
@@ -1517,7 +1517,7 @@ class TestPartOf:
ifc = ifcopenshell.file()
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcSlab")
subelement = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcBeam")
ifcopenshell.api.run("aggregate.assign_object", ifc, product=subelement, relating_object=element)
ifcopenshell.api.run("aggregate.assign_object", ifc, products=[subelement], relating_object=element)
container = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcSpace")
ifcopenshell.api.run("spatial.assign_container", ifc, products=[element], relating_structure=container)
facet = PartOf(relation="IFCRELCONTAINEDINSPATIALSTRUCTURE", name="IFCSPACE")