How to automatically change units in CATIA

change units in catia

Today, I’m going to show you how to automatically change units in CATIA with a CATScript macro. This is useful if you need have another code that needs the units set to metric or English in order to run properly. The first lines of code from CATIA Change Units.CATScript are:



The SettingControllers manages the parameters available in the property pages of the Tools > Options menus. Each parameter setting may be represented by one or several attributes in the underlying setting repository.

All setting controllers share the five methods of the SettingController object to deal with the whole set, or a subset of the setting attributes:

  • Commit to make a memory copy of the setting attribute values
  • Rollback to restore the last memory copy of the setting attribute values
  • ResetToAdminValues to restore the administered values of all the attributes
  • ResetToAdminValuesByName to restore the administered values of a subset of the attributes
  • SaveRepository to make a persistent copy of the setting attribute values on file

You may have also noticed the code with UnitSheetSetting which is the interface to be used to read or modify the CATIA\Tools\Options settings for values of Units. The next part of the change units macro:


Here you can see where you use Commit and how it comes into play. Commit saves the current values of the setting attributes managed by the setting controller in a specific memory area. Successive calls to Commit overwrite the memory area. The values saved by the last call to Commit can be restored from that memory area using the Rollback method.


Magnitude is where you set the type of unit you want to change, in our case “Length” (as opposed to Angle, Time, Mass, etc.). Next, set the units to Millimeter or Inch. The numbers are then to set the exponential notation for values greater than 10e+/-.


Download the complete code from our CATIA Macros Download Page.


Now you know how to change units in CATIA. If there are any other terms you don’t understand then use the CATIA visual basic help file to figure it out.