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.


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:
- Sheet.DrawingDimensions.GeneralDimensions: the collection you add dimensions to.
- DrawingCurve: an edge as it appears in a drawing view. You dimension curves in the view, not edges of the 3D model.
- GeometryIntent: which point of a curve the dimension attaches to, such as its start or its end.
- Point2d: where the dimension text goes on the sheet.
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.
DrawingViews.Item(1): which view. 1 is the first view placed on the sheet.0.0001: how close to horizontal a line must be, in centimetres.+ 1.5: how far above the line the text goes, in centimetres (15 mm on the sheet).
What trips people up:
- Units and scale. The API works in centimetres, whatever the drawing shows.
ModelValueis in centimetres too, and it is the size of the part, not of the line on the sheet: in a view at 2:1, a line 40 mm long on paper returns 20 mm. - Intents. Without a point intent Inventor chooses the attachment, and not always the one you meant. Say which end you want.
- A dimension, not a note. A leader note with a number typed in looks like a dimension but does not update and cannot be checked.
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

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:

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:

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:
- Single dimensions (
AddLinear). No chain dimensions with dots, no baseline, no ordinate dimensions. A chain of arrows on one line was rejected too. - Overall size outside, smaller segments below, towards the part.
- Holes: the first hole from the edges, the others as centre distances.
- Ø never inside the hole. Small radii are not dimensioned.
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
- Collect intents on every curve, validate cardinal points.
- Read hole diameters from model geometry.
- Measure text boxes after creating each dimension.
- Agree the dimensioning rules with the shop, then encode them.
Don't
- Don't use start points to find circles.
- Don't trust Arrange or an overlap counter without looking.
- Don't assume
Text.Originis the centre.
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.