GetObject only one with enter prompt

Hello everyone,

I’m developing rhinocommon with c# WPF

I have a question about selecting object.

My scenario was below.

In my WPF, I added one button in xaml.

When user click button, user can select one mesh object.
And If user want to change selected object, then click button again.
Then, selected Object is highlighted, and user can select other object.
At that time, only one object is highlighted and When user press enter, last highlighted object is selected.

For that scenario, I make a function, but It is not worked like my purpose.
Because when I call Get(), EnablePressEnterWhenDonePrompt is not working

Is there any possible way to get one object with press enter?

public Guid? GetObjectId(Guid? selectedID)
            using (GetObject go = new GetObject { GeometryFilter = ObjectType.Mesh})
                if (selectedID.HasValue)
                    go.EnablePreSelect(false, true);
                    go.AlreadySelectedObjectSelect = true;
                    go.DeselectAllBeforePostSelect = false;
                return result == GetResult.Cancel ? selectedID : go.Object(0).ObjectId;

Best regards,


The above causes Rhino to pause for the selection of an object. Thus, most of the calls to other GetObject properties and methods won’t do anything in your code.

Here is a simple method that select a single mesh and leave other selected objects selected:

public Guid GetObjectId()
  var rc = Guid.Empty;
  var go = new GetObject();
  go.SetCommandPrompt("Select mesh");
  go.GeometryFilter = ObjectType.Mesh;
  go.EnablePreSelect(false, true);
  go.DeselectAllBeforePostSelect = false;
  if (go.CommandResult() == Result.Success)
    var rh_obj = go.Object(0).Object();
    if (null != rh_obj)
      rh_obj.Select(true); // leave selected
      rc = rh_obj.Id;
  return rc;
-- Dale