GetReal has only one default number value.
Can I get it to have a list of predefined values to click on?
like [100 , 200 , 300]
Thank you!
GetReal has only one default number value.
Can I get it to have a list of predefined values to click on?
like [100 , 200 , 300]
Thank you!
Hi @Bogdan_Chipara,
You can use AddOptionList to add a list to any getter exposed on RhinoCommon. However, the list must be string and not exclusively numeric characters.
– Dale
import Rhino
go = Rhino.Input.Custom.GetOption()
listValues = '200mm', '300mm', '400mm', '500mm'
listIndex = 0
go.AddOptionList("List", listValues, listIndex)
go.Get()
if( go.CommandResult() == Rhino.Commands.Result.Success ):
myIndex=go.Option().CurrentListOptionIndex
print (listValues[myIndex])
Instead of having one value as default:
Is it possible to directly display the full list of options?
Thank you!
Hi @Bogdan_Chipara,
Use AddOption and add each list value separately instead of using an option list.
– Dale
import Rhino
go = Rhino.Input.Custom.GetOption()
optionNames1 = 'Option1'
optionValues1 = '100mm'
optionNames2 = 'Option2'
optionValues2 = '200mm'
go.AddOption(optionNames1, optionValues1)
go.AddOption(optionNames2, optionValues2)
go.Get()
option = go.Option()
res = option.Index
print (res)
Something like the above ?
@dale ,
What if i need two or more options and for each I select I get to input a custom number ?