Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Retrieving all 3D Views ...

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
1170 Views, 2 Replies

Retrieving all 3D Views ...

Hello, I know it is relatively trivial to get the active view via something like "MainCommandData.Application.ActiveUIDocument.ActiveView" but how would you go about getting a collection of all of the views in a document which you could then sift through via a loop? Thank you for your time.
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

FilteredElementCollectors are your friends.

 

For all views:

 

Document doc;

List<View> views = new FilteredElementCollector(doc).OfClass(typeof(View)).Cast<View>().ToList();

 

For all 3D views:

 

Document doc;

List<View3D> all3DViews = new FilteredElementCollector(doc).OfClass(typeof(View3D)).Cast<View3D>().ToList();

 

Message 3 of 3
Anonymous
in reply to: Anonymous

but after this how should i use this code to enlist or access the different views for drop-down control?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community