Prompts the user for one or more command-line options.
Rhino.GetOption (strPrompt, arrOptions)
strPrompt |
Required. String. A prompt or message. |
arrOptions |
Required. Array. An array containing one or more command line option arrays. |
A command-line option array contains information that defines the command-line option. The first element of a command-line option array identifies the type of command line option. The type of command-line option determines how many additional elements the command-line option array must contain.
There are 5 types of command-line options:
Value |
Description |
||||||||||||||||||
0 |
Single, or one, shot option. This option array will show a click-able single-shot option in the form of <strName> on the command line. The default option value is always False. If clicked, a True value will be returned indicating that it was clicked. The array elements are as follows:
|
||||||||||||||||||
1 |
Boolean option. This option array will show a click-able Boolean option in the form of <strName=strFalse/strTrue> on the command line. The array elements are as follows:
|
||||||||||||||||||
2 |
Integer option. This option array will show a click-able integer option in the form of <strName=intValue> on the command line. The array elements are as follows:
|
||||||||||||||||||
3 |
Number option. This option array will show a click-able number option in the form of <strName=dblValue> on the command line. The array elements are as follows:
|
||||||||||||||||||
4 |
List option. This option array will show a click-able list option in the form of <strName=intIndex> on the command line. Then the item is clicked, a list of click-able items will appear. The array elements are as follows:
|
Array |
An array of command-line option values, updated by the user, in the order in which they were passed to the function, if successful. |
Null |
If not successful, or on error. |
Sub TestOptions
Const OPT_SGL = 0
Const OPT_BLN = 1
Const OPT_INT = 2
Const OPT_DBL = 3
Const OPT_LST = 4
Dim arr0, arr1, arr2, arr3, arr4
Dim lst, opt, rc, i
lst = Array("One", "Two", "Three", "Four")
arr0 = Array(OPT_SGL, "Single")
arr1 = Array(OPT_BLN, "Boolean", "Off", "On", false)
arr2 = Array(OPT_INT, "Integer", 4, "New value", 2, 10)
arr3 = Array(OPT_DBL, "Double", 34.76, "New value", 1.0, 100.0)
arr4 = Array(OPT_LST, "List", lst, 0)
opt = Array(arr0, arr1, arr2, arr3, arr4)
rc = Rhino.GetOption("Scripting options", opt)
If IsArray(rc) Then
For Each i in rc
Call Rhino.Print(i)
Next
End If
End Sub