Different Length Units in Mechanical

Mike.Thompson
Mike.Thompson Member, Employee Posts: 338
25 Answers 100 Comments 25 Likes First Anniversary
✭✭✭✭
edited December 2023 in Structures

The Mechanical application has a user defined unit system in the UI that can be changed, but there are many other units to be aware of when using the API.

There is the user-specified current system of the application (UI):
UILenUnit=DataModel.CurrentUnitFromQuantityName("Length")

The GeoData unit for any internal CAD data like centroids of bodies, edge lengths, face areas, etc...
GeoLenUnit = ExtAPI.DataModel.GeoData.Unit

And any MeshData you work with (i.e. node locations, elem. centroids)
MeshLenUnit=ExtAPI.DataModel.MeshDataByName("Global").Unit

The internal Graphics generator (creation of custom lines, arrows boxes, etc...)
ExtAPI.Graphics.Unit

you can import the "units" module (built in to the API environment) for easy units conversion.

Tagged:

Comments

  • ZZ.tang
    ZZ.tang Member Posts: 14
    Name Dropper First Comment
    **
    edited December 2023

    Hi, what is "CurrentConsistentUnitFromQuantityName" used for?
    The unit of Length of this value seems changing with mechanical, But the unit of Angle is always in rad.

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 338
    25 Answers 100 Comments 25 Likes First Anniversary
    ✭✭✭✭

    @ZZ.tang
    ExtAPI.DataModel.CurrentUnitFromQuantityName will return "deg" when active in the UI.

    Note there is this at the model level:
    ExtAPI.DataModel.CurrentConsistentUnitFromQuantityName

    And also this at the analysis level:
    Model.Analyses[0].CurrentConsistentUnitFromQuantityName

    I think the term 'Consistent' in the method indicates it is consistent with the other tools it is communicating with behind the scene. For example, the analysis level method will be consistent with the units used in creation of the input file for the solver. This could be different than what is displayed in the Mechanical UI in some cases. I am not 100% sure what is meant by consistent at the model level, but it could be based on communications with workbench or other imported data sources.