- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I can get the current units of the model (lets say its mm), but I wanna change the units to meter and save the file.
I could not find any API to perform this task. Though I know the document settings UI in Inventor but I need API to do that.
Thanks in Advance,
Tikeshwar
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a code which allows the change from mm to inches which could be adapted to suit your needs.
Hope this helps.
'get input from user
oUnit = InputRadioBox("Select a units of measure type", "millimeter", "inch", True, "ilogic")
If oUnit = True Then
'set to millimeter
oUOM_1 = UnitsTypeEnum.kMillimeterLengthUnits
Else
'set to inch
oUOM_1 = UnitsTypeEnum.kInchLengthUnits
End If
'Define the open document
Dim openDoc As Document
openDoc = ThisDoc.Document
'Look at all of the files referenced in the open document
Dim docFile As Document
For Each docFile In openDoc.AllReferencedDocuments
'look at only part files
If docFile.DocumentType = kPartDocumentObject Then
'format file name
Dim FNamePos As Long
FNamePos = InStrRev(docFile.FullFileName, "\", -1)
Dim docFName As String
docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos)
'set length units
docFile.unitsofmeasure.LengthUnits = oUOM_1
'rebuild to update the display
docFile.Rebuild
End If
Next
iLogicVb.UpdateWhenDone = True