Blog · Inventor · 1 Oct 2026 · 5 min read
How to manage dimension styles in Inventor with scripts and AI: library, template, API
You change the dimension style in the template and nothing happens. Inventor keeps styles in three places, the API exposes only part of them, and some properties fail without an error. Where styles really live, what the API can and cannot set, and the procedure that works in Inventor 2025.
Short answer: in Inventor the Style Library wins over the template, and a drawing already generated keeps its own frozen copy. To change dimension styles for good, write them into the library, restart Inventor, and have the drawing rule assign the style to every dimension at the end, once they all exist. Then check the exported DXF, because the screen does not show you which definition won.
Where a style lives: three copies
| Copy | When it is read | What changes it |
|---|---|---|
| Style Library (XML files) | When Inventor starts | Editing the XML, then restarting Inventor |
Template (.idw) |
When a new drawing is created | Only if it matches the library. If not, the library wins |
| Generated drawing | Never again | Nothing. It is a frozen copy |
If the template and the library disagree, Inventor shows a Style Conflict dialog and says the library definitions will be used. Editing the template alone changes nothing.
Why you edit the XML and not the Styles Editor
If the project has Use Style Library = Read-Only, the Styles Editor's Save to Style Library gives no error and does nothing. Use Style Library = No was not available to us either. So the agent edits the library files directly: dimension.xml, text.xml, layers.xml.
Four traps when it writes them:
- Keep the BOM. PowerShell's
WriteAllTextwithout a second argument writes UTF-8 without a BOM. PassUTF8Encoding($true). - Replace inside the right style only. A value like
TextGap="0.05"appears in several styles (ISO, ANSI...). Cut out the block of your style and replace there, as plain text, not a regex. - The same property can appear twice.
LinearPrecisionsits in<UnitVals>(the one you want) and in<AltVals>(alternate units). - Units are centimetres. A 3 mm text height is
FontSize="0.3". Colours are R G B A from 0 to 1.
Then close and reopen Inventor: it reads the library only at start-up.
What the API can and cannot set
On DimensionStyle the API exposes ArrowheadSize and TextStyle. The gap between text and dimension line, and the extension line overshoot, are not exposed on any type. Those go in the XML (TextVals TextGap, DisplayVals ExtLineExtension).
| Call | What happens | Use instead |
|---|---|---|
Style.UpdateFromLibrary |
Does not exist, no error | Restart Inventor after editing the library |
DimensionStyle.LineColor |
Not exposed | DimensionStyle.Color |
RadiusDimensionStyle |
Does not exist | RadialDimensionStyle |
DrawingDimension.Style |
DISP_E_MEMBERNOTFOUND |
Cast to GeneralDimension, then .Style |
ActiveObjectDefaults.LinearDimensionStyle = s |
Works in a test, not inside the rule | Assign per dimension at the end |
st.TextStyle = ts with Set (VBScript) |
"Object doesn't support this property or method" | Assign without Set |
| Pass the precision enum to a dimension | No error, zero decimals: 87.5 becomes 88 |
Enum on the style (1 decimal = 41730), integer on the dimension (1 decimal = 1) |
kParallelDimensionText on diameter or radius |
"The parameter is incorrect" | Leave their text orientation alone |
DrawingDimension.Precision changes only the decimals shown. ModelValue stays the same: precision 0, 1, 2, 3 shows 17, 17.3, 17.29, 17.294 on the same 1.7294 cm.
Copy a style, never edit a shared one
Built-in styles are shared. Note Text (ISO) is also used by part labels, so changing it changes them too. Copy it and change the copy:
' od = doc.StylesManager.ActiveStandardStyle.ActiveObjectDefaults
For i = 1 To sm.TextStyles.Count
If sm.TextStyles.Item(i).Name = NEW_NAME Then Set tsNew = sm.TextStyles.Item(i)
Next
If tsNew Is Nothing Then
Set tsNew = od.LinearDimensionStyle.TextStyle.Copy(NEW_NAME)
End If
tsNew.Font = "ISOCP_IV25"
tsNew.FontSize = 0.3 ' cm: 3 mm text
tsNew.WidthScale = 0.8 ' 80% width
The six object-default dimension styles are often the same object (Default (ISO)). Changing "the linear one" may change all six.
Assign the style to every dimension, at the end
For idm = 1 To oSheet.DrawingDimensions.Count
Dim oGen As GeneralDimension = TryCast(oSheet.DrawingDimensions.Item(idm), GeneralDimension)
If oGen IsNot Nothing Then oGen.Style = oStyle
Next
Run it after every dimension has been placed. A style set as default earlier in the rule did not reach all of them.
Colour: three places decide it
Dimension colour can come from the dimension style, the layer, or the object. If the style has LineColorIsByLayer="0", the style wins over the layer: we set the layer to white and the dimensions stayed yellow. Set LineColorIsByLayer="1" and the layer decides.
Check it in the DXF, not on screen
White on a white sheet looks the same as black. The only way to know which definition won is to export a DXF and read the dimension style values in it with a script. And remember that drawings generated before the change keep the old style.
The procedure
- Write the style into the library XML, with BOM, inside the right style block only.
- Restart Inventor.
- Generate the drawings. The rule assigns
GeneralDimension.Styleto every dimension at the end. - Give the style a name of its own per drawing before the DXF files are merged anywhere. This is the step that cost us a month: why merged DXF drawings change their dimensions.
- Export a DXF and check the style values inside it.
Do and don't
Do
- Edit the library, then restart Inventor.
- Copy built-in styles before changing them.
- Assign styles at the end of the rule.
- Verify in the exported DXF.
Don't
- Don't trust Save to Style Library with a read-only library.
- Don't edit
Note Text (ISO)orDefault (ISO)in place. - Don't pass the style's precision enum to a dimension.
- Don't expect old drawings to update.
Questions people ask
Can an AI agent change styles on hundreds of drawings? Yes, through the library and the generating rule. Drawings already made are frozen and need regenerating, or fixing on the DXF side.
Why not just use the Styles Editor? On one drawing, use it. For a batch the agent needs a repeatable change it can check, and the editor did not write to a read-only library.
Which Inventor version? Inventor 2025. Test property names on your version: some we expected did not exist.