I would like to prompt for a value that is unitless. With the current command input API it doesn't appear possible to do this.
For example, here's the code I would use to add an integer input for a count from 1 to 10:
var countInput = command.commandInputs.addRangeCommandIntegerInput('count','How many?','cm',1,10);
Note that I need to specify a unit to allow this to work.
How may I prompt for and use unitless values?
Thanks
Solved! Go to Solution.
Solved by ekinsb. Go to Solution.
BTW - I've used addStringValueInput as an alternative for unitless values. But that requires additional parsing and error checking. It would be nicer if the inputs that require a unit also accepted a 'unitless' option.
There are some problems when working with unitless values that we have identified and have either fixed or are working on fixing. Unfortunately, you won't see these fixed until the next release.
Can we do this now? I've got a scenario where I'd like to use a unitless number!
You should be able to use an empty string as the unit identifier for a unitless value. Work was done to support this for command inputs but I just tested it with UnitsManager.evaluateExpression and it's not working correctly. I've logged a bug for that but expect the command inputs to behave correctly although I've not personally tested them.
Has this been resolved, and is this possible the same as an input of type "integer"? I am looking to use an input, and dont want to use a slider, or a spinbox, but when I create the commandInput, it seems to be of type float, which is not what I am looking for.
Any ideas how to use a commandInput of type integer, with no unit.
A ValueCommandInput is always a floating point number. In Fusion commands where it's getting a whole number from the user, i.e. the quantities for a pattern, it uses the integer spin box. The spin box is essentially the same as the command input in that the user can enter a number but it has the addition of letting them change the number by using the spinner instead of having to use the keyboard.
I see, thank you for responding. I tried out the spinbox and it works just fine for me. Probably should have tried it out first before posting.