Force Unit Type with iLogic

Clintbrown3D Autodesk Inventor iLogic Force unit type
Quick Sunday blog on forcing, or setting your Inventor document units, with iLogic.

Last week, I spent some time with Autodesk Inventor users, who have had a few issues with imported files, or files supplied by others. This can be anything from the wrong units, to a preference for Grams over Kilograms on Metric files.

Setting units manually is really simple, navigate to “Tools > Document Settings > Units” and set them from there.

The iLogic code below sets your assembly or part Length units to Millimetres and Mass units to Grams. I have included all of the other Length and Mass units (commented out), so that you can customise this code to suit your needs.

'Code by @ClintBrown3D
'Originally posted at
Dim doc = ThisDoc.Document

'Exit if Drawing file
If doc.DocumentType = 12292 Then
End If

'Set Inventor Units
oLengthType = 11269 'Millimeters
'oLengthType = 11272 'Inches
'oLengthType = 11273 'Foot
'oLengthType = 11268 'Centrimeters
'oLengthType = 11270 'Metres
'oLengthType = 11271 'Micron
doc.UnitsOfMeasure.LengthUnits = oLengthType

oMassType = 11284 'Grams
'oMassType = 11283 'Kilograms
'oMassType = 11285 'Slug
'oMassType = 11286 'lbs
doc.UnitsOfMeasure.MassUnits = oMassType

For more on units in Inventor, Fusion 360 and AutoCAD check out my blog post by clicking on the image below:

Autodesk Inventor iLogic - Units - Clint Brown.png

Comments are closed.

Create a website or blog at

Up ↑

%d bloggers like this: