system.assign_system - support batching #4474

This commit is contained in:
Andrej730
2024-04-11 15:54:06 +05:00
parent 3d243b5eee
commit 6b48e8b4b9
13 changed files with 119 additions and 48 deletions
@@ -22,11 +22,21 @@ import ifcopenshell.api
import ifcopenshell.util.system as subject
class TestIsAssignable(test.bootstrap.IFC4):
def test_run(self):
project = self.file.createIfcProject()
system = self.file.createIfcSystem()
pump = self.file.createIfcPump()
assert subject.is_assignable(pump, system)
assert not subject.is_assignable(project, system)
assert not subject.is_assignable(pump, project)
class TestGetSystemElements(test.bootstrap.IFC4):
def test_run(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcPump")
system = ifcopenshell.api.run("system.add_system", self.file, ifc_class="IfcSystem")
ifcopenshell.api.run("system.assign_system", self.file, product=element, system=system)
ifcopenshell.api.run("system.assign_system", self.file, products=[element], system=system)
assert subject.get_system_elements(system) == [element]
@@ -34,7 +44,7 @@ class TestGetElementSystems(test.bootstrap.IFC4):
def test_run(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcPump")
system = ifcopenshell.api.run("system.add_system", self.file, ifc_class="IfcSystem")
ifcopenshell.api.run("system.assign_system", self.file, product=element, system=system)
ifcopenshell.api.run("system.assign_system", self.file, products=[element], system=system)
assert subject.get_element_systems(element) == [system]
def test_do_not_get_non_services_groups(self):
@@ -42,7 +52,7 @@ class TestGetElementSystems(test.bootstrap.IFC4):
ifcopenshell.api.run(
"system.assign_system",
self.file,
product=element,
products=[element],
system=self.file.createIfcGroup(),
)
for not_assignable_system_class in ("IfcZone", "IfcStructuralAnalysisModel"):
@@ -50,7 +60,7 @@ class TestGetElementSystems(test.bootstrap.IFC4):
ifcopenshell.api.run(
"system.assign_system",
self.file,
product=element,
products=[element],
system=self.file.create_entity(not_assignable_system_class),
)
assert not subject.get_element_systems(element)