Revit reads all views of the current rvt and their names. revit reads the current rvt
1) read all views:
public static ViewSet GetAllViews(Document doc) { ViewSet views = new ViewSet(); FilteredElementCollector collector = new FilteredElementCollector(doc); FilteredElementIterator it = collector.OfClass(typeof(View)).GetElementIterator(); it.Reset(); while (it.MoveNext()) { View view = it.Current as View3D; if (null != view && !view.IsTemplate && view.CanBePrinted) { views.Insert(view); } else if (null == view) { View view2D = it.Current as View; if (view2D.ViewType == ViewType.FloorPlan | view2D.ViewType == ViewType.CeilingPlan | view2D.ViewType == ViewType.AreaPlan | view2D.ViewType == ViewType.Elevation | view2D.ViewType == ViewType.Section) { views.Insert(view2D); } } } return views; }
2) read view Name:
Public static string GetViewDisplayName (View view) {String name = view. viewName; // special treament to sheet name if (view. viewType = ViewType. drawingSheet) {ViewSheet sheet = view as ViewSheet; name = String. format ("{0}-{1}", sheet. sheetNumber, name);} if (view. viewType = ViewType. threeD) {if (name. contains ("{") & name. contains ("}") {int bracketStart = name. indexOf ("{"); int bracketEnd = name. indexOf ("}"); name = name. substring (bracketStart + 1, bracketEnd-bracketStart-1) ;}} else if (view. viewType = ViewType. floorPlan) {name = string. format ("floor plane: {0}", name);} else if (view. viewType = ViewType. ceilingPlan) {name = string. format ("ceiling plane: {0}", name);} else if (view. viewType = ViewType. areaPlan) {name = string. format ("area plane: {0}", name);} else if (view. viewType = ViewType. elevation) {name = string. format ("Building Facade: {0}", name);} else if (view. viewType = ViewType. section) {name = string. format ("Building Section: {0}", name) ;}return name ;}