Skip to content

Commit

Permalink
Merge pull request #1943 from eirannejad/jmcouffin-links-worksets-exc…
Browse files Browse the repository at this point in the history
…eption

Exception for Workset links already existing
  • Loading branch information
jmcouffin committed Oct 17, 2023
2 parents 89e4333 + fa27983 commit 43a8669
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@
revit.doc.EnableWorksharing('Shared Levels and Grids',
'Workset1')
with revit.Transaction('Create Workset for linked model'):
newWs = DB.Workset.Create(revit.doc, linkedModelName)
worksetParam = \
el.Parameter[DB.BuiltInParameter.ELEM_PARTITION_PARAM]
worksetParam.Set(newWs.Id.IntegerValue)
try:
newWs = DB.Workset.Create(revit.doc, linkedModelName)
worksetParam = \
el.Parameter[DB.BuiltInParameter.ELEM_PARTITION_PARAM]
worksetParam.Set(newWs.Id.IntegerValue)
except Exception as e:
print('Workset: {} already exists\nError: {}'.format(linkedModelName,e))
else:
forms.alert('At least one linked element must be selected.')

0 comments on commit 43a8669

Please sign in to comment.