I have this code to get all sheets that are currently opened as windows in the project.
def OpenSheets():
outlist = []
uiviews = uidoc.GetOpenUIViews()
for uiview in uiviews:
view = doc.GetElement(uiview.ViewId)
if view.Category.Name == "Sheets" and view.Name != "None":
outlist.append(view)
sorted_elements = sorted(outlist, key=lambda x: x.SheetNumber)
return sorted_elements
My problem is that i can not get the sheet if a view on this sheet is active. Because uidoc.GetOpenUIViews() will then retrieve the active view and not the sheet.
As far as i know it is not possible to deactivate a view with the Revit API.
Is there any other workaround i can use to get my desired sheet, even if a view is active?
you may have to check it differently.
AFAIK you don’t have a build in method for that.
But what works is that the tab is not changing name when a view is activated in a sheet:
I have sheet 001 opened
I activate a view
the title in the tab remains the same -Sheet title