mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
system.assign_system - support batching #4474
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user