Autodesk Robot Structural Analysis
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Robot API - how to modify units
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi,
I would like to change default units for forces with Robot API, and set N instead of kN.
Here is my script :
Dim projPref As RobotProjectPreferences
projPref = Robot.Project.Preferences
projPref.Units.Set(IRobotUnitType.I_UT_FORCE, N)
The last line does not work (red part).
What is the appropriate syntax to set the unit to Newtons ?
Solved! Go to Solution.
Re: Robot API - how to modify units
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Dim Robot As New RobotApplication Dim projPref As RobotProjectPreferences Set projPref = Robot.Project.Preferences Dim RU As RobotUnitData Set RU = projPref.Units.Get(I_UT_FORCE) RU.E = False RU.Name = "N" RU.Precision = 2 projPref.Units.Set I_UT_FORCE, RU

Rafal Gaweda
Product Support
Autodesk, Inc.
Re: Robot API - how to modify units
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks.
Re: Robot API - how to modify units
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
It works for forces, but it does not work for moments. Here is my code :
Dim projPref As RobotProjectPreferences
Dim RU As RobotUnitData
projPref = Robot.Project.Preferences
RU = projPref.Units.Get(IRobotUnitType.I_UT_FORCE)
RU.E = False
RU.Name = "daN"
RU.Precision = 2
projPref.Units.Set(IRobotUnitType.I_UT_FORCE, RU)
RU = Nothing
RU = projPref.Units.Get(IRobotUnitType.I_UT_MOMENT)
RU.E = False
RU.Name = "daN*m"
RU.Precision = 2
projPref.Units.Set(IRobotUnitType.I_UT_MOMENT, RU)
I don't get any error message, but it does not work for moment, whereas it works for forces.
Re: Robot API - how to modify units
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Dim RUCD As RobotUnitComplexData Set RUCD = projPref.Units.Get(I_UT_MOMENT) RUCD.E = False RUCD.Name = "daN" RUCD.Name2 = "m" RUCD.Precision = 2 projPref.Units.Set I_UT_MOMENT, RUCD

Rafal Gaweda
Product Support
Autodesk, Inc.
Re: Robot API - how to modify units
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks.
Re: Robot API - how to modify units
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi,
Sorry to come back again to this topic which appears as solved, but there is still a problem with units in my script. In Robot, if I go to Tools>Project Preferences>Units>Force, I can see that kN changed to daN, as I wanted.
The problem is that when I calculate and then display the forces array (Results>Forces), forces are still in kN in the array. So I have to go to Tools>Project Preferences>Units>Force and quit, and then the array is updated and forces appear in daN.
So there is a kind of "refresh" problem for units.
Same problem if I want to diplay forces diagrams. Unless I open Tools>Project Preferences>Units>Force, forces are still in kN.
How can I fix this ?
Re: Robot API - how to modify units
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
That's interesting, we have to check it.

Rafal Gaweda
Product Support
Autodesk, Inc.
Re: Robot API - how to modify units
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi,
Any answer to my problem ?
Thanks
Re: Robot API - how to modify units
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
It will not be possible for us to investigate this situation before the next week.
Try to add projPref.Units.Refresh at the end of your code.

Artur Kosakowski
Support Specialist
Product Support
Autodesk, Inc.
