Add system assignment check

@aothms Is there a way to check against IFC formal propositions ?
Example for [IfcZone](http://ifc43-docs.standards.buildingsmart.org/IFC/RELEASE/IFC4x3/HTML/lexical/IfcZone.htm#5.4.3.82.4-Formal-propositions)
@Moult Should I move is_assignable to an util ?
This commit is contained in:
CyrilWaechter
2022-11-25 18:52:58 +01:00
parent 88093728a7
commit f0b1935861
2 changed files with 45 additions and 4 deletions
@@ -39,11 +39,20 @@ class TestGetElementSystems(test.bootstrap.IFC4):
def test_do_not_get_non_services_groups(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcPump")
ifcopenshell.api.run("system.assign_system", self.file, product=element, system=self.file.createIfcGroup())
ifcopenshell.api.run("system.assign_system", self.file, product=element, system=self.file.createIfcZone())
ifcopenshell.api.run(
"system.assign_system", self.file, product=element, system=self.file.createIfcStructuralAnalysisModel()
"system.assign_system",
self.file,
product=element,
system=self.file.createIfcGroup(),
)
for not_assignable_system_class in ("IfcZone", "IfcStructuralAnalysisModel"):
with pytest.raises(TypeError):
ifcopenshell.api.run(
"system.assign_system",
self.file,
product=element,
system=self.file.create_entity(not_assignable_system_class),
)
assert not subject.get_element_systems(element)