Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround Revit 2022 Removal of UnitType from Parameter Definition #1363

Merged
merged 6 commits into from
Oct 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions pyrevitlib/pyrevit/revit/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,15 @@ def __init__(self, param_def, param_binding=None, param_ext_def=False):
self.name = self.param_def.Name
# Revit <2017 does not have the Id parameter
self.param_id = getattr(self.param_def, 'Id', None)
self.unit_type = self.param_def.UnitType
self.param_type = self.param_def.ParameterType

#Revit >2021 does not have the UnitType property
if HOST_APP.is_older_than(2022):
self.unit_type = self.param_def.UnitType

#Revit >2022 does not have the ParameterType property
if HOST_APP.is_older_than(2023):
self.param_type = self.param_def.ParameterType

self.param_group = self.param_def.ParameterGroup

def __eq__(self, other):
Expand Down