Collecting Legends and Schedules not on Sheets

Hi guys,

I have been using the Bakery node “List Views not on Sheets” for a while but just realized some issues with it when comparing the data with BIMLink.
The node gets all views (except schedeuls) and then filters out the one whose “Sheet Number” parameter is equal to nothing. There are 2 problems with this method though:

  1. Schedules are ignored by the node
  2. Legends are picked up by the node, but because they don’t have the “Sheet Number” parameter, they all come up as views not on sheets.
    Is there a way to collect all legends and schedules that are not on sheets and therefore not being used so that they can be deleted?

Thanks in advance for the help!

Hi @monica.greco,

You can collect all views, all placed views and subtract all placed views to all views.
I also made a custom node (Collector.PlacedViews) to collect legends and schedules on sheets.

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
4 Likes

Hi @Alban_de_Chasteigner, thanks for the reply! Your node worked a treat :slight_smile: