Message 1 of 9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
It seems that this new filter added in 2021 only works if the view was already opened/regenerated. Was that the intended behavior? I see no mention of this in the help file. Below is a macro to test. Set the name in viewToTest and first run on a view that has not been opened yet. Then open the view and run again.
public void TestVisibleInViewFilter()
{
Document doc = this.ActiveUIDocument.Document;
string viewToTest = "1ST FLOOR";
ElementId viewToTestId = new FilteredElementCollector(doc).OfClass(typeof(View)).WhereElementIsNotElementType().Cast<View>().
Where(q => !q.IsTemplate && q.Name == viewToTest).First().Id;
var vivFilter = new VisibleInViewFilter(doc, viewToTestId);
var elementsInView = new FilteredElementCollector(doc).WherePasses(vivFilter).ToElementIds();
TaskDialog.Show("Info", elementsInView.Count + " ids found");
}
It seems that this would hardly be useful then. Thanks.
Solved! Go to Solution.