Get views from viewset?

Hi all,

I am trying to get all the Views in a ViewSet, but I am getting an error saying “the managed object is not valid”. I’m not sure where I am going wrong as I have written it in C# the same way and no problems. Is this a Python thing? In C# I need to cast as view although in Python this doesn’t work and no matter what I do it won’t give me access to the View properties.

I’m relatively new to Python, so still rough around the edges when it comes to syntax, but any help would be appreciated as I’m a little stumped. :slight_smile:


Try to use .append instead of .Add. It would be better if you pasted the code here. You can format it with the </> button.


Legend! Works a treat @Kulkul. Thanks for the very quick responses also!


Could you please share the code you used for your GetViewSets node?

Thanks in advance!

What’s wrong with what is already shared?


What i’m interested in is the code behind the “View Sheet Sets” node which is shown in the picture originally posted by Daniel_Woodcook. The node outputs the ViewSheetSet objects and their names.

It would be fair to start a related discussion and to show what you tried. You can link it to this topic like so:
Thanks :slight_smile:

Sorry to keep old topics alive and ask simple questions.

Should the code that @Kulkul posted be incorporated into @Daniel_Woodcock1 original post, or is it supposed to function on it’s own? If it needs to be incorporated into the original, where at?

Hi @manderson557

Could you please start new topic with your goals and workflows images if you have any? This thread has already solution.

sorry I tried it but something is not right, I get a warning

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 30, in
NameError: name ‘vs’ is not defined

import clr

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc= DocumentManager.Instance.CurrentDBDocument
app = DocumentManager.Instance.CurrentUIApplication.Application

import Revit

import Autodesk
from Autodesk.Revit.DB import *

viewSet = UnwrapElement(IN[0])

viewSets = FilteredElementCollector(doc).OfClass(ViewSheetSet)

for i in viewSets:
if i.Name == viewSet.Name:
vs = i

OUT = [i.ToDSType(True) for i in vs.Views]