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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

UnitsManager get units

Message 1 of 3
225 Views, 2 Replies

UnitsManager get units

Hello Fusion 360 coders, I am working in python and have read up on unitsManager but not positive it is the right solution.  I need to query Fusion for the units it has currently.  Meaning, in our API we have a design of a model being shown, and just like one would go to the interface and click on the system units to see if its in MM or inches, I need to ask Fusion if the model being shown is in MM or inches.  This would be a type of 'get' from Fusion if available.  (I'd rather not  ask the operator for a value as a few samples working with unitsManager shows.)  Currently I am reading parameters to determine if the model is in MM or inches,  but am thinking there might be a way to ask just like 'Units' field shows on the interface.....thank you in advance for any help or hints you can offer!  

Message 2 of 3

The following code will do what you want. A FusionUnitsManager object derives from UnitsManager and can be obtained using the fusionUnitsManager property of the Design object. (The unitsManager property on the Design object is typed to return a UnitsManager object but will also return a FusionUnitsManager object.) The FusionUnitsManager object supports the distanceDisplayUnits property that you can use to get or set what the units are for the design.


um = des.fusionUnitsManager
if um.distanceDisplayUnits == adsk.fusion.DistanceUnits.MillimeterDistanceUnits:
    ui.messageBox('Millimeter Units')
elif um.distanceDisplayUnits == adsk.fusion.DistanceUnits.CentimeterDistanceUnits:
    ui.messageBox('Centimeter Units')
elif um.distanceDisplayUnits == adsk.fusion.DistanceUnits.MeterDistanceUnits:
    ui.messageBox('Meter Units')
elif um.distanceDisplayUnits == adsk.fusion.DistanceUnits.FootDistanceUnits:
    ui.messageBox('Foot Units')
elif um.distanceDisplayUnits == adsk.fusion.DistanceUnits.InchDistanceUnits:
    ui.messageBox('Inch Units')


Brian Ekins
Inventor and Fusion 360 API Expert
Message 3 of 3
in reply to: marylou.forsyth

Hi @marylou.forsyth .


I think what you are looking for can be obtained with the FusionUnitsManager.defaultLengthUnits property. 


This is for the Product object you got (Design,FlatPatternProduct,CAM,Drawing).

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

Post to forums  

Autodesk DevCon in Munich May 28-29th

Autodesk Design & Make Report