Command Prompt

I would like to implement “Copy=Yes or No” at the command prompt, is there a reference source code?

Like this?

Sash

Hi Artstep

This sample doesn’t seem to have the functionality I’d like.

I guess that’s that then :rofl:

1 Like

Hi @jack3,

How about this?

private string CopyKey => "Copy";

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
  var bCopy = Settings.GetBool(CopyKey, false);

  var copyOption = new OptionToggle(bCopy, "No", "Yes");

  var gp = new GetPoint();
  gp.SetCommandPrompt("Point location");
  gp.AddOptionToggle(CopyKey, ref copyOption);
  for (; ; )
  {
    var res = gp.Get();
    if (res == GetResult.Option)
    {
      bCopy = copyOption.CurrentValue;
      continue;
    }
    if (res != GetResult.Point)
      return Result.Cancel;
    break;
  }

  var point = gp.Point();
  doc.Objects.AddPoint(point);
  doc.Views.Redraw();

  Settings.SetBool(CopyKey, bCopy);

  return Result.Success;
}

– Dale

1 Like

Yes,Thank you very much!

Hello

Do I always need to use this mesot to have two options on the command line?