# Rhino Commnad Plugin C# User Input - Optional String Values

**URL:** <https://discourse.mcneel.com/t/rhino-commnad-plugin-c-user-input-optional-string-values/87270>\
**Category:** Rhino Developer\
**Created:** [August 8, 2019, 9:11pm UTC](https://discourse.mcneel.com/t/rhino-commnad-plugin-c-user-input-optional-string-values/87270 "2019-08-08T21:11:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Petras\_Vestartas](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/petras_vestartas/32/480531_2.png) [@Petras\_Vestartas](https://discourse.mcneel.com/u/Petras_Vestartas)\
**Post date:** [August 8, 2019, 9:11pm UTC](https://discourse.mcneel.com/t/rhino-commnad-plugin-c-user-input-optional-string-values/87270/1 "2019-08-08T21:11:05Z")

</div>

Hi,

I would like to ask question about multiple user inputs for Rhino Command Plugin using C#

In the example below I can get string value in one input, and the second inputs gets 4 integer values.  
I would like to do them not in two separate parts but in one part with 5 optional values.

```
            string name = "CustomName";
            var res = Rhino.Input.RhinoGet.GetString("ScanName", true, ref name);
            RhinoUtil.Print(name);

            GetOption go = new GetOption();
            go.SetCommandPrompt("Set Faro scan settings");

            Rhino.Input.Custom.OptionInteger HorizontalAngleMax = new Rhino.Input.Custom.OptionInteger(90 + 60, 0, 360 );
            Rhino.Input.Custom.OptionInteger HorizontalAngleMin = new Rhino.Input.Custom.OptionInteger(90 - 60 , - 60, 90);
            Rhino.Input.Custom.OptionInteger VerticalAngleMin = new Rhino.Input.Custom.OptionInteger(-45 ,- 60, 90);
            Rhino.Input.Custom.OptionInteger VerticalAngleMax = new Rhino.Input.Custom.OptionInteger(45 , -60, 90);

            go.AddOptionInteger("HorizontalAngleMin", ref HorizontalAngleMin);
            go.AddOptionInteger("HorizontalAngleMax", ref HorizontalAngleMax);
            go.AddOptionInteger("VerticalAngleMin", ref VerticalAngleMin);
            go.AddOptionInteger("VerticalAngleMax", ref VerticalAngleMax);

            Rhino.Input.GetResult get_rc = go.Get();
```

---

<div class="post-metadata">

**Author:** ![menno](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/menno/32/770384_2.png) [@menno](https://discourse.mcneel.com/u/menno)\
**Post date:** [August 9, 2019, 1:54pm UTC](https://discourse.mcneel.com/t/rhino-commnad-plugin-c-user-input-optional-string-values/87270/2 "2019-08-09T13:54:54Z")

</div>

I suppose something like this could work (beware, I did not actually test this, but the idea should still work even though I may have made some typos 🙂)

```auto
GetOption go = new GetOption();
go.AcceptNothing(true); // when a user presses Enter, "Nothing" is returned.
string scanName = "CustomName";
int haMax = 90+60;
int haMin = 90-60;
int vaMax = 45;
int vaMin = -45;
while(true)
{
  go.ClearCommandOptions();
  int optScanName = go.AddOption("ScanName", scanName);
  Rhino.Input.Custom.OptionInteger HorizontalAngleMax = new Rhino.Input.Custom.OptionInteger(haMax, 0, 360 );
  Rhino.Input.Custom.OptionInteger HorizontalAngleMin = new Rhino.Input.Custom.OptionInteger(haMin , - 60, 90);
  Rhino.Input.Custom.OptionInteger VerticalAngleMin = new Rhino.Input.Custom.OptionInteger(vaMin ,- 60, 90);
  Rhino.Input.Custom.OptionInteger VerticalAngleMax = new Rhino.Input.Custom.OptionInteger(vaMax , -60, 90);

  int optHorizontalAngleMin = go.AddOptionInteger("HorizontalAngleMin", ref HorizontalAngleMin);
  int optHorizontalAngleMax = go.AddOptionInteger("HorizontalAngleMax", ref HorizontalAngleMax);
  int optVerticalAngleMin = go.AddOptionInteger("VerticalAngleMin", ref VerticalAngleMin);
  int optVerticalAngleMax = go.AddOptionInteger("VerticalAngleMax", ref VerticalAngleMax);
  
  Rhino.Input.GetResult get_rc = go.Get();
  if (get_rc == Rhino.Input.GetResult.Nothing)
    break; // user pressed enter on current values
  if (get_rc == Rhino.Input.GetResult.Option)
  switch(get_rc.GetOptionIndex())
  {
    case optScanName:
      var res = Rhino.Input.RhinoGet.GetString("Give scan name", ref name);
      if (res != Rhino.Input.GetResult.Success)
        return res; // user canceled or something went wrong.
      break;
    case optHorizontalAngleMax:
    case optHorizontalAngleMin:
    case optVerticalAngleMax:
    case optVerticalAngleMIn:
      haMax = HorizontalAngleMax.Value;
      haMin = HorizontalAngleMin.Value;
      vaMax = VerticalAngleMax.Value;
      vaMin = VerticalAngleMin.Value;
  default:
    return Rhino.Input.GetResult.Failure; // something unexpected happened.
}
```
