Blog · Inventor · 1 Oct 2026 · Last updated 11 Oct 2026 · 7 min read · By Stefano B.

How to dimension holes and overall sizes in Inventor drawings with the API

Automatic dimensions do not work on STEP solids, so an AI agent has to place them itself. A working API example to start from, how to find the extreme points with geometry intents, why circles reported zero holes, how to keep dimensions from overlapping, and the dimensioning rules a shop actually accepts.

Short answer: "Retrieve Dimensions" does nothing on dumb STEP solids, so every dimension is placed by code. Collect geometry intents on every curve of the view (start and end points of lines, the four cardinal points of circles and arcs), validate that each point is really on its curve, then add single linear dimensions between the extremes with AddLinear. Check overlaps on DimensionText.RangeBox, not on the dimension.

Test plate 300 x 200 x 10 with twelve 14 mm holes and one R40 corner, as a drawing view from the STEP file. No dimensions. Retrieve Dimensions: 0 found.
From this: the view of a STEP part. Retrieve Dimensions finds nothing.
The same plate dimensioned by code: 40, 50, 50, 50 and overall 300 below; 40, 60, 60 and overall 200 on the left; 12 x diameter 14 on one hole; R40 on the corner.
To this: every dimension placed by code. Overall size outside, smaller segments towards the part.

All images on this page come from a test plate drawn for this article (300 x 200 x 10, twelve Ø14 holes, one R40 corner), exported to STEP and opened again in Inventor 2025.2. Inventor placed the geometry, the dimensions and the HOLES note, driven from Python through the API: CreateGeometryIntent (with kCenterPointIntent for hole centres) and AddLinear as below, plus AddDiameter and AddRadius for the holes and the corner. The drawings are redrawn here from Inventor's DXF export. Dots, labels and the dashed circle are added from the values Inventor returned.

This came up on the Autodesk forum, in a thread about driving Inventor with AI where someone asked how to create the drawings, views and dimensions included. This is the long answer. It is one step of a series: first choose the base view orientation, then dimension (this page), then check the output.

The basics: one dimension

The objects involved:

This iLogic rule finds the longest horizontal line in the first view of the active sheet and adds a horizontal dimension above it. We ran the same API calls on a copy of a real drawing.

Sub Main()
    Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument
    Dim oSheet As Sheet = oDoc.ActiveSheet
    Dim oView As DrawingView = oSheet.DrawingViews.Item(1)
    Dim oTG As TransientGeometry = ThisApplication.TransientGeometry

    ' find the longest horizontal line in the view
    Dim best As DrawingCurve = Nothing
    Dim bestLen As Double = 0
    For Each oCurve As DrawingCurve In oView.DrawingCurves
        If oCurve.CurveType = CurveTypeEnum.kLineSegmentCurve Then
            Dim p1 As Point2d = oCurve.StartPoint
            Dim p2 As Point2d = oCurve.EndPoint
            Dim dx As Double = Math.Abs(p1.X - p2.X)
            If Math.Abs(p1.Y - p2.Y) < 0.0001 And dx > bestLen Then
                bestLen = dx
                best = oCurve
            End If
        End If
    Next
    If best Is Nothing Then Exit Sub

    ' attach to both ends, text 1.5 cm above the line
    Dim i1 As GeometryIntent = oSheet.CreateGeometryIntent(best, PointIntentEnum.kStartPointIntent)
    Dim i2 As GeometryIntent = oSheet.CreateGeometryIntent(best, PointIntentEnum.kEndPointIntent)
    Dim pt As Point2d = oTG.CreatePoint2d((best.StartPoint.X + best.EndPoint.X) / 2, best.StartPoint.Y + 1.5)

    Dim oDim As LinearGeneralDimension = oSheet.DrawingDimensions.GeneralDimensions.AddLinear(pt, i1, i2, DimensionTypeEnum.kHorizontalDimensionType)
    MessageBox.Show("Dimension added: " & Math.Round(oDim.ModelValue * 10, 1) & " mm")
End Sub

What to change for your drawing. The rest can stay as it is.

What trips people up:

On a real part the same pattern is repeated for overall sizes and holes, as below.

Overall dimensions from intents

Select Case oCurve.CurveType
    Case Curve2dTypeEnum.kCircleCurve2d, Curve2dTypeEnum.kCircularArcCurve2d, _
         Curve2dTypeEnum.kEllipseFullCurve2d, Curve2dTypeEnum.kEllipticalArcCurve2d
        AddIntent(oSheet, intents, oCurve, PointIntentEnum.kCircularTopPointIntent, True)
        AddIntent(oSheet, intents, oCurve, PointIntentEnum.kCircularBottomPointIntent, True)
        AddIntent(oSheet, intents, oCurve, PointIntentEnum.kCircularLeftPointIntent, True)
        AddIntent(oSheet, intents, oCurve, PointIntentEnum.kCircularRightPointIntent, True)
End Select
The test plate with every geometry intent as an orange dot: 58 points kept, 2 rejected. Rings mark the points with minimum and maximum X, which give the overall width.
Dim it As GeometryIntent = oSheet.CreateGeometryIntent(oCurve, place)
If it.PointOnSheet Is Nothing Then Return
If onCurveCheck Then
    Try
        oCurve.Evaluator2D.GetParamAtPoint(pts, guess, maxDev, params, solTypes)
    Catch
        Return                       ' the cardinal point is not on this arc
    End Try
End If
intents.Add(it)

Then take the intents with minimum and maximum X (and Y) and add the dimension:

oDims.AddLinear(oTextPoint, iMinX, iMaxX, DimensionTypeEnum.kHorizontalDimensionType)

Why the validation: on an arc, a cardinal-point intent can be created outside the curve, at a cardinal point of the full circle that the arc does not reach. GetParamAtPoint throws if the point is not on the curve. This approach builds on public work by Jelte de Jong (hjalte.nl).

On the R40 corner of the test plate, two of the four points are off the arc. For the images on this page we found them by checking each point's angle against the arc's start and end angles, a simpler test than GetParamAtPoint:

The R40 corner arc with its full circle dashed. The top and right cardinal points are on the arc; the left and bottom ones are not.

Holes: why the count said zero

What we saw: a part with 12 real holes, and a hole note on the drawing that said "HOLES: 0".

The cause: a closed circle has no start point. StartPoint, EndPoint and MidPoint are Nothing. Code that looked for circles through their start point found none. On the test plate in Inventor 2025.2 none of the 12 circles returns a start point, and the same count gives the same zero:

The test plate with 12 holes and a note that says HOLES: 0.

A check worth adding (we have not built this exact one): compare the hole count in the note with the number of circles in the view before the drawing goes out.

Read the radius from the model geometry instead, in model centimetres, without the view scale:

diameter_mm = oCurve.ModelGeometry.Geometry.Radius * 20

For a hole pattern note, the value token in FormattedText is <DimensionValue/>, for example n.12 x <DimensionValue/>. With <<>> the text is appended instead.

Overlaps

Trap Effect Fix
oDim.RangeBox on a LinearGeneralDimension Does not exist, fails silently oDim.Text.RangeBox
Margin of 0.12 cm between texts Still touching 0.30 cm
Text.Origin as the text position Means the left edge on some drawings, the centre on others Create the dimension, then measure Text.RangeBox
DrawingArrangeDimensionsCmd Made it worse: two merged "40" became three Place correctly from the start
DrawingDimensions.Arrange Overlap count went from 4 to 0 and the drawing was worse Look at the drawing, not the counter
Vertical text placed from the dimension line Text started 52.5 to 54.5 mm from the line and ran into the part Lane width = text height × 1.35 + clearance

Arrange also needs at least two dimensions and no chain dimension sets in the collection.

The rules the shop accepted

After several rounds with an experienced designer, these are the rules our fabrication drawings follow:

Default ISO chain dimensions use a small dot as terminator (ArrowheadTypeForChainDimensions = 71949). That alone was a reason to drop them.

Do and don't

Do

Don't

Questions people ask

Can an AI agent dimension parts it has never seen? Yes, with rules like these. Most of the work is deciding which edges to dimension and checking every drawing.

How do you check hundreds of drawings? Count dimensions per view, compare overall sizes with the part, look for overlapping text boxes, then look at the drawings. See how to check AI-generated CAD output.

If you would rather have the drawings than the code: steel fabrication drawings from your STEP file.

References