1717
1818
1919def is_calculable_param (param ):
20- if HOST_APP .is_newer_than (2022 ) and not param .Definition .GetDataType ().TypeId :
20+ if HOST_APP .is_newer_than (2021 ) and not param .Definition .GetDataType ().TypeId :
2121 return False
2222
2323 if param .StorageType == DB .StorageType .Double :
@@ -32,14 +32,14 @@ def is_calculable_param(param):
3232
3333
3434def get_definition_type (definition ):
35- if HOST_APP .is_newer_than (2022 ):
35+ if HOST_APP .is_newer_than (2021 ):
3636 return definition .GetDataType ()
3737 else :
3838 return definition .ParameterType
3939
4040
4141def get_definition_spec (definition ):
42- if HOST_APP .is_newer_than (2022 ):
42+ if HOST_APP .is_newer_than (2021 ):
4343 return DB .LabelUtils .GetLabelForSpec (definition .GetDataType ())
4444 else :
4545 return definition .ParameterType
@@ -76,12 +76,12 @@ def _add_total(total, param):
7676
7777def format_value (total , unit_type ):
7878 format_options = revit .doc .GetUnits ().GetFormatOptions (unit_type )
79- try :
80- units = format_options .DisplayUnits
81- label = DB .LabelUtils .GetLabelFor (units )
82- except AttributeError :
79+ if HOST_APP .is_newer_than (2021 ):
8380 units = format_options .GetUnitTypeId ()
8481 label = DB .LabelUtils .GetLabelForUnit (units )
82+ else :
83+ units = format_options .DisplayUnits
84+ label = DB .LabelUtils .GetLabelFor (units )
8585 return "{} {}" .format (DB .UnitUtils .ConvertFromInternalUnits (total , units ), label )
8686
8787
0 commit comments