Click or drag to resize

GetObjectGetMultiple Method

Call to select objects.

Namespace:  Rhino.Input.Custom
Assembly:  RhinoCommon (in RhinoCommon.dll)
Since: 5.0
Syntax
public GetResult GetMultiple(
	int minimumNumber,
	int maximumNumber
)

Parameters

minimumNumber
Type: SystemInt32
minimum number of objects to select.
maximumNumber
Type: SystemInt32
maximum number of objects to select. If 0, then the user must press enter to finish object selection. If -1, then object selection stops as soon as there are at least minimumNumber of object selected. If >0, then the picking stops when there are maximumNumber objects. If a window pick, crossing pick, or Sel* command attempts to add more than maximumNumber, then the attempt is ignored.

Return Value

Type: GetResult
GetResult.Object if one or more objects were selected. GetResult.Cancel if the user pressed ESCAPE to cancel the selection. See GetResults for other possible values that may be returned when options, numbers, etc., are acceptable responses.
Examples
using System;
using System.Collections.Generic;

partial class Examples
{
  public static Rhino.Commands.Result AddObjectsToGroup(Rhino.RhinoDoc doc)
  {
    Rhino.Input.Custom.GetObject go = new Rhino.Input.Custom.GetObject();
    go.SetCommandPrompt("Select objects to group");
    go.GroupSelect = true;
    go.GetMultiple(1, 0);
    if (go.CommandResult() != Rhino.Commands.Result.Success)
      return go.CommandResult();

    List<Guid> ids = new List<Guid>();
    for (int i = 0; i < go.ObjectCount; i++)
    {
      ids.Add(go.Object(i).ObjectId);
    }
    int index = doc.Groups.Add(ids);
    doc.Views.Redraw();
    if (index >= 0)
      return Rhino.Commands.Result.Success;
    return Rhino.Commands.Result.Failure;
  }
}
Python
import Rhino
import scriptcontext

def AddObjectsToGroup():
    go = Rhino.Input.Custom.GetObject()
    go.SetCommandPrompt("Select objects to group")
    go.GroupSelect = True
    go.GetMultiple(1, 0)
    if go.CommandResult()!=Rhino.Commands.Result.Success:
        return go.CommandResult()

    ids = [go.Object(i).ObjectId for i in range(go.ObjectCount)]
    index = scriptcontext.doc.Groups.Add(ids)
    scriptcontext.doc.Views.Redraw()
    if index>=0: return Rhino.Commands.Result.Success
    return Rhino.Commands.Result.Failure


if __name__ == "__main__":
    AddObjectsToGroup()
See Also