mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Minor fix.
This commit is contained in:
@@ -81,6 +81,8 @@ def get_type(element):
|
||||
def get_types(type):
|
||||
for rel in getattr(type, "Types", []):
|
||||
return rel.RelatedObjects
|
||||
for rel in getattr(type, "ObjectTypeOf", []):
|
||||
return rel.RelatedObjects
|
||||
return []
|
||||
|
||||
|
||||
|
||||
@@ -144,6 +144,14 @@ class TestGetTypes(test.bootstrap.IFC4):
|
||||
assert subject.get_types(element_type) == (element,)
|
||||
|
||||
|
||||
class TestGetTypesIFC2X3(test.bootstrap.IFC2X3):
|
||||
def test_getting_the_type_of_a_product(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)
|
||||
assert subject.get_types(element_type) == (element,)
|
||||
|
||||
|
||||
class TestGetMaterial(test.bootstrap.IFC4):
|
||||
def test_getting_the_material_of_a_product(self):
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
|
||||
Reference in New Issue
Block a user