2

I am kinda new to Revit both the software and the programming. I think the whole API and proprieties are real non-instinctive mazes. I searched for quite a time, I found out how to get the current view or how to add a view, but I am unable to get the list of all the views in a project.

Anybody could point me out which API are needed?

Wildhorn
  • 926
  • 1
  • 11
  • 30

2 Answers2

4

I've been able to do this for Revit 2012 using the FilteredElementCollector. Here's what I have working based on this example (http://thebuildingcoder.typepad.com/blog/2010/04/filter-for-views-and-istemplate-predicate.html):

UIApplication application = commandData.Application;
Document document = application.ActiveUIDocument.Document;

FilteredElementCollector viewCollector = new FilteredElementCollector(document);
viewCollector.OfClass(typeof(View));

foreach (Element viewElement in viewCollector)
{
  View view = (View)viewElement;
  //Do something...
}
skeletank
  • 2,880
  • 5
  • 43
  • 75
1

Well, it seems it is not implemented yet. I found some kind of hack-way to do it (via print sheet), but it consume a lot of paper. Will have to wait for Revit 2012 :/

Wildhorn
  • 926
  • 1
  • 11
  • 30