Setting Dimension Precision with iLogic

I was recently asked if it is possible to set the precision of the dimensions in a drawing, using iLogic. I did a quick search through the Inventor API and found that there was a sample that provided this functionality.

With that in mind, I tidied up the example, and added an array with an input list box. This provides a basic interface and allows the user to select the required precision. I set up the code in such a way that both “Linear” and “Angular” dimensions are set at the same time. You can edit this in the code if needed.

Below is an animated GIF showing how the iLogic utility works:

Here is the iLogic code:

'This version of iLogic code by @ClintBrown3D, Adpated from the Inventor API samples
'Originally Published at

'Set up Array and Selection for Decimal Places
Dim CB As New ArrayList

XX = InputListBox("Set Precision for all Dimensions", CB, CB, Title := "Unofficial Inventor", ListName := "Choose a Precision for all Dimensions")
If XX = "Zero" Then : XX1 = 41729 : XX2 = 42241 : End If
If XX = "One" Then : XX1 = 41730 : XX2 = 42242 : End If
If XX = "Two" Then : XX1 = 41731 : XX2 = 42243 : End If
If XX = "Three" Then : XX1 = 41732 : XX2 = 42244 : End If
If XX = "Four" Then : XX1 = 41733 : XX2 = 42245 : End If
If XX = "" Then : Return : End If

' a reference to the drawing document.
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument

'a reference to the active sheet.
Dim oSheet As Sheet
oSheet = oDrawDoc.ActiveSheet

Dim counter As Long
counter = 1

Dim oDrawingDim As DrawingDimension
For Each oDrawingDim In oSheet.DrawingDimensions
	counter = counter + 1

' a reference to the first general dimension in the collection.
Dim oGeneralDim As GeneralDimension
oGeneralDim = oSheet.DrawingDimensions.GeneralDimensions.Item(1)

' a reference to the dimension style of that dimension.
Dim oDimStyle As DimensionStyle
oDimStyle = oGeneralDim.Style

' Modify some properties of the dimension style.
' This will modify all dimensions that use this style.
oDimStyle.LinearPrecision = XX1
oDimStyle.AngularPrecision = XX2


This version of the code was briefly tested in Inventor 2021.

As always, please test all iLogic code extensively on non-production files. Do not use any code in a production environment until YOU have thoroughly tested it and have verified that it works as expected. Always back up any data before running any experimental code. You are ultimately responsible for any iLogic code that you run, so make sure you test it thoroughly!

Comments are closed.

Create a website or blog at

Up ↑

%d bloggers like this: