Conditional Input in CommandLineOption


I have a command where I would like to add an additional OptionEnumList based on the selection of an element while the command is running. If a user selects a specific element in the OptionEnumList I would like to then add an additional OptionEnumList for that choice.

Any direction would be helpful.


You can call ClearCommandOptions() inside the while loop to rebuild the options each time a user clicks.

Something like this:

var go = new GetObject();
for (;;)

  // Add command options here


  // Process command options and continue here

Dale, et al,

Is the a way to call ClearCommandOptions() on a specific option rather than all of them?

I’m looking to update one of the options after the user clicks each time but the remaining options should stay the same unless explicitly changed. I’ve got it working by saving out the other values to variables then reassigning them after I’ve called the ClearCommandOptions().

Seems like a lot of work to clear all options and re-instate all but one. I’m hoping I can simply clear the one that I want to update?

See code below. I’m wanting to add other options to the code below that would not be updated after the user clicks.

import Rhino as rh
import scriptcontext

rhdoc = scriptcontext.doc

def PlaceDots():
    num = 0
    direction = True
    gp = rh.Input.Custom.GetPoint()
    while True:
        intNum = rh.Input.Custom.OptionInteger(num)
        boolDirection = rh.Input.Custom.OptionToggle(direction, "Decrease", "Increase")
        gp.SetCommandPrompt("Select coordinates for dot")
        gp.AddOptionInteger("DotText", intNum, "Enter number for text dot to display")
        gp.AddOptionToggle("NextNumber", boolDirection)
        rc = gp.Get()
        num = intNum.CurrentValue
        direction = boolDirection.CurrentValue
        #print num, direction
        if rc == rh.Input.GetResult.Point:
            if -9 <= num <= 9:
                strNum = '0' + str(num)
                strNum = str(num)
            td = rh.Geometry.TextDot(strNum, gp.Point())
            if boolDirection.CurrentValue == True:
                num += 1
                num -= 1
        elif rc == rh.Input.GetResult.NoResult:
        elif rc == rh.Input.GetResult.Option:

if __name__ == "__main__":

Unfortunately, no this is not possible. The way you have done it is what we also do: clear all options and rebuild all options with the settings as they are changed by the user.

Thanks for the clarification.