Switching GetPoint and GetObject

Hello !

I would like to know if it is possible to switch between GetPoint and GetObject when executing a command.

For example : I have a command for draw a box. I would like run the command then pick a point or press special key for selecting a vertex corner.

Thank you,

How can I stop a GetObject running with C # ?

Someone can help me ?

I have test this solution : How to "Escape" a running Command (i.e. BooleanUnion) but this has no effect on my system (Win10, Rh 6).

Another example, Grasshopper can do this with a point parameter:
GHGetPoint2

it is possible to pick or select a point by modifying an option command line:
GHGetPoint1

How make that with Rhinocommon ?

Hi @kitjmv,

This particular prompt is generated using a GetOption object.

Something like this should do it:

var pointType = PointType.Point;

var gt = new GetOption();
gt.SetCommandPrompt("Grasshopper Point type");
gt.SetDefaultString(nameof(pointType));
gt.AcceptNothing(true);
var opt0 = gt.AddOption(nameof(PointType.Coordinate));
var opt1 = gt.AddOption(nameof(PointType.Point));
var opt2 = gt.AddOption(nameof(PointType.Curve));
var res = gt.Get();
if (res == GetResult.Option)
{
  if (gt.Option().Index == opt0)
    pointType = PointType.Coordinate;
  else if (gt.Option().Index == opt1)
    pointType = PointType.Point;
  else if (gt.Option().Index == opt2)
    pointType = PointType.Curve;
}

– Dale

Hello Dale,

I’m sorry, my question may not be clear.

How to stop the command running with C# ?

Thnak you.
jmv

Hi @kitjmv,

There is no programmatic way to stop a running Rhino command. About the best you can do, in the case you describe, is to send a “!” character to Rhino using RhinoApp.SendKeystrokes, just like you’d do if you were writing a button macro.

– Dale