Choose the default option

Hi all!
In a GetXX method, with a couple of double options, I would like that, if the user type “20” and press “enter”, the value is assigned to a specific option I choose.
It works fine with a single numeric option but it generates an error with multiple numeric options.
Thanks! :slight_smile:

@software_comas, i’ve been using this way to do it:

Set go.AcceptNumber(True, False) to allow entering a number and put the code to setup command options in a seperate function eg. in below example this function is named SetCommandOptions(). Then you can clear the command options after a number has been entered and run that function again eg:

while True:
    get_rc = go.Get()
    if go.CommandResult() == Rhino.Commands.Result.Cancel:
    if get_rc == Rhino.Input.GetResult.Option:
        option_name = go.Option().EnglishName
        # do something here if required
    elif get_rc == Rhino.Input.GetResult.Number:
        # set the entered number as current value for an option
        optSize.CurrentValue = go.Number()


1 Like

Thanks a lot, Clement!
It works like a charm. :slight_smile: