mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-11 06:18:09 +00:00
aggregate.assign_object - support batching #4474
This commit is contained in:
@@ -38,7 +38,7 @@ class TestAssignObject:
|
||||
ifc.get_entity("relating_obj").should_be_called().will_return("relating_object")
|
||||
ifc.get_entity("related_obj").should_be_called().will_return("related_object")
|
||||
ifc.run(
|
||||
"aggregate.assign_object", product="related_object", relating_object="relating_object"
|
||||
"aggregate.assign_object", products=["related_object"], relating_object="relating_object"
|
||||
).should_be_called().will_return("rel")
|
||||
aggregate.disable_editing("related_obj").should_be_called()
|
||||
collector.assign("relating_obj").should_be_called()
|
||||
|
||||
@@ -320,8 +320,8 @@ class TestGetParentSpace(NewFile):
|
||||
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcBuildingStorey")
|
||||
subelement = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcSpace")
|
||||
project = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcProject")
|
||||
ifcopenshell.api.run("aggregate.assign_object", ifc, product=subelement, relating_object=element)
|
||||
ifcopenshell.api.run("aggregate.assign_object", ifc, product=element, relating_object=project)
|
||||
ifcopenshell.api.run("aggregate.assign_object", ifc, products=[subelement], relating_object=element)
|
||||
ifcopenshell.api.run("aggregate.assign_object", ifc, products=[element], relating_object=project)
|
||||
assert subject.get_parent_space(subelement) == element
|
||||
assert subject.get_parent_space(element) is None
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class TestAssign(NewFile):
|
||||
"aggregate.assign_object",
|
||||
tool.Ifc.get(),
|
||||
relating_object=tool.Ifc.get().by_type("IfcSite")[0],
|
||||
product=space_element,
|
||||
products=[space_element],
|
||||
)
|
||||
subject.assign(space_obj)
|
||||
assert len(space_obj.users_collection) == 1
|
||||
@@ -84,7 +84,7 @@ class TestAssign(NewFile):
|
||||
"aggregate.assign_object",
|
||||
tool.Ifc.get(),
|
||||
relating_object=tool.Ifc.get().by_type("IfcSite")[0],
|
||||
product=space_element,
|
||||
products=[space_element],
|
||||
)
|
||||
subject.assign(space_obj)
|
||||
subject.assign(space_obj)
|
||||
@@ -103,7 +103,7 @@ class TestAssign(NewFile):
|
||||
"aggregate.assign_object",
|
||||
tool.Ifc.get(),
|
||||
relating_object=tool.Ifc.get().by_type("IfcSite")[0],
|
||||
product=space_element,
|
||||
products=[space_element],
|
||||
)
|
||||
subject.assign(space_obj)
|
||||
assert len(space_obj.users_collection) == 1
|
||||
@@ -121,7 +121,7 @@ class TestAssign(NewFile):
|
||||
"aggregate.assign_object",
|
||||
tool.Ifc.get(),
|
||||
relating_object=element,
|
||||
product=subelement,
|
||||
products=[subelement],
|
||||
)
|
||||
subject.assign(element_obj)
|
||||
assert len(element_obj.users_collection) == 1
|
||||
@@ -161,7 +161,7 @@ class TestAssign(NewFile):
|
||||
"aggregate.assign_object",
|
||||
tool.Ifc.get(),
|
||||
relating_object=tool.Ifc.get().by_type("IfcSite")[0],
|
||||
product=space_element,
|
||||
products=[space_element],
|
||||
)
|
||||
subject.assign(space_obj)
|
||||
assert bpy.context.scene.collection.children.find(space_collection.name) == -1
|
||||
@@ -180,7 +180,7 @@ class TestAssign(NewFile):
|
||||
"aggregate.assign_object",
|
||||
tool.Ifc.get(),
|
||||
relating_object=element,
|
||||
product=subelement,
|
||||
products=[subelement],
|
||||
)
|
||||
subject.assign(element_obj)
|
||||
subject.assign(subelement_obj)
|
||||
@@ -203,7 +203,7 @@ class TestAssign(NewFile):
|
||||
"aggregate.assign_object",
|
||||
tool.Ifc.get(),
|
||||
relating_object=element,
|
||||
product=subelement,
|
||||
products=[subelement],
|
||||
)
|
||||
subject.assign(subelement_obj)
|
||||
assert subelement_obj.users_collection[0].name == "IfcSite/My Site"
|
||||
|
||||
@@ -86,8 +86,8 @@ class TestGetStoreyHeight(test.bim.bootstrap.NewFile):
|
||||
storey.Elevation = 3000
|
||||
storey2 = ifc.createIfcBuildingStorey()
|
||||
storey2.Elevation = 5000
|
||||
ifcopenshell.api.run("aggregate.assign_object", ifc, product=storey, relating_object=building)
|
||||
ifcopenshell.api.run("aggregate.assign_object", ifc, product=storey2, relating_object=building)
|
||||
ifcopenshell.api.run("aggregate.assign_object", ifc, products=[storey], relating_object=building)
|
||||
ifcopenshell.api.run("aggregate.assign_object", ifc, products=[storey2], relating_object=building)
|
||||
assert subject.get_storey_height_in_si(storey, 1) == 2.0
|
||||
|
||||
def test_getting_a_double_storey_height(self):
|
||||
@@ -103,9 +103,9 @@ class TestGetStoreyHeight(test.bim.bootstrap.NewFile):
|
||||
storey2.Elevation = 5000
|
||||
storey3 = ifc.createIfcBuildingStorey()
|
||||
storey3.Elevation = 9000
|
||||
ifcopenshell.api.run("aggregate.assign_object", ifc, product=storey, relating_object=building)
|
||||
ifcopenshell.api.run("aggregate.assign_object", ifc, product=storey2, relating_object=building)
|
||||
ifcopenshell.api.run("aggregate.assign_object", ifc, product=storey3, relating_object=building)
|
||||
ifcopenshell.api.run("aggregate.assign_object", ifc, products=[storey], relating_object=building)
|
||||
ifcopenshell.api.run("aggregate.assign_object", ifc, products=[storey2], relating_object=building)
|
||||
ifcopenshell.api.run("aggregate.assign_object", ifc, products=[storey3], relating_object=building)
|
||||
assert subject.get_storey_height_in_si(storey, 2) == 6.0
|
||||
|
||||
def test_only_considering_storeys_in_the_same_building(self):
|
||||
@@ -116,7 +116,7 @@ class TestGetStoreyHeight(test.bim.bootstrap.NewFile):
|
||||
storey.Elevation = 3000
|
||||
storey2 = ifc.createIfcBuildingStorey()
|
||||
storey2.Elevation = 5000
|
||||
ifcopenshell.api.run("aggregate.assign_object", ifc, product=storey, relating_object=building)
|
||||
ifcopenshell.api.run("aggregate.assign_object", ifc, products=[storey], relating_object=building)
|
||||
assert subject.get_storey_height_in_si(storey, 1) is None
|
||||
|
||||
def test_returning_none_if_the_storey_height_is_undefined(self):
|
||||
@@ -124,7 +124,7 @@ class TestGetStoreyHeight(test.bim.bootstrap.NewFile):
|
||||
tool.Ifc.set(ifc)
|
||||
building = ifc.createIfcBuilding()
|
||||
storey = ifc.createIfcBuildingStorey()
|
||||
ifcopenshell.api.run("aggregate.assign_object", ifc, product=storey, relating_object=building)
|
||||
ifcopenshell.api.run("aggregate.assign_object", ifc, products=[storey], relating_object=building)
|
||||
assert subject.get_storey_height_in_si(storey, 1) is None
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user