Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
eirannejad committed Sep 6, 2022
1 parent 4700dcc commit 51e33ac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -336,17 +336,18 @@ def read_csv_typed_data(csv_file):
parts = field_def.split("|")
parts_count = len(parts)
# added support for Revit 2022+ parameter types
if HOST_APP.is_newer_than(2021):
if HOST_APP.is_newer_than(2022, or_equal=True):
if parts_count == 1:
if parts[0]:
field_defs.append((parts[0], DB.SpecTypeId.String))
elif parts_count == 2:
field_defs.append(
(
parts[0],
coreutils.get_enum_value(DB.SpecTypeId, parts[1]),
if hasattr(DB.SpecTypeId, parts[1]):
field_defs.append(
(
parts[0],
getattr(DB.SpecTypeId, parts[1]),
)
)
)
else:
if parts_count == 1:
if parts[0]:
Expand Down
10 changes: 5 additions & 5 deletions pyrevitlib/pyrevit/revit/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,13 @@ def __init__(self, param_def, param_binding=None, param_ext_def=False):
# Revit <2017 does not have the Id parameter
self.param_id = getattr(self.param_def, 'Id', None)


if HOST_APP.is_newer_than(2021, or_equal=True) and not(HOST_APP.is_newer_than(2022, or_equal=True)):
# Revit >2021 does not have the UnitType property
self.unit_type = self.param_def.GetSpecTypeId()
elif HOST_APP.is_newer_than(2022, or_equal=True):

if HOST_APP.is_newer_than(2022, or_equal=True):
# GetSpecTypeId() Removed in Revit 2022
self.unit_type = self.param_def.GetDataType()
elif HOST_APP.is_exactly(2021):
# Revit >2021 does not have the UnitType property
self.unit_type = self.param_def.GetSpecTypeId()
else:
self.unit_type = self.param_def.UnitType

Expand Down

0 comments on commit 51e33ac

Please sign in to comment.