Units for api

Units for api

Cotral.RD2
Advocate Advocate
1,389 Views
7 Replies
Message 1 of 8

Units for api

Cotral.RD2
Advocate
Advocate

Has there been any updates on the default units for the sketcher?

The last lime i checked two days back the dimension from api i got was in radians for angles and cms for lengths, but now it seems the units are changed to mm and deg..

Its a good move but i need to be sure this is truly the case..

 

 

Pavan HEMMEGE VENKATAPPA
Fusion 360 Ultimate User
0 Likes
1,390 Views
7 Replies
Replies (7)
Message 2 of 8

BrianEkins
Mentor
Mentor

What calls are you using to get those values?  The API should always return distances in centimeters and angles in radians.  

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
0 Likes
Message 3 of 8

Cotral.RD2
Advocate
Advocate

Ah my mistake!

yes when i get the values directly to a variable the units are in centimeters and radians but since i was transferring this value directly to a command input with mm and deg units the conversion happened automatically

Pavan HEMMEGE VENKATAPPA
Fusion 360 Ultimate User
0 Likes
Message 4 of 8

maxim.yudayev3RJDX
Contributor
Contributor

Brian,

 

Is there a list of standard units that the Units Manager recognises? The documentation does not specify this. I am interested in using angular velocity units passed from user in RPM.

 

Thank you.

 

-Max

0 Likes
Message 5 of 8

BrianEkins
Mentor
Mentor

There should be something in the documentation about this but I didn't think about it at the time because the API supports whatever core Fusion supports since it's just using internal utilities.  One way to see what's supported is to run the Parameters command and create a new user parameter.  You can choose the unit for the new parameter which will display a large list of unit types.  There is an option for angular velocity as rpm.  One thing to be aware of though is that the API always deals with consistent internal units, which are cm for length, radians for angles, seconds for time, and kilograms for mass. So if the user enters "5 rpm" and you get back the value you'll get 

0.5235987755982988, which is 5 rpm expressed as radians/second.

 

Units.png

 

 

 

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 6 of 8

maxim.yudayev3RJDX
Contributor
Contributor

Brian,

Hahaha, I actually found it right the same way a few minutes before you had left a reply! Thank you sir!

Yes, you always mention in similar threads that F360 interprets and evaluates the values in those fixed units.

 

Though I now have a new problem, I can't wrap my head around why I am unable to choose a "No Units" value for an addValueInput. Can you please give an advice? I had tried different spelling and letter casing, can't seem to find the right way.

Screen Shot 2018-10-20 at 18.17.04.png

 

Thank you very much.

 

-Max

0 Likes
Message 7 of 8

BrianEkins
Mentor
Mentor

An empty string should work to create a parameter with no units.

 

addValueInput('safetyFactor', 'Safety Factor', '', 1)
---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 8 of 8

maxim.yudayev3RJDX
Contributor
Contributor

Tried it before, but apparently it was only part of the issue, i declared number "1" in stead of "ValueInput.createByReal(1)" as the initial value for that input.

 

Thank you very much for the tips, the issue is solved!

0 Likes