Support type-based class checking for converting IFC2X3 models to Brickschema

This commit is contained in:
Dion Moult
2022-01-12 15:39:43 +11:00
parent 92642e6a6a
commit 39960998de
4 changed files with 28 additions and 19 deletions
@@ -1,5 +1,6 @@
import pytest
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.util.brick as subject
@@ -9,10 +10,20 @@ class TestGetBrickTypeIFC4(test.bootstrap.IFC4):
assert subject.get_brick_type(element) == "https://brickschema.org/schema/Brick#TerminalUnit"
element.PredefinedType = "CONSTANTFLOW"
assert subject.get_brick_type(element) == "https://brickschema.org/schema/Brick#CAV"
element = self.file.createIfcEngine()
assert subject.get_brick_type(element) == "https://brickschema.org/schema/Brick#Equipment"
class TestGetBrickTypeIFC2X3(test.bootstrap.IFC2X3):
def test_run(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcFlowController")
type_element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcAirTerminalBoxType")
ifcopenshell.api.run("type.assign_type", self.file, related_object=element, relating_type=type_element)
assert subject.get_brick_type(element) == "https://brickschema.org/schema/Brick#TerminalUnit"
class TestGetBrickElementsIFC4(test.bootstrap.IFC4):
def test_run(self):
element = self.file.createIfcAirTerminalBox()
self.file.createIfcWall()
assert subject.get_brick_elements(self.file) == [element]
assert subject.get_brick_elements(self.file) == {element}