Support userdefined process types in util module

This commit is contained in:
Dion Moult
2022-05-31 16:23:13 +10:00
parent 0dfe1d995f
commit 4c4846bc8f
2 changed files with 10 additions and 2 deletions
@@ -174,7 +174,7 @@ class TestGetPredefinedTypeIFC4(test.bootstrap.IFC4):
element_type.PredefinedType = "PARTITIONING"
assert subject.get_predefined_type(element) == "PARTITIONING"
def test_getting_an_inherited_userdefined_type(self):
def test_getting_an_inherited_userdefined_type_for_an_element_type(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
element_type = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWallType")
ifcopenshell.api.run("type.assign_type", self.file, related_object=element, relating_type=element_type)
@@ -190,6 +190,14 @@ class TestGetPredefinedTypeIFC4(test.bootstrap.IFC4):
element.PredefinedType = "PARTITIONING"
assert subject.get_predefined_type(element) == "PARTITIONING"
def test_getting_an_inherited_userdefined_type_for_a_process_type(self):
element = ifcopenshell.api.run("sequence.add_task", self.file)
element_type = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcTaskType")
ifcopenshell.api.run("type.assign_type", self.file, related_object=element, relating_type=element_type)
element_type.PredefinedType = "USERDEFINED"
element_type.ProcessType = "FOOBAR"
assert subject.get_predefined_type(element) == "FOOBAR"
class TestGetTypeIFC4(test.bootstrap.IFC4):
def test_getting_the_type_of_a_product(self):