Deselecting objects after GetObject selection

When the user selects an object in the model with the GetObject calls, this object seems to stay highlighted or selected (yellow in the UI) until another call to GetObject is made. Is it possible to disable this behaviour so that the ObjRef is returned but the object is deselected?

I am making a command where the user has to pick an object from a collection (to enter some information) and after that they can loop through all the others by just clicking enter. I’m handling displaying which object is selected through a DisplayConduit but the first object, that stays highlighted no matter what, messes this up.


Assuming you are using RhinoCommon, you should use ObjectTable.UnselectAll(). The API entry has an example as well. Let me know if that helps.

1 Like

Hi Taavi,

Proper, plug-in command should follow how Rhino selected and unselects objects. If objects were pre-selected, then they should remain selected with the command ends. And objects that are post-selected when a command begins should be unselected when the command ends.

In addition to the valid suggestion made by @fraguada, some other RhinoCommon functions that can help with this are GetObject.ObjectsWerePreselected and RhinoObject.Select.

– Dale

1 Like

When you use doc.Objects.Select(objRef, false), it will only de-select the object that was selected and not affect any other selections.

1 Like

Yes. The doc.Object.Select() command did exactly what I needed. Thanks!

I like to use doc.Objects.Select(objRef, false), can I access this function from “context” class?