Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How To Clear Selection In Revit 2015 With API

5 REPLIES 5
Reply
Message 1 of 6
liujietom
2505 Views, 5 Replies

How To Clear Selection In Revit 2015 With API

In Previous, Use uiDocument.Selection.Elements.Clear(), but in Revit 2015, It's Obsolete, How to Clear Selection

5 REPLIES 5
Message 2 of 6
PhillipM
in reply to: liujietom

I'm also having this issue from within an iDropHandler.

 

I'm using  "document.Selection.GetElementIds.Clear()" but it is still returning previously selected elements even though they are defiantly unselected in the Revit UI.

 

Any Ideas?

Message 3 of 6
tatepoon
in reply to: liujietom

 You can try the following code.

 

uiDocument.Selection.SetElementIds(new List<ElementId>());
Message 4 of 6
PhillipM
in reply to: tatepoon

Thanks for the hint.

 

I have tried that and it still not working correctly.

 

Please see below video that explains my issue.  It is as though there is a bug in the IDrop event 😞

 

https://dl.dropboxusercontent.com/u/7827802/iDropSSIssue.wmv

 

Any help is much apreciated.

 

Regards

 

Phillip Miller

Message 5 of 6
liujietom
in reply to: tatepoon

Thanks, it' all right.

Message 6 of 6
bxw
Enthusiast
in reply to: liujietom

There is probably a shorter way but this works:

 

                    ElementId invalid = ElementId.InvalidElementId;
                    List<ElementId> invalidList = new List<ElementId>();
                    invalidList.Add(invalid);
                    uidoc.Selection.SetElementIds(invalidList);

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community