Hello everyone!
I am trying to select elements visible in certain Plan using FilteredElementCollector constructed with :
public FilteredElementCollector( Document document, ElementId viewId )
this work like a charm, but only in situation where plan does not represent one of many levels. In that situation, it also collects elements form plans of levels lying underneath level of filtered ViewPlan. Same situation happens in Revit application - when in select element and change active view to plan of level above it is still underlight and active. Does anyone have an idea how to simply improve approach with using FilteredElementCollector to collect elements that are visible only in selected plan ?
Many Thanks,
Paweł
Hello,
The method you use collect all the elements that are visible in the selected plan. So you need to filter elements using a filter passing the plan level as variable. Something like this:
Element my_view = document.GetElement(view_id); FilteredElementCollector elements = new FilteredElementCollector(document, view_id); //take elements from the view level List<Element> my_level_elements = elements.toelements().where(e=>e.levelId == my_view.levelId).ToList();
It would work.
I haven't tested the code.
Regards,
Luca