I’m dipping my toes into RhinoCommon with Vb and there may be a sample already that shows this but I haven’t found it yet… I want to do an optional object pick where the user can select an object or hit Enter to continue without it. EDIT…I thought I had it figured out but it seems to “cancel” if I use Enter or ESC.
Something like this?
Dim SelectedObj As Rhino.DocObjects.ObjRef = Nothing
Dim Res As Rhino.Commands.Result = Rhino.Input.RhinoGet.GetOneObject("Select an object", True, DocObjects.ObjectType.AnyObject, SelectedObj)
If Res <> Rhino.Commands.Result.Success Then
'No object selected
End If
Selected object is in SelectedObj, If no objects selected it will get in the 'No object selected part 
Okay, but how do you distinguish between not selecting anything and cancelling?
Hi Jim,
Try the following:
Dim go As New Rhino.Input.Custom.GetObject()
go.SetCommandPrompt("Select object, or <Enter> to continue")
go.AcceptNothing(True)
Dim res As Rhino.Input.GetResult = go.Get()
Select Case (res)
Case Rhino.Input.GetResult.Object
Rhino.RhinoApp.WriteLine("Object selected")
Case Rhino.Input.GetResult.Nothing
Rhino.RhinoApp.WriteLine("Object selected")
Case Else
Return Result.Cancel
End Select
' TODO...
The ‘AcceptNothing’ line in Dale’s sample is the key. When this is set to true, then the enter key will give a result of Nothing instead of Cancel.
Cool, thanks!