Array user input


Any ideas of how I could program a plugin in C# in order to ask a Rhino User to input values in an array form? I mean instead of inputting a single value, to be able to provide an array of values. I am familiar with the get/add options in order to make the users to provide a single value, but I cannot figure out how I can make them to provide an array of elements.

I would like to use this array in order to create index numbers for each of the lines I have created.

So, for example: I have 5 lines, an empty array “myArray” of five elements and I want the user to be able to give 5 values in the Rhino command line in order to fill the array, so as the array will assign each value to each line.

The part I have problem is how to get/add by the user an array of values. All the rest are known.

Thank you :slight_smile:

How about this approach:

protected Result RunCommand(RhinoDoc doc, RunMode mode)
    Line[] fiveLines = new Line[5];
    for (int i = 0; i < fiveLines.Length; ++i)
        Result res = RhinoGet.GetLine(out fiveLines[i]);
        if (res != Result.Success) return res;

    for (int i = 0; i < fiveLines.Length; ++i)
        Line l = fiveLines[i];
        if (l.IsValid)
            doc.Objects.AddTextDot("Line " + i, l.PointAt(0.5));
    return Result.Success;

This is a good starting point.

Though, what I really want starts from this point and on. Now that we have created 5 lines and they are stored in an array, I would like to offset them. Now, I would like the user to be able to input the offset value for all curves at once, in a vector form.

E.g.: (“Insert offset value for the curves”): ( value1, value2, value3, value4, value5).

value1 corresponds to fiveLines[0]
value2 corresponds to fiveLines[1]
and so on.