Blog · Inventor · 1 Oct 2026 · 3 min read
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. 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.
For the basics of the API (curves, intents, units), start with a working API example.
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: the top of the full circle, where 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).
Holes: why the count said zero
A closed circle has no start point. StartPoint, EndPoint and MidPoint are Nothing. Code that looked for circles through their start point found none: 12 real holes became "HOLES: 0".
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 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. The hard part is not the API call, it 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.