How to hide other elements when highlighting an element?

Anonymous

How to hide other elements when highlighting an element?

Anonymous
Not applicable

Hi, everyone! When I highlight an element, I want to hide other elements, how can I do this after I enter these codes?

ICollection<ElementId> ids = new List<ElementId>();
ids.Add(elem.Id);
UIDocument uiDoc = new UIDocument(elem.Document);
uiDoc.Selection.SetElementIds(ids);
uiDoc.ShowElements(ids);

Thank you in advance:)

0 Likes
Reply
299 Views
2 Replies
Replies (2)

RPTHOMAS108
Mentor
Mentor

Best way is probably to use temporary view mode with element isolation (cyan border which is activated in the UI with the glasses button).

 

In the API it is set on the view as below:

 

View.IsolateElementsTemporary(IDs as ICollection(Of ElementID))

 

To disable mode you use:

 

View.DisableTemporaryViewMode(TemporaryViewMode.TemporaryHideIsolate)

 

To make the visibility settings permanent you use:

 

View.ConvertTemporaryHideIsolateToPermanent

 

 

 

Anonymous
Not applicable

Thank you! 🙂

0 Likes