Changing a documents format.

Changing a documents format.

NachoShaw
Advisor Advisor
320 Views
1 Reply
Message 1 of 2

Changing a documents format.

NachoShaw
Advisor
Advisor

Hey

 

How can I programatically change a documents format from say mm to in or vice versa?

 

 

Thanks

 

Nacho

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
321 Views
1 Reply
Reply (1)
Message 2 of 2

YuhanZhang
Autodesk
Autodesk

Here is a sample VBA code to change the document length unit for part and assembly:

 

Sub ChangeDocLengthUnitToCM()
    Dim oDoc As Document
    Set oDoc = ThisApplication.ActiveDocument
    
    If oDoc.DocumentType = kPartDocumentObject Or oDoc.DocumentType = kAssemblyDocumentObject Then
        Dim oUOM As UnitsOfMeasure
        Set oUOM = oDoc.UnitsOfMeasure
        
        Debug.Print oUOM.LengthUnits
        oUOM.LengthUnits = kCentimeterLengthUnits
        Debug.Print oUOM.LengthUnits
    End If
End Sub

Hope it helps.

 



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes