IS THERE A WAY TO CHANGE "UNIT OF MEASURE" IN INVENTOR 2010 FOR ALL PARTS OF AN ASSEMBLY?
Printable View
IS THERE A WAY TO CHANGE "UNIT OF MEASURE" IN INVENTOR 2010 FOR ALL PARTS OF AN ASSEMBLY?
Here is a simple loop routine that will get you started:
Code:Public Sub ChangeUnits()
'Set a reference to the current inventor document.
Dim InvDoc As Document
Set InvDoc = ThisApplication.ActiveDocument
Dim Refdoc As Document
'Initialize error trapping
On Error GoTo ERROR_QUIT
'Set all referenced files unit of measure to Inches
Dim oUOM As UnitsOfMeasure
Dim eLengthUnits As UnitsTypeEnum
'Loop thru all documents referenced by the active document
For Each Refdoc In InvDoc.AllReferencedDocuments
Set oUOM = Refdoc.UnitsOfMeasure
eLengthUnits = oUOM.LengthUnits
'Debug.Print oUOM.GetStringFromType(eLengthUnits)
'Check to see the length unit type
If oUOM.GetStringFromType(eLengthUnits) <> "inch" Then
oUOM.LengthUnits = kInchLengthUnits
'Inform the user that a part had its unit of measure changed
MsgBox "Part " & Refdoc.DisplayName & " UnitsOfMeasure changed to Inches"
End If
Next
ERROR_QUIT:
Exit Sub
End Sub