If something is selected get name else do something


Let me explain my problem like this. I got a left and a right part. The object names are Left and Right.
I want to check if any of these are selected.

If left is selected do this
If right is selected do that
If nothing is selected ask which one should be selected (gonna do this with a dialog)

But the problem is if i use this:

Dim obref As Rhino.DocObjects.ObjRef = Nothing
Dim rc As Rhino.Commands.Result = Rhino.Input.RhinoGet.GetOneObject(“Select object”, True, Rhino.DocObjects.ObjectType.AnyObject, obref)
If rc <> Rhino.Commands.Result.Success Then
Return rc
End If

It will always ask if I want to select something and I want to work around that.
If nothing selected then ask which one too select else use the selected one.

Have tried to get an object name if something is selected with:

Dim myRhObj As Rhino.DocObjects.RhinoObject = doc.Objects.GetSelectedObjects(False, False)
Dim myObjName = myRhObj.Name

and then wanted to use this in an If statement but can’t even get this part working.
Can someone help me?


Is this what you are looking for?


This is exactly what I’m looking for!
Thanks again :smile:
By setting go.EnablePostSelect(False) the user can’t select anything and only preselected objects will count right?