List unused views and export to a sheet

listfilter

#1

Hi guys,

maybe it’s a common topic, but from my searches on the forum and my effort, I have some issue creating this definition. Maybe it`s something in the Revit logic I didn’t get…

I’m trying to create a definition to list all the unused views in a project (for auditing reason) and export the list to excel file. The list should have the parameter target value, the view template the view is currently using, and the ID view (so you can look for it back in the project…) Here is my last attempt:!

as you can see seems like working, but in the list (the one highlighted in orange) appear some views that, in my opinion, are actually been used in the project, so my question is: how would you set logically the search for unused views? (note: some of the view are dependent, so technically the independent view should be marked as “used” anyway)

Another question: I feel like the definition could be simpler… there some logic in the filtering I’m maybe overusing, can you give me an hint on that?

Thank you!select unused views.dyn (20.4 KB)


#2

Hi @carmine.lb,

The definition can definitely be simpler.
I let you add the view templates and parameters to your definition.

The python script :

#From Springs
#From ReAnimation

import clr

clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *

def tolist(obj1):
	if hasattr(obj1,"__iter__"): return obj1
	else: return [obj1]
	
sheet_views = []
onSheets, allScheds = [], []

sheets = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Sheets).ToElements()

schedSheets = FilteredElementCollector(doc).OfClass(ScheduleSheetInstance).ToElements()

# Code
for s in schedSheets:
	onSheets.append(s.ScheduleId)

newList = list(set(onSheets))

for n in newList:
	sched = doc.GetElement(n)
	allScheds.append(sched)

for i in xrange(len(sheets) ):
	viewsid = sheets[i].GetAllPlacedViews()
	views = [doc.GetElement(v).ToDSType(True) for v in viewsid]
	sheet_views.append(views)
	s_id = sheets[i].Id.IntegerValue
OUT = sheet_views, allScheds

#3

Thank you! I wasn’t aware of the Bakery definition, helps you solve many iterations…
But if I didn’t have the packages, is this the smartest logic definition to achieve?

Regarding the script and the logic behind it, how can you make Dynamo selects the unused views? Does it exclude the Independent views? What’s the definition of “unused views” ?


#4

Have you considered using the view list schedule function built into Revit? If it’s not a walkthrough or legend and has no sheet number value it’s not on a sheet.