- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am trying to get a list of all elements that are not selected, so that I can hide them in a view, however I am running into a problem with elements that are part of assemblies. I am currently getting a list of all elements inside a view, and excluding those elements which are selected with this:
ICollection<ElementId> selection = data.Application.ActiveUIDocument.Selection.GetElementIds();
ICollection<ElementId> toHide = new List<ElementId>();
FilteredElementCollector collector
= new FilteredElementCollector(doc, view.Id)
.WhereElementIsNotElementType()
.Excluding(selection);I am then hiding each element in toHide, however the .Selection does not contain elements which are part of a selected assembly, so even if an assembly is selected, the elements inside it get hidden.
I am wondering if there is any way to get either a list of selected assemblies and the elements inside them, or even just a list of all elements which are part of assemblies. If there is no way of knowing that an element is part of a assembly which is selected, then I would be fine excluding all elements which are part of an assembly. In this case, how could I check to see that an element is part of an assembly?
Any help would be great, thanks.
Solved! Go to Solution.
