Get All Viewport types -node not working

Hi @verdi

This should work for you:

import clr
# Import RevitAPI
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

# Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager

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

doc = DocumentManager.Instance.CurrentDBDocument


collection = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Viewports).WhereElementIsNotElementType().ToElements()

vptypes = []
for e in collection:
	if e.Category != None:
		vptypes.append(e.ToDSType(True))

OUT = vptypes

You could also use OOTB nodes:

1 Like