mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 10:33:20 +00:00
aggregate.assign_object - support batching #4474
This commit is contained in:
@@ -89,7 +89,7 @@ class TestCopyClass(test.bootstrap.IFC4):
|
||||
def test_copying_a_container_only_and_not_its_decomposition(self):
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuilding")
|
||||
subelement = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuildingStorey")
|
||||
ifcopenshell.api.run("aggregate.assign_object", self.file, product=subelement, relating_object=element)
|
||||
ifcopenshell.api.run("aggregate.assign_object", self.file, products=[subelement], relating_object=element)
|
||||
new = ifcopenshell.api.run("root.copy_class", self.file, product=element)
|
||||
assert element.IsDecomposedBy
|
||||
assert not new.IsDecomposedBy
|
||||
@@ -97,7 +97,7 @@ class TestCopyClass(test.bootstrap.IFC4):
|
||||
def test_copying_an_aggregate_only_and_not_its_decomposition(self):
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcElementAssembly")
|
||||
subelement = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBeam")
|
||||
ifcopenshell.api.run("aggregate.assign_object", self.file, product=subelement, relating_object=element)
|
||||
ifcopenshell.api.run("aggregate.assign_object", self.file, products=[subelement], relating_object=element)
|
||||
new = ifcopenshell.api.run("root.copy_class", self.file, product=element)
|
||||
assert element.IsDecomposedBy
|
||||
assert not new.IsDecomposedBy
|
||||
@@ -105,7 +105,7 @@ class TestCopyClass(test.bootstrap.IFC4):
|
||||
def test_copying_an_aggregate_decomposition_and_maintaining_the_aggregate_relationship(self):
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcElementAssembly")
|
||||
subelement = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBeam")
|
||||
ifcopenshell.api.run("aggregate.assign_object", self.file, product=subelement, relating_object=element)
|
||||
ifcopenshell.api.run("aggregate.assign_object", self.file, products=[subelement], relating_object=element)
|
||||
new = ifcopenshell.api.run("root.copy_class", self.file, product=subelement)
|
||||
assert new.Decomposes[0].RelatingObject == element
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@ class TestRemoveProduct(test.bootstrap.IFC4):
|
||||
def test_removing_all_aggregate_relationships_of_a_whole(self):
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcElementAssembly")
|
||||
subelement = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBeam")
|
||||
ifcopenshell.api.run("aggregate.assign_object", self.file, product=subelement, relating_object=element)
|
||||
ifcopenshell.api.run("aggregate.assign_object", self.file, products=[subelement], relating_object=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
|
||||
@@ -223,7 +223,7 @@ class TestRemoveProduct(test.bootstrap.IFC4):
|
||||
def test_removing_all_aggregate_relationships_of_a_part(self):
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcElementAssembly")
|
||||
subelement = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBeam")
|
||||
ifcopenshell.api.run("aggregate.assign_object", self.file, product=subelement, relating_object=element)
|
||||
ifcopenshell.api.run("aggregate.assign_object", self.file, products=[subelement], relating_object=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
|
||||
|
||||
Reference in New Issue
Block a user