IfcTester now supports list and enumerated properties

This commit is contained in:
Dion Moult
2022-09-12 21:34:06 +10:00
parent 73ac5d314b
commit c7c59d9496
4 changed files with 76 additions and 11 deletions
@@ -95,9 +95,9 @@ def get_properties(properties):
if prop.is_a("IfcPropertySingleValue"):
results[prop.Name] = prop.NominalValue.wrappedValue if prop.NominalValue else None
elif prop.is_a("IfcPropertyEnumeratedValue"):
values = [v.wrappedValue for v in prop.EnumerationValues]
results[prop.Name] = [v.wrappedValue for v in prop.EnumerationValues] or None
elif prop.is_a("IfcPropertyListValue"):
results[prop.Name] = [v.wrappedValue for v in prop.ListValues] or None
elif prop.is_a("IfcComplexProperty"):
data = {k: v for k, v in prop.get_info().items() if v is not None and k != "Name"}
data["properties"] = get_properties(prop.HasProperties)
@@ -337,6 +337,10 @@ def get_property_unit(prop, ifc_file):
measure_class = entity.attribute_by_index(3).type_of_attribute().declared_type().name()
elif prop.is_a("IfcPropertySingleValue") and prop.NominalValue:
measure_class = prop.NominalValue.is_a()
elif prop.is_a("IfcPropertyEnumeratedValue") and prop.EnumerationValues:
measure_class = prop.EnumerationValues[0].is_a()
elif prop.is_a("IfcPropertyListValue") and prop.ListValues:
measure_class = prop.ListValues[0].is_a()
unit_type = get_measure_unit_type(measure_class)
units = [u for u in unit_assignment.Units if getattr(u, "UnitType", None) == unit_type]
if units: