Simulating drag



Hi All!
In the context of testing our plugin I would like to simulate dragging a grip point. Is that possible? With the GetPoint we can easily input the point in the command prompt. Is there something similar to that?

Thanks a lot!

(Dale Fugier) #2

Hi @Alberto,

If you are using the Rhino WIP, you can do something like this:

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
  var go = new GetObject();
  go.SetCommandPrompt("Select grips to move");
  go.GeometryFilter = ObjectType.Grip;
  go.GetMultiple(1, 0);
  if (go.CommandResult() != Result.Success)
    return go.CommandResult();

  using (var object_list = new TransformObjectList())
    object_list.AddObjects(go, true);

    var dir = new Vector3d(5, 0, 0);
    var xform = Transform.Translation(dir);

    foreach (var grip in object_list.GripArray())

    foreach (var owner in object_list.GripOwnerArray())
      doc.Objects.GripUpdate(owner, true);

  return Result.Success;

I don’t know if this works in Rhino 5.

– Dale