Macro Unit Change

Hello
I want to know if anyone would have a macro to change the units of the document.
For example, in drawing, set the length units to "None" without going through the document properties.
Thank you

1 Like

Too good idea, my pieces (template) change unit regularly :roll_eyes:
Very good idea this macro

Hello;
To change the amount of decimal places in linear dimensions...

Option Explicit
Sub main()
    Dim swApp As SldWorks.SldWorks
    Dim swModel As ModelDoc2
    Dim swModelExtension As ModelDocExtension
    
    Set swApp = Application.SldWorks '
    Set swModel = swApp.ActiveDoc
    
    If Not swModel Is Nothing Then
        Set swModelExtension = swModel.Extension
        swModelExtension.SetUserPreferenceInteger swUserPreferenceIntegerValue_e.swUnitsLinearDecimalPlaces, swUserPreferenceOption_e.swDetailingNoOptionSpecified, 2 'Valeur à modifier exemple :2=2 decimales...
    End If
End Sub

with:

And to change the types of units (metric/imperial...)

Huge this macro.
It's exactly what I wanted, I put 0 at the end of the last line and that's it!
A few more minutes gained at the end of the day.

Thank you very much