mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 14:02:27 +00:00
fix displaying undefined or userdefined units in cost schedules
This commit is contained in:
@@ -158,8 +158,10 @@ class CostSchedulesData:
|
|||||||
unit = ifcopenshell.util.unit.get_property_unit(quantity, tool.Ifc.get())
|
unit = ifcopenshell.util.unit.get_property_unit(quantity, tool.Ifc.get())
|
||||||
if unit:
|
if unit:
|
||||||
data["UnitSymbol"] = ifcopenshell.util.unit.get_unit_symbol(unit)
|
data["UnitSymbol"] = ifcopenshell.util.unit.get_unit_symbol(unit)
|
||||||
else:
|
if quantity.is_a("IfcPhysicalSimpleQuantity"):
|
||||||
data["UnitSymbol"] = "U"
|
measure_class = quantity.wrapped_data.declaration().as_entity().attribute_by_index(3).type_of_attribute().declared_type().name()
|
||||||
|
if "Count" in measure_class:
|
||||||
|
data["UnitSymbol"] = "U"
|
||||||
|
|
||||||
# same_unit_nested_cost_item = set()
|
# same_unit_nested_cost_item = set()
|
||||||
# data["DerivedTotalCostQuantity"] = None
|
# data["DerivedTotalCostQuantity"] = None
|
||||||
|
|||||||
@@ -464,6 +464,8 @@ def get_unit_symbol(unit):
|
|||||||
if unit.is_a("IfcSIUnit"):
|
if unit.is_a("IfcSIUnit"):
|
||||||
symbol += prefix_symbols.get(unit.Prefix, "")
|
symbol += prefix_symbols.get(unit.Prefix, "")
|
||||||
symbol += unit_symbols.get(unit.Name.replace("METER", "METRE"), "?")
|
symbol += unit_symbols.get(unit.Name.replace("METER", "METRE"), "?")
|
||||||
|
if unit.is_a("IfcContextDependentUnit") and unit.UnitType == "USERDEFINED":
|
||||||
|
symbol = unit.Name
|
||||||
return symbol
|
return symbol
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user