Rhino Input Issue

ObjRef singleRef;
if (Result.Success != RhinoGet.GetOneObject("Select one", false, ObjectType.Curve, out singleRef))
{
    return Result.Failure;
}
ObjRef[] multRefs;
if (Result.Success != RhinoGet.GetMultipleObjects("Select multiple", false, ObjectType.Curve, out multRefs))
{
    return Result.Failure;
}

When I run the command above, it goes through the GetOneObject selection fine and then skips the GetMultipleObjects prompt.

Hi @jakemurphy0118,

If you are going to select more than one set of objects in a command, then you don’t want to use the easy object getters. This is because they always accept pre-selected objects.

In your code, the selection made by RhinoGet.GetOneObject is pre-selecting the curve for RhinoGet.GetMultipleObjects. Since RhinoGet.GetMultipleObjects finds a pre-selected curve, it doesn’t pause for additional selections. Hope this makes sense.

This is a better approach.

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
  var rc = RhinoGet.GetOneObject("Select one curve", false, ObjectType.Curve, out var singleRef);
  if (rc != Result.Success)
    return Result.Failure;

  var go = new GetObject();
  go.SetCommandPrompt("Select multiple curves");
  go.GeometryFilter = ObjectType.Curve;
  go.SubObjectSelect = false;
  go.EnablePreSelect(false, true);
  go.DeselectAllBeforePostSelect = false;
  go.GetMultiple(1, 0);
  if (go.CommandResult() != Result.Success)
    return go.CommandResult();

  var multRefs = go.Objects();

  // TODO...

  return Result.Success;
}

– Dale

Makes sense, thanks!