diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5ff2d902..1e767dff 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -25,6 +25,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
+- **Equations and global variables** (queue item 29): `list_equations`,
+ `set_equation` and `delete_equation`. One value (`"Width" = 60mm`) can
+ drive several dimensions (`"D1@Sketch1" = "Width" / 2`); `set_equation`
+ adds or changes one, in every configuration by default, solves and
+ rebuilds, and gives the new value. An expression SolidWorks can't use
+ fails as `equation_refused` and changes nothing. Named configurations
+ are set one at a time; the reply's `values` gives each one's value. Demo:
+ one variable sizes a steel combination wrench (13, 19 and 8 mm, 27
+ equations) whose handle is lettered with its own size, on the demos page
+ and in the README.
+- **`add_sketch_text`**: writes text in the open sketch at a height, and
+ with `center_at` centres it on a point (measured from the text's own
+ edges, since SolidWorks' alignment doesn't centre it). The text can show
+ a custom property (`$PRP:"Name"`), so an equation-driven part can carry
+ its size; cut or extrude it like any sketch.
+- **`set_sketch_text`**: rewrites the text in a named sketch and rebuilds,
+ giving the text before and after. SolidWorks doesn't redraw sketch text
+ when an equation changes the part; writing it again does. 145 tools.
+- **`add_ellipse` takes an `angle`**, the degrees its major axis is turned
+ from +x, and **an ellipse can be dimensioned**: `add_sketch_dimension`
+ with `major_axis` or `minor_axis` on an ellipse's `id` sizes that axis,
+ so an equation can drive it.
+- **`add_polygon` takes an `angle`**: the degrees its first corner is
+ turned from +x (0 by default), e.g. two hexagons 30° apart for a
+ 12-point opening.
+- **A polygon can be dimensioned**: a `diameter` dimension
+ (`add_sketch_dimension`) on a polygon's `id` sizes it by the circle drawn
+ inside it, across flats for a hexagon, so an equation can drive it.
- **`save_body_as_part` leaves no extra assembly open** (queue item 27,
#101): a new, unsaved assembly SolidWorks opens alongside Save Bodies is
closed, the part is made active again, and the reply's
@@ -191,6 +219,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
+- **`create_cut_extrude` with `both_directions` on a Blind cut** cut one way
+ only, so a slot meant to straddle its sketch plane came out beside it. It
+ is now a mid-plane cut, `depth` in total, as `create_extrusion` does.
- **`add_fillet` on the current selection** (empty `edge_names`, after
`select_face_edges`) built no fillet: reading the volume first rebuilt
the part, which cleared the selection. It no longer reads the volume in
diff --git a/README.md b/README.md
index dc3260db..0e403a90 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@
[](https://www.solidworks.com/)
[](https://codecov.io/gh/andrewbartels1/SolidworksMCP-python)
-Python MCP server for SolidWorks automation with 140 tools, plus an optional agent/prompt-testing layer for AI-assisted workflows.
+Python MCP server for SolidWorks automation with 145 tools, plus an optional agent/prompt-testing layer for AI-assisted workflows.
[](https://andrewbartels1.com/SolidworksMCP-python/progress/)
@@ -191,6 +191,7 @@ Each GIF is a live test driving SolidWorks 2026 through the MCP tools, with the
ISldWorks | 23 | 330 | 7.0%ActivateDoc3, CloseDoc, Frame, GetConfigurationNames, GetCurrentLanguage, GetDocuments, GetExecutablePath, GetExportFileData, GetMassProperties, GetMathUtility, GetOpenDocumentByName, GetProcessID, GetUserPreferenceStringValue, GetUserPreferenceToggle, NewAssembly, NewDocument, NewDrawing2, NewPart, OpenDoc6, RevisionNumber, RunMacro2, SetUserPreferenceIntegerValue, SetUserPreferenceToggle |
-IModelDoc2 | 79 | 758 | 10.4%AddConfiguration2, AddDiameterDimension2, AddDimension, AddDimension2, AddHorizontalDimension2, AddRadialDimension2, AddRelation, AddVerticalDimension2, ClearSelection2, CreateArc, CreateCenterLine, CreateCircleByRadius, CreateCircularSketchStepAndRepeat, CreateEllipse, CreateLine, CreateLinearSketchStepAndRepeat, CreatePoint, DeleteConfiguration2, EditDelete, EditRebuild3, EditSketch, EditSuppress2, EditUndo, EditUndo2, EditUnsuppress2, FeatureByPositionReverse, FeatureChamferType, FeatureCut3, FeatureCut4, FeatureFillet3, FeatureRevolve2, FirstFeature, ForceRebuild3, GetActiveConfiguration, GetActiveSketch2, GetConfigurationNames, GetDependencies2, GetFeatureCount, GetLineCount, GetMassProperties, GetNext, GetPathName, GetSaveFlag, GetTitle, GetType, GetUserPreferenceStringValue, GetUserPreferenceToggle, GraphicsRedraw2, InsertAxis2, InsertDatumTag2, InsertFeatureShell, InsertGtol, InsertNote, InsertProtrusionBlend2, InsertProtrusionSwept4, InsertRib, InsertSketch, InsertSketchForEdgeFlange, Lock, Parameter, Save, Save3, SaveAs, SaveAs2, SaveAs3, SaveBMP, Select, SetBendState, SetSaveFlag, SetUserPreferenceIntegerValue, SetUserPreferenceToggle, ShowConfiguration2, ShowNamedView2, SketchAddConstraints, SketchMirror, SketchOffset2, SketchUseEdge, ViewZoomtofit, ViewZoomtofit2 |
+IModelDoc2 | 81 | 758 | 10.7%AddConfiguration2, AddDiameterDimension2, AddDimension, AddDimension2, AddHorizontalDimension2, AddRadialDimension2, AddRelation, AddVerticalDimension2, ClearSelection2, CreateArc, CreateCenterLine, CreateCircleByRadius, CreateCircularSketchStepAndRepeat, CreateEllipse, CreateLine, CreateLinearSketchStepAndRepeat, CreatePoint, DeleteConfiguration2, EditDelete, EditRebuild3, EditSketch, EditSuppress2, EditUndo, EditUndo2, EditUnsuppress2, FeatureByPositionReverse, FeatureChamferType, FeatureCut3, FeatureCut4, FeatureFillet3, FeatureRevolve2, FirstFeature, ForceRebuild3, GetActiveConfiguration, GetActiveSketch2, GetConfigurationNames, GetDependencies2, GetEquationMgr, GetFeatureCount, GetLineCount, GetMassProperties, GetNext, GetPathName, GetSaveFlag, GetTitle, GetType, GetUserPreferenceStringValue, GetUserPreferenceToggle, GraphicsRedraw2, InsertAxis2, InsertDatumTag2, InsertFeatureShell, InsertGtol, InsertNote, InsertProtrusionBlend2, InsertProtrusionSwept4, InsertRib, InsertSketch, InsertSketchForEdgeFlange, InsertSketchText, Lock, Parameter, Save, Save3, SaveAs, SaveAs2, SaveAs3, SaveBMP, Select, SetBendState, SetSaveFlag, SetUserPreferenceIntegerValue, SetUserPreferenceToggle, ShowConfiguration2, ShowNamedView2, SketchAddConstraints, SketchMirror, SketchOffset2, SketchUseEdge, ViewZoomtofit, ViewZoomtofit2 |
IModelDocExtension | 18 | 337 | 5.3%AddDimension, CreateMassProperty, CreateMeasure, CustomPropertyManager, DeleteSelection2, GetAnnotations, GetMassProperties, GetUserPreferenceInteger, GetUserPreferenceToggle, GetWhatsWrong, GetWhatsWrongCount, InsertBomTable4, SaveAs, SaveAs2, SaveAs3, SelectByID2, SetUserPreferenceInteger, SetUserPreferenceToggle |
IPartDoc | 12 | 167 | 7.2%ExportToDWG2, FeatureByName, FeatureExtrusion2, FeatureExtrusion3, FeatureExtrusionThin2, FeatureRevolve2, FirstFeature, GetBodies2, GetMaterialPropertyName2, GetPartBox, InsertMirrorFeature, SetMaterialPropertyName2 |
IAssemblyDoc | 11 | 198 | 5.6%AddComponent4, AddComponent5, AddMate5, CompConfigProperties5, FeatureByName, FixComponent, GetBox, GetComponentByName, GetComponentCount, GetComponents, UnfixComponent |
@@ -161,7 +166,7 @@
ISelectionMgr | 4 | 61 | 6.6%CreateSelectData, GetSelectedObject6, GetSelectedObjectCount2, GetSelectedObjectType3 |
IComponent2 | 20 | 147 | 13.6%CustomPropertyManager, FeatureByName, FirstFeature, GetBodies2, GetBox, GetChildren, GetConfigurationNames, GetID, GetModelDoc2, GetPathName, GetSuppression2, GetType, GetXform, IsEnvelope, IsFixed, IsSuppressed, Select, Select2, Select4, SetSuppression2 |
IFeature | 22 | 115 | 19.1%GetBox, GetChildren, GetDefinition, GetErrorCode2, GetFaces, GetFirstDisplayDimension, GetFirstSubFeature, GetID, GetNameForSelection, GetNextDisplayDimension, GetNextFeature, GetNextSubFeature, GetParents, GetSpecificFeature2, GetTypeName2, IsSuppressed, IsSuppressed2, ModifyDefinition, Parameter, Select, Select2, SetSuppression2 |
-ISketch | 5 | 102 | 4.9%AutoDimension, GetLineCount, GetSketchContours, GetSketchPoints2, GetSketchSegments |
+ISketch | 6 | 102 | 5.9%AutoDimension, GetLineCount, GetSketchContours, GetSketchPoints2, GetSketchSegments, GetSketchTextSegments |
diff --git a/docs/assets/progress/tool-list-size.md b/docs/assets/progress/tool-list-size.md
index 56f813ec..ba7076cb 100644
--- a/docs/assets/progress/tool-list-size.md
+++ b/docs/assets/progress/tool-list-size.md
@@ -1,11 +1,11 @@
| `SOLIDWORKS_MCP_TOOLSETS` | `SOLIDWORKS_MCP_TOOL_MODE` | Tools listed | Size | Tokens (estimate) | Of the full list |
| --- | --- | ---: | ---: | ---: | ---: |
-| `all` | `list` | 140 | 227 KB | 58,160 | 100% |
-| `core` | `list` | 100 | 151 KB | 38,717 | 67% |
-| `drawing` | `list` | 21 | 38 KB | 9,616 | 17% |
+| `all` | `list` | 145 | 235 KB | 60,126 | 100% |
+| `core` | `list` | 105 | 159 KB | 40,683 | 68% |
+| `drawing` | `list` | 21 | 38 KB | 9,616 | 16% |
| `automation` | `list` | 3 | 6 KB | 1,556 | 3% |
| `vba` | `list` | 10 | 17 KB | 4,356 | 7% |
| `docs` | `list` | 6 | 15 KB | 3,914 | 7% |
-| `core,drawing` | `list` | 121 | 189 KB | 48,333 | 83% |
+| `core,drawing` | `list` | 126 | 196 KB | 50,299 | 84% |
| `all` | `search` | 4 | 4 KB | 908 | 2% |
| `core` | `search` | 4 | 4 KB | 908 | 2% |
diff --git a/docs/demos.md b/docs/demos.md
index b8129df2..72c9ccac 100644
--- a/docs/demos.md
+++ b/docs/demos.md
@@ -917,6 +917,84 @@ deletes the hole it had started, and the plate's volume doesn't change.
7. `pattern_circular({"features": ["Ø6.0 (6) Diameter Hole1"], "axis": "Axis1", "count": 6})`
8. `create_hole({"face_point": [0, 15, 22], "hole_type": "counterbore", "size": "M6", "end_condition": "blind", "depth": 8, "positions": [[0, 20, -22]]})`, refused on purpose
+## Equations {#equations}
+
+Source: [`tests/live/test_live_sw_equations_wrench.py`](https://github.com/andrewbartels1/SolidworksMCP-python/blob/main/tests/live/test_live_sw_equations_wrench.py).
+
+### One variable sizes a combination wrench {#wrench}
+
+
+
+> *Example prompt:* Make a 13 mm combination wrench in chrome-vanadium
+> steel: an open end with its jaw at 15° and a curved jaw bottom, a raised
+> 12-point box end, a flat handle, and fillets where the heads meet it.
+> Letter "solidworksmcp-python" and the size into both faces of the handle.
+> Drive every size from one global variable, `Size`, so I can make a 19 mm
+> one by changing one number, then add an 8 mm size as its own
+> configuration.
+
+**What it shows.** A combination wrench in the usual layout (ISO 3318 /
+DIN 3113), modelled from photos of a real one: an open end with its jaw at
+15° and a curved jaw bottom, a 12-point box end tilted 15° and raised, a
+flat handle, fillets where both heads meet the handle, and 1.8159 (51CrV4)
+chrome-vanadium steel from the DIN library. It is built first at fixed
+13 mm sizes. Then `set_equation` adds a global variable `Size` = 13mm, six
+variables computed from it, and an equation on each dimension that sizes
+the wrench, including the jaw's ellipse, the ring's lift and the fillet
+radii: 25 equations.
+
+| Variable | Expression | Drives |
+| --- | --- | --- |
+| `Size` | 13mm | the jaw's width; both hexagons of the 12-point opening, across flats; the ellipse, ring lift and fillets as multiples of it |
+| `Length` | `"Size" * 12.8` | the handle bar's length and the box end's pattern spacing (head centre to head centre) |
+| `OpenHead` | `"Size" * 2.0` | the open end's diameter |
+| `BoxHead` | `"Size" * 1.55` | the box end's diameter |
+| `HeadT` | `"Size" * 0.5` | both heads' thickness |
+| `HandleW` | `"Size" * 0.9` | the handle's width (the round bar it is cut from) |
+| `HandleT` | `"Size" * 0.3` | the handle's thickness (two planes `"HandleT" / 2` either side of the Top Plane) |
+
+**Lettering that reads its own size.** `add_sketch_text` writes
+`solidworksmcp-python $PRP:"WrenchSize" mm` on each face of the handle,
+centred on a point; the custom property `WrenchSize` is linked to a
+dimension the equations set to `Size`, and the part shows whole
+millimetres, so the handle reads "13 mm". The text is cut 0.3 mm deep on a
+spare block off the open end and a linear pattern moves it onto the
+handle's middle; two more equations keep it there at any size
+(`"Size" * 6.48 + 190mm`) and keep the block as thick as the handle. The
+block is then cut away. SolidWorks doesn't redraw sketch text when an
+equation changes the part, so after each size change `set_sketch_text`
+writes the text again, and the handle reads 19 mm, then 8 mm.
+
+Changing `Size` to 19mm is one call, and the whole wrench regrows. Setting
+it to 8mm with `configurations: ["8 mm"]` changes only that configuration,
+so the part holds both sizes. After each change, `verify_model` checks the
+overall size against the hand calculation:
+
+| `Size` | Expected size, mm (x, y, z) | Measured |
+| --- | --- | --- |
+| 13 mm, as built | 189.09 x 11.49 x 26 | pass |
+| 19 mm, Default | 276.37 x 16.8 x 38 | 276.366 x 16.7985 x 38.0 |
+| 8 mm, configuration "8 mm" | 116.36 x 7.07 x 16 | 116.3646 x 7.0731 x 16.0 |
+
+The last call fails **on purpose**: `"Nut" * 2` names a variable that
+doesn't exist, so SolidWorks refuses it (`equation_refused`), the equation
+keeps its old text and the wrench stays at 19 mm.
+
+**Tool calls**
+
+1. `create_part`, then the handle: a Right-plane circle sized with `add_sketch_dimension({"dimension_type": "diameter"})`, `create_extrusion` along x, flattened by two `create_reference_plane` offsets and a `ThroughAll` cut from each
+2. The box end at the origin: a circle extruded both ways on a plane tilted 15° and lifted `0.13 x Size`, then two `add_polygon({"sides": 6})` cuts, the second with `"angle": 30`, each sized across flats with a `diameter` dimension
+3. `create_axis({"reference": "x"})`, then `pattern_linear` of the box-end features to the handle's far end, and a clearance cut that removes the pattern's seed
+4. The open end at the origin: a Top-plane circle, `create_extrusion({"both_directions": true})`
+5. The jaw: a rectangle on a plane at 15°, `create_cut_extrude({"both_directions": true})`, then the curved bottom: `add_ellipse` with an `angle`, its axes sized with `add_sketch_dimension({"dimension_type": "major_axis"})` and `minor_axis`, cut through
+6. `add_fillet` where both heads meet the handle, faces then sides, and `set_material({"material_name": "1.8159 (51CrV4)", "database": "SolidWorks DIN Materials"})`
+7. `list_model_dimensions()` to find each dimension's full name
+8. `set_equation({"name": "Size", "expression": "13mm"})`, then the six variables, then one `set_equation` per dimension, then `list_equations()`
+9. The lettering: `set_custom_property` (`WrenchSize` linked to a Size dimension), `add_sketch_text({"text": "solidworksmcp-python $PRP:\"WrenchSize\" mm", "height": 3.5, "center_at": [...]})` on each face of a spare block, a 0.3 mm cut, `pattern_linear` onto the handle's middle, two `set_equation` calls, and a cut that removes the block
+10. `set_equation({"name": "Size", "expression": "19mm"})`, `verify_model`, then `set_sketch_text` on both lettering sketches
+11. `create_configuration({"name": "8 mm"})`, `set_equation({"name": "Size", "expression": "8mm", "configurations": ["8 mm"]})`, `activate_configuration({"name": "8 mm"})`, `verify_model`, `set_sketch_text`
+12. `activate_configuration({"name": "Default"})`, `set_sketch_text`, then `set_equation({"name": "Size", "expression": "\"Nut\" * 2"})`, refused on purpose
+
## Run a demo yourself
The demos need Windows, SolidWorks open and idle, and the project's `.venv`.
diff --git a/docs/index.md b/docs/index.md
index 3a71a2a1..0b990e1a 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -13,7 +13,7 @@
An MCP server that lets AI agents drive SolidWorks: describe a part, and the agent builds it with the server's 123 tools and checks what SolidWorks reports back.
-🚀 **140 Tools** | 🤖 **Agent-Ready Workflows** | ⚡ **Automatic COM/VBA Routing** | 🧪 **Schema-Validated Prompt Runs**
+🚀 **145 Tools** | 🤖 **Agent-Ready Workflows** | ⚡ **Automatic COM/VBA Routing** | 🧪 **Schema-Validated Prompt Runs**
## Overview
@@ -43,7 +43,7 @@ The project emphasizes an inspect -> classify -> delegate loop instead of blind
### 2) Broad Tool Surface with Practical Coverage
-- 140 tools across modeling, sketching, drawing, engineering data, analysis, export, automation, templates, macros, and docs discovery
+- 145 tools across modeling, sketching, drawing, engineering data, analysis, export, automation, templates, macros, and docs discovery
- one server API surface for both simple operations and advanced workflows
### 3) Reliable Execution Path for Complex Operations
diff --git a/docs/llms.txt b/docs/llms.txt
index 3f365e11..ac508eb1 100644
--- a/docs/llms.txt
+++ b/docs/llms.txt
@@ -36,8 +36,9 @@
## Tool Catalog
-- [Tool Catalog — All 140 Tools](https://andrewbartels1.com/SolidworksMCP-python/user-guide/tool-catalog/): This reference documents all **140 MCP tools** registered by the SolidWorks MCP server. Each section covers one functional category with parameter tables and copy-paste sample calls.
+- [Tool Catalog — All 145 Tools](https://andrewbartels1.com/SolidworksMCP-python/user-guide/tool-catalog/): This reference documents all **140 MCP tools** registered by the SolidWorks MCP server. Each section covers one functional category with parameter tables and copy-paste sample calls.
- [Modeling Tools](https://andrewbartels1.com/SolidworksMCP-python/user-guide/tool-catalog/modeling/): Create and manipulate SolidWorks parts, assemblies, and drawings. These are the foundational tools for any CAD workflow — opening files, creating features (extrude, revolve), and querying/setting driven dimensions.
+- [Equation Tools](https://andrewbartels1.com/SolidworksMCP-python/user-guide/tool-catalog/equations/): Read, add, change and delete a part's or assembly's equations and global variables, so one value drives several dimensions and the model stays consistent when it changes.
- [Sketching Tools](https://andrewbartels1.com/SolidworksMCP-python/user-guide/tool-catalog/sketching/): Build 2-D sketch geometry (lines, circles, arcs, splines, polygons) and apply geometric constraints and driven dimensions. Sketches are the prerequisite for every extrusion, revolve, sweep, and loft feature.
- [Drawing Tools](https://andrewbartels1.com/SolidworksMCP-python/user-guide/tool-catalog/drawing/): Create and edit 2-D technical drawings: views, section and detail views, notes, centre marks, dimensions by hand or automatically, the title block and sheet format, and a check that the drawing is complete before it is exported. Every position is in sheet millimetres from the sheet's lower-left corner.
- [Drawing Analysis Tools](https://andrewbartels1.com/SolidworksMCP-python/user-guide/tool-catalog/drawing-analysis/): Compare two versions of a drawing file on disk. A check of a drawing's contents (`check_drawing`) is planned in the drawing pack.
diff --git a/docs/user-guide/tool-catalog/equations.md b/docs/user-guide/tool-catalog/equations.md
new file mode 100644
index 00000000..2a42b913
--- /dev/null
+++ b/docs/user-guide/tool-catalog/equations.md
@@ -0,0 +1,77 @@
+# Equation Tools
+
+Read, add, change and delete a part's or assembly's equations and global variables, so one value drives several dimensions and the model stays consistent when it changes.
+
+> **Prerequisite:** an open part or assembly. A number with no unit is in the document's units; write `60mm` or `30deg` to be sure.
+
+**Total tools in this category: 3**
+
+A global variable is a named value (`"Width" = 60mm`). A dimension equation sets a dimension from an expression (`"D1@Sketch1" = "Width" / 2`), using the dimension's `full_name` from `list_model_dimensions`. Change `Width` and every dimension that uses it follows on the next rebuild, which `set_equation` does for you.
+
+---
+
+### `list_equations`
+
+List the active part's or assembly's equations and global variables, with their values.
+
+Each row has `index`, `name`, `expression`, `kind` (`global_variable`, `dimension` or `other`, such as a suppression equation) and `value` (solved, in the document's units; null when SolidWorks has none).
+
+**Prerequisite:** Active part or assembly.
+
+**Parameters:** none.
+
+**Sample call:**
+
+```json
+{}
+```
+
+---
+
+### `set_equation`
+
+Add or change an equation or global variable, so one value drives others.
+
+A `name` with `@` is a dimension of the active document; any other name is a global variable. If the model already has an equation for `name` (case doesn't matter), its expression is replaced; otherwise one is added. The model is solved and rebuilt, and the reply gives the equation, its `value`, `action` (`added` or `changed`) and the `configurations` it applies in. With configuration names, each is made active in turn and set for that configuration only, then the configuration that was active is shown again; the reply's `expression` and `value` are what was set, and `values` gives the solved value in each named configuration. An expression SolidWorks can't use, such as one naming a variable that doesn't exist, fails as `equation_refused` and changes nothing.
+
+It applies in every configuration by default, as SolidWorks' Equations dialog does; `set_dimension` defaults to the active one only.
+
+See it drive a whole part: [one variable sizes a combination wrench](../../demos.md#wrench).
+
+**Prerequisite:** Active part or assembly; for a dimension, the dimension.
+
+**Parameters:**
+
+| Parameter | Type | Required | Default | Description |
+|-----------|------|----------|---------|-------------|
+| `name` | `str` | ✅ | | A global variable (e.g. 'Width'), or a dimension of the active document as list_model_dimensions names it (e.g. 'D1@Sketch1'); no quotes |
+| `expression` | `str` | ✅ | | The right-hand side, e.g. '60mm' or '"Width" / 2'; names in double quotes |
+| `configurations` | `str \| list[str]` | — | `"all"` | 'all', 'this' (the active configuration), or configuration names from `list_configurations` |
+
+**Sample call:**
+
+```json
+{"name": "D1@Sketch1", "expression": "\"Width\" / 2"}
+```
+
+---
+
+### `delete_equation`
+
+Delete an equation or global variable of the active part or assembly, by name.
+
+A dimension the equation drove keeps its last value. An equation that used a deleted global variable stops solving, so check `list_equations` afterwards.
+
+**Prerequisite:** Active part or assembly with that equation.
+
+**Parameters:**
+
+| Parameter | Type | Required | Default | Description |
+|-----------|------|----------|---------|-------------|
+| `name` | `str` | ✅ | | The equation's name as list_equations gives it, e.g. 'Width' |
+
+**Sample call:**
+
+```json
+{"name": "Width"}
+```
diff --git a/docs/user-guide/tool-catalog/index.md b/docs/user-guide/tool-catalog/index.md
index c7d3f013..8fd4ef6d 100644
--- a/docs/user-guide/tool-catalog/index.md
+++ b/docs/user-guide/tool-catalog/index.md
@@ -1,4 +1,4 @@
-# Tool Catalog — All 140 Tools
+# Tool Catalog — All 145 Tools
This reference documents all **140 MCP tools** registered by the SolidWorks MCP server.
Each section covers one functional category with parameter tables and copy-paste sample calls.
@@ -10,7 +10,8 @@ Each section covers one functional category with parameter tables and copy-paste
| Category | Count | Description |
|----------|-------|-------------|
| [Modeling Tools](modeling.md) | 42 | Parts, assemblies and drawings: extrusions, revolves, sweeps, lofts, cuts, Hole Wizard holes, cosmetic threads, shells, drafts, ribs, sheet metal (flanges, bends, the flat pattern), fillets, chamfers, patterns, reference geometry, mates, dimensions, feature renaming and the document unit system. |
-| [Sketching Tools](sketching.md) | 19 | Sketches on a plane or a flat face: lines, circles, arcs, splines, polygons, relations, dimensions, offsets, mirrors and patterns. |
+| [Equation Tools](equations.md) | 3 | Equations and global variables: one value driving several dimensions, in all configurations or chosen ones. |
+| [Sketching Tools](sketching.md) | 21 | Sketches on a plane or a flat face: lines, circles, arcs, splines, polygons, text, relations, dimensions, offsets, mirrors and patterns. |
| [Drawing Tools](drawing.md) | 13 | Drawings from a model: standard, section and detail views, dimensions, notes, centre marks, the sheet format and title block, and a drawing check. |
| [Drawing Analysis Tools](drawing-analysis.md) | 1 | Compare two versions of a drawing file. |
| [Drawing Automation Tools](drawing-automation.md) | 7 | Model dimensions laid out without overlaps, datum tags, tolerances, BOM tables, sheet scale and complete A3 drawings. |
@@ -21,7 +22,7 @@ Each section covers one functional category with parameter tables and copy-paste
| [Automation Tools](automation.md) | 1 | A VBA macro skeleton for a described task. |
| [VBA Generation Tools](vba-generation.md) | 10 | VBA macro text for steps the tools don't cover. |
| [Template Management Tools](template-management.md) | 1 | Compare two template files. |
-| [Macro Recording Tools](macro-recording.md) | 1 | Run a binary SolidWorks macro (`.swp`). |
+| [Macro Recording Tools](macro-recording.md) | 1 | Run a SolidWorks macro file, or VBA source when the server allows it. |
| [Docs Discovery Tools](docs-discovery.md) | 6 | Look up SolidWorks API interfaces, member signatures and enum values, read from the installed SolidWorks type libraries. |
| [Server Admin Tools](server-admin.md) | 1 | Reset the circuit breaker the server uses to pause a failing operation. |
diff --git a/docs/user-guide/tool-catalog/modeling.md b/docs/user-guide/tool-catalog/modeling.md
index 77e6175d..bd70f77e 100644
--- a/docs/user-guide/tool-catalog/modeling.md
+++ b/docs/user-guide/tool-catalog/modeling.md
@@ -746,7 +746,7 @@ Cut material from the active part with a closed sketch profile: holes, slots, wi
| `draft_angle` | `float` | — | `0.0` | Draft angle in degrees |
| `reverse_direction` | `bool` | — | `false` | Cut against the sketch normal instead of along it. Usually not needed: if the requested direction finds no material, the cut is retried the other way and the reply sets direction_flipped |
| `end_condition` | `str` | — | `"Blind"` | 'Blind' (cut 'depth' mm), 'ThroughAll' (through the body, one way) or 'ThroughAllBoth' (through the body both ways, for a sketch inside the body) |
-| `both_directions` | `bool` | — | `false` | With end_condition 'ThroughAll', cut through the body both ways (same as 'ThroughAllBoth') |
+| `both_directions` | `bool` | — | `false` | Cut both ways from the sketch plane: with 'Blind', a mid-plane cut 'depth' mm in total, centred on the plane (a slot either side of it); with 'ThroughAll', through the body both ways (same as 'ThroughAllBoth') |
| `sketch_name` | `str?` | — | `null` | Sketch to cut from, e.g. 'Sketch3'. If omitted, the sketch most recently created/exited in this session is used, but only if it still exists in the model — there is no other fallback. Pass this explicitly whenever more than one unconsumed sketch could exist, or after any operation that might have changed the active sketch. |
**Sample call:**
diff --git a/docs/user-guide/tool-catalog/sketching.md b/docs/user-guide/tool-catalog/sketching.md
index 3916911f..4e063d8f 100644
--- a/docs/user-guide/tool-catalog/sketching.md
+++ b/docs/user-guide/tool-catalog/sketching.md
@@ -258,12 +258,14 @@ Draw a centreline (construction line) in the open sketch, in mm.
Draw a regular polygon (e.g. a hexagon) in the open sketch from its centre, radius and number of sides.
+`angle` turns it: the degrees its first corner is turned from +x (0 by default), so two hexagons 30° apart make a 12-point opening. A `diameter` dimension (`add_sketch_dimension`) on the polygon's `id` sizes it by the circle drawn inside it, so a hexagon is sized across flats and an equation can drive it.
+
**Prerequisite:** Active sketch edit mode
**Sample call:**
```json
-{}
+{"center_x": 0, "center_y": 0, "radius": 6.5, "sides": 6, "angle": 30}
```
---
@@ -282,6 +284,57 @@ Draw an ellipse in the open sketch from its centre and axis lengths, in mm.
---
+### `add_sketch_text`
+
+Write text in the open sketch, at a point or centred on one, to deboss or emboss it.
+
+**Prerequisite:** Active sketch edit mode. To read from a face's own side (an underside), open the sketch on that face (`create_sketch` with `face_point`).
+
+**SolidWorks automation note:** `IModelDoc2.InsertSketchText` at the point, with normal letter spacing; the letter height is the text format's `CharHeight`. `center_at` measures the text from its edges (`ISketchText.GetEdges2`) and moves it (`SetCoordinates`) so its middle is on that model point. `$PRP:"name"` in the text shows a custom property: set one to a dimension's name in quotes (`set_custom_property`, value `"D1@Sketch3"`) and the text follows that dimension, through any equation that drives it. On SolidWorks 2026 a line selected first didn't lay the text along it, centre alignment didn't centre it, and mirrored text couldn't be cut, so the tool uses none of them.
+
+**Parameters:**
+
+| Parameter | Type | Required | Default | Description |
+|-----------|------|----------|---------|-------------|
+| `text` | `str` | ✅ | | The text; `$PRP:"name"` shows a custom property |
+| `x` | `float` | — | `0` | Start x in mm, sketch coordinates |
+| `y` | `float` | — | `0` | Start y (baseline) in mm |
+| `height` | `float` | — | `3.5` | Letter height in mm |
+| `center_at` | `list[float]?` | — | `None` | Model point `[x, y, z]` in mm for the text's middle |
+
+**Sample call:**
+
+```json
+{"text": "solidworksmcp-python $PRP:\"WrenchSize\" mm", "height": 3.5, "center_at": [85, 1.95, 0]}
+```
+
+Then `create_cut_extrude` on the sketch with a small `depth` debosses it.
+
+---
+
+### `set_sketch_text`
+
+Rewrite the text in a sketch and rebuild, so debossed lettering shows it.
+
+**Prerequisite:** A part with a sketch holding text from `add_sketch_text`
+
+**SolidWorks automation note:** SolidWorks doesn't redraw sketch text when the model rebuilds, not even a `$PRP:` link to a dimension an equation changed (SolidWorks 2026: four rebuild modes, saving, and writing `ISketchText.Text` outside the sketch all left the old lettering). The tool opens the sketch (`EditSketch`), writes `Text`, closes it and rebuilds; written that way, a `$PRP:` link is read again.
+
+**Parameters:**
+
+| Parameter | Type | Required | Default | Description |
+|-----------|------|----------|---------|-------------|
+| `sketch_name` | `str` | ✅ | | The sketch, e.g. `Sketch12` |
+| `text` | `str` | ✅ | | The new text; the same `$PRP:"name"` text re-reads the link |
+
+**Sample call:**
+
+```json
+{"sketch_name": "Sketch12", "text": "solidworksmcp-python $PRP:\"WrenchSize\" mm"}
+```
+
+---
+
### `add_sketch_constraint`
Add a geometric relation between sketch entities: horizontal, vertical, parallel, perpendicular, tangent, coincident, concentric, equal, symmetric, collinear or fix.
diff --git a/docs/user-guide/tools-overview.md b/docs/user-guide/tools-overview.md
index e0067971..cd3c5fac 100644
--- a/docs/user-guide/tools-overview.md
+++ b/docs/user-guide/tools-overview.md
@@ -55,13 +55,21 @@ These read SolidWorks' installed files and never start it
[**42 tools available** :octicons-arrow-right-24:](tool-catalog/modeling.md)
+- :material-function-variant:{ .lg .middle } **Equation Tools**
+
+ ---
+
+ Equations and global variables: one value drives several dimensions, so the part stays consistent when it changes.
+
+ [**3 tools available** :octicons-arrow-right-24:](tool-catalog/equations.md)
+
- :material-pencil:{ .lg .middle } **Sketching Tools**
---
Sketches on a plane or a flat face: lines, arcs, circles, rectangles, polygons, splines, relations, dimensions, offsets, mirrors, patterns and edges converted from the model.
- [**19 tools available** :octicons-arrow-right-24:](tool-catalog/sketching.md)
+ [**21 tools available** :octicons-arrow-right-24:](tool-catalog/sketching.md)
- :material-technical-draw:{ .lg .middle } **Drawing Tools**
@@ -117,7 +125,7 @@ These read SolidWorks' installed files and never start it
Open, save, switch and inspect documents; the feature tree, configurations and the current selection; Pack and Go.
- [**20 tools available** :octicons-arrow-right-24:](tool-catalog/file-management.md)
+ [**21 tools available** :octicons-arrow-right-24:](tool-catalog/file-management.md)
- :material-code-braces:{ .lg .middle } **VBA Generation**
@@ -177,7 +185,7 @@ These read SolidWorks' installed files and never start it
-**Total: 140 Tools**
+**Total: 145 Tools**
## Deprecated tools
diff --git a/mkdocs.yml b/mkdocs.yml
index cc202c32..d3e824e6 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -49,6 +49,7 @@ nav:
- Tool Catalog:
- All Tools: user-guide/tool-catalog/index.md
- Modeling: user-guide/tool-catalog/modeling.md
+ - Equations: user-guide/tool-catalog/equations.md
- Sketching: user-guide/tool-catalog/sketching.md
- Drawing: user-guide/tool-catalog/drawing.md
- Drawing Analysis: user-guide/tool-catalog/drawing-analysis.md
diff --git a/openspec/changes/equations-and-global-variables/.openspec.yaml b/openspec/changes/equations-and-global-variables/.openspec.yaml
new file mode 100644
index 00000000..bbe8b393
--- /dev/null
+++ b/openspec/changes/equations-and-global-variables/.openspec.yaml
@@ -0,0 +1,2 @@
+schema: spec-driven
+created: 2026-11-17
diff --git a/openspec/changes/equations-and-global-variables/design.md b/openspec/changes/equations-and-global-variables/design.md
new file mode 100644
index 00000000..c03b2592
--- /dev/null
+++ b/openspec/changes/equations-and-global-variables/design.md
@@ -0,0 +1,183 @@
+## Context
+
+SolidWorks keeps a document's equations in one ordered list
+(`IModelDoc2.GetEquationMgr()`), each a text like `"Width" = 60mm` or
+`"D1@Sketch1" = "Width" / 2`. Global variables are equations whose left
+side is a plain name; dimension equations name a dimension the way
+`list_model_dimensions` reports `full_name` (`D1@Sketch1`). The 2026 type
+library's `IEquationMgr` has `Add3(Index, Equation, Solve,
+WhichConfigurations, ConfigNames)`, `SetEquationAndConfigurationOption(
+Index, Equation, WhichConfigurations, ConfigNames)`, `Delete(Index)`,
+`GetCount()`, `EvaluateAll()`, and the indexed properties `Equation`,
+`Value` and `GlobalVariable`.
+
+## Goals / Non-Goals
+
+**Goals:** read, add, change and delete equations and global variables,
+in chosen configurations, with the solved values in the reply.
+
+**Non-Goals:** linking equations to an external file
+(`LinkToFile`, `UpdateValuesFromExternalEquationFile`); suppression
+equations' own tool; equation folders and solve order
+(`AutomaticSolveOrder` stays as the document has it).
+
+## Decisions
+
+1. **Name and expression, not raw text.** The agent gives `name` and
+ `expression`; the server writes `"