Skip to content

Commit

Permalink
refactoring and cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
eirannejad committed Jan 31, 2023
1 parent 218d9c6 commit 47fb2bf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@
from pyrevit import forms


filteredlist = []
viewlist = []
owned_by_me = []
views = []

selection = revit.get_selection()

if revit.doc.IsWorkshared:
viewlist.append(revit.active_view.Id)
views.append(revit.active_view.Id)
if isinstance(revit.active_view, DB.ViewSheet):
vportids = revit.active_view.GetAllViewports()
for vportid in vportids:
viewlist.append(revit.doc.GetElement(vportid).ViewId)
for view in viewlist:
curviewelements = DB.FilteredElementCollector(revit.doc)\
.OwnedByView(view)\
views.append(revit.doc.GetElement(vportid).ViewId)
for view in views:
curviewelements = DB.FilteredElementCollector(revit.doc, view)\
.WhereElementIsNotElementType()\
.ToElements()

Expand All @@ -27,9 +26,7 @@
el.Id)
# wti.Creator, wti.Owner, wti.LastChangedBy
if wti.LastChangedBy == HOST_APP.username:
filteredlist.append(el.Id)
selection.set_to(filteredlist)
else:
pass
owned_by_me.append(el.Id)
selection.set_to(owned_by_me)
else:
forms.alert('Model is not workshared.')
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@
from pyrevit import forms


filteredlist = []
viewlist = []
owned_by_me = []
views = []

selection = revit.get_selection()

if revit.doc.IsWorkshared:
currentviewid = revit.active_view.Id
viewlist.append(currentviewid)
views.append(currentviewid)
if isinstance(revit.active_view, DB.ViewSheet):
vportids = revit.active_view.GetAllViewports()
for vportid in vportids:
viewlist.append(revit.doc.GetElement(vportid).ViewId)
for view in viewlist:
curviewelements = DB.FilteredElementCollector(revit.doc)\
.OwnedByView(view)\
views.append(revit.doc.GetElement(vportid).ViewId)
for view in views:
curviewelements = DB.FilteredElementCollector(revit.doc, view)\
.WhereElementIsNotElementType()\
.ToElements()

Expand All @@ -28,9 +27,7 @@
el.Id)
# wti.Creator, wti.Owner, wti.LastChangedBy
if wti.Owner == HOST_APP.username:
filteredlist.append(el.Id)
selection.set_to(filteredlist)
else:
pass
owned_by_me.append(el.Id)
selection.set_to(owned_by_me)
else:
forms.alert('Model is not workshared.')

0 comments on commit 47fb2bf

Please sign in to comment.