GetOption issues


I developed a fairly complex costing module for myself to cost my laser cutting. I currently ask for options one after another in a series of quistions with list boxes etc…

I might be able to use GetOption to decomplicate the workflow but the demo on GetOption has me puzzled:

When I run the code and change any value of any option the Getoption function terminates without allowing me to change any other option. How do I set it up so that I am able to set all the different options and then only continue to the next bit of code.

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", 
  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, 
  opt = Array(arr0, arr1, arr2, arr3, 
  rc = Rhino.GetOption("Scripting 
options", opt)
  If IsArray(rc) Then
    For Each i in rc
      Call Rhino.Print(i)
  End If
End Sub



you could define all defaults used in your options as variables then run Rhino.GetOption in a loop, so you have a chance to continue but using the changed default values.

Note that this requires to have a way to exit the loop. I’ve used the first option for that.

GetOptionLoop.rvb (1011 Bytes)



Great, that is a clever workaround.