Implement typeof() on simple types

This commit is contained in:
Thomas Krijnen
2023-01-11 12:47:40 +01:00
parent 4a71ab9631
commit 2336f299f7
@@ -658,7 +658,14 @@ def typeof(inst):
decl = ifcopenshell.ifcopenshell_wrapper.schema_by_name(schema_name).declaration_by_name(inst.is_a()) decl = ifcopenshell.ifcopenshell_wrapper.schema_by_name(schema_name).declaration_by_name(inst.is_a())
while decl: while decl:
yield '.'.join((schema_name, decl.name().lower())) yield '.'.join((schema_name, decl.name().lower()))
decl = decl.supertype() if isinstance(decl, ifcopenshell.ifcopenshell_wrapper.entity):
decl = decl.supertype()
else:
decl = decl.declared_type()
while isinstance(decl, ifcopenshell.ifcopenshell_wrapper.named_type):
decl = decl.declared_type()
if not isinstance(decl, ifcopenshell.ifcopenshell_wrapper.type_declaration):
break
return express_set(inner()) return express_set(inner())
""", file=output, sep='\n') """, file=output, sep='\n')