Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unitless values for command input

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
hanskellner
958 Views, 7 Replies

Unitless values for command input

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



Hans Kellner
Senior Manager, Principal Engineer
7 REPLIES 7
Message 2 of 8
hanskellner
in reply to: hanskellner

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.



Hans Kellner
Senior Manager, Principal Engineer
Message 3 of 8
ekinsb
in reply to: hanskellner

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.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 4 of 8
MichaelAubry
in reply to: ekinsb

Can we do this now?  I've got a scenario where I'd like to use a unitless number!

Michael Aubry
Autodesk Fusion 360 Evangelist
Message 5 of 8
ekinsb
in reply to: MichaelAubry

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.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 6 of 8
changedsoul
in reply to: ekinsb

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.

Message 7 of 8
ekinsb
in reply to: changedsoul

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.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 8 of 8
changedsoul
in reply to: ekinsb

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report