Deselecting objects after GetObject selection


#1

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.

Regards,
Taavi


(Luis Fraguada) #2

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


(Dale Fugier) #3

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


(Menno Deij - van Rijswijk) #4

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


#5

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