mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 10:57:49 +00:00
Add IfcTester support and test cases for bounded, table, and reference props
This commit is contained in:
@@ -341,6 +341,29 @@ def get_property_unit(prop, ifc_file):
|
||||
measure_class = prop.EnumerationValues[0].is_a()
|
||||
elif prop.is_a("IfcPropertyListValue") and prop.ListValues:
|
||||
measure_class = prop.ListValues[0].is_a()
|
||||
elif prop.is_a("IfcPropertyBoundedValue"):
|
||||
if prop.UpperBoundValue:
|
||||
measure_class = prop.UpperBoundValue.is_a()
|
||||
elif prop.LowerBoundValue:
|
||||
measure_class = prop.LowerBoundValue.is_a()
|
||||
elif prop.SetPointValue:
|
||||
measure_class = prop.SetPointValue.is_a()
|
||||
elif prop.is_a("IfcPropertyTableValue"):
|
||||
table_units = {}
|
||||
for attribute in ["Defining", "Defined"]:
|
||||
if getattr(prop, f"{attribute}Unit"):
|
||||
table_units[f"{attribute}Unit"] = getattr(prop, f"{attribute}Unit")
|
||||
elif getattr(prop, f"{attribute}Values"):
|
||||
measure_class = getattr(prop, f"{attribute}Values")[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:
|
||||
table_units[f"{attribute}Unit"] = units[0]
|
||||
else:
|
||||
table_units[f"{attribute}Unit"] = None
|
||||
else:
|
||||
table_units[f"{attribute}Unit"] = None
|
||||
return table_units
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user