Message 1 of 2
Collecting views from model
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am a little bit confused and was hoping someone could help me please.
I found the following code in the forum to collect all the views, and testing in on the "Arch Link Model" project that comes with revit 2023 (in samples folder).
var allViews = new FilteredElementCollector(doc).OfClass(typeof(View)).WhereElementIsNotElementType().ToElements();
var elementsToDelete = new List<Element>();
foreach (View view in allViews)
{ switch ( view.ViewType)
{case ViewType.FloorPlan:
case ViewType.CeilingPlan:
case ViewType.Elevation:
case ViewType.ThreeD:
case ViewType.DraftingView:
case ViewType.AreaPlan:
case ViewType.Section:
case ViewType.Detail:
case ViewType.Rendering:
case ViewType.Walkthrough:
elementsToDelete.Add(view);
break;
default:
case ViewType.Report:
case ViewType.ProjectBrowser:
case ViewType.SystemBrowser:
case ViewType.CostReport:
case ViewType.LoadsReport:
case ViewType.PresureLossReport:
case ViewType.SystemsAnalysisReport:
case ViewType.Internal:
break;
}
}
var totalViews = elementsToDelete.Count.ToString();
TaskDialog.Show("Revit", totalViews);
I have created a schedule and the total number of views i get from the script is different to the schedule