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

New tool - close tabs #1173

Merged
merged 11 commits into from
Feb 28, 2021
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
tooltip: Close everything but the selected views.
title: >-
Close

Tabs
authors:
- thumDer
- Johannes Domeier
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""Close selected views."""
from pyrevit import forms, revit

doc = revit.doc
uidoc = revit.uidoc

uiviews = uidoc.GetOpenUIViews()
views = [doc.GetElement(uiview.ViewId) for uiview in uiviews]

list_items = [forms.ViewOption(view) for view in views]

views_to_keep = forms.SelectFromList.show(list_items,
multiselect=True,
title='Select views to keep open')

if not views_to_keep:
script.exit()

uiviews_to_close = filter(
lambda x: x.ViewId.IntegerValue not in \
[view.Id.IntegerValue for view in views_to_keep],
uiviews)

for uiview in uiviews_to_close:
uiview.Close()
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
layout:
- Pick
- Close Tabs
- Set Workset
- select
- mema
- memo
- memo