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 | 89 | 758 | 11.7%AddConfiguration2, AddDiameterDimension2, AddDimension, AddDimension2, AddHorizontalDimension2, AddRadialDimension2, AddRelation, AddVerticalDimension2, ClearSelection2, Create3PointArc, CreateArc, CreateCenterLine, CreateCircleByRadius, CreateCircularSketchStepAndRepeat, CreateEllipse, CreateLine, CreateLinearSketchStepAndRepeat, CreatePoint, CreateTangentArc, DeleteConfiguration2, EditDelete, EditRebuild3, EditSketch, EditSuppress2, EditUndo, EditUndo2, EditUnsuppress2, FeatureByPositionReverse, FeatureChamferType, FeatureCut3, FeatureCut4, FeatureFillet3, FeatureRevolve2, FirstFeature, ForceRebuild3, GetActiveConfiguration, GetActiveSketch2, GetConfigurationNames, GetDependencies2, GetEquationMgr, GetFeatureCount, GetLineCount, GetMassProperties, GetModelViewNames, GetNext, GetPathName, GetSaveFlag, GetTitle, GetType, GetUserPreferenceStringValue, GetUserPreferenceToggle, GraphicsRedraw2, InsertAxis2, InsertDatumTag2, InsertFeatureShell, InsertGtol, InsertHelix, InsertNote, InsertProtrusionBlend2, InsertProtrusionSwept4, InsertRib, InsertScale, InsertSketch, InsertSketchForEdgeFlange, InsertSketchText, IsExploded, Lock, Parameter, Save, Save3, SaveAs, SaveAs2, SaveAs3, SaveBMP, Scale, Select, SetBendState, SetSaveFlag, SetUserPreferenceIntegerValue, SetUserPreferenceToggle, ShowConfiguration2, ShowNamedView2, SketchAddConstraints, SketchMirror, SketchOffset2, SketchTrim, SketchUseEdge, ViewZoomtofit, ViewZoomtofit2 |
-IModelDocExtension | 19 | 337 | 5.6%AddDimension, CreateMassProperty, CreateMeasure, CustomPropertyManager, DeleteSelection2, GetAnnotations, GetMassProperties, GetUserPreferenceInteger, GetUserPreferenceToggle, GetWhatsWrong, GetWhatsWrongCount, InsertBomTable4, IsExploded, SaveAs, SaveAs2, SaveAs3, SelectByID2, SetUserPreferenceInteger, SetUserPreferenceToggle |
+IModelDoc2 | 91 | 758 | 12.0%AddConfiguration2, AddDiameterDimension2, AddDimension, AddDimension2, AddHorizontalDimension2, AddRadialDimension2, AddRelation, AddVerticalDimension2, ClearSelection2, Create3PointArc, CreateArc, CreateCenterLine, CreateCircleByRadius, CreateCircularSketchStepAndRepeat, CreateEllipse, CreateLine, CreateLinearSketchStepAndRepeat, CreatePoint, CreateTangentArc, DeleteConfiguration2, EditDelete, EditRebuild3, EditSketch, EditSuppress2, EditUndo, EditUndo2, EditUnsuppress2, FeatureByPositionReverse, FeatureChamferType, FeatureCut3, FeatureCut4, FeatureFillet3, FeatureRevolve2, FirstFeature, ForceRebuild3, GetActiveConfiguration, GetActiveSketch2, GetConfigurationNames, GetDependencies2, GetEquationMgr, GetFeatureCount, GetLineCount, GetMassProperties, GetModelViewNames, GetNext, GetPathName, GetSaveFlag, GetTitle, GetType, GetUserPreferenceStringValue, GetUserPreferenceToggle, GraphicsRedraw2, Insert3DSketch, InsertAxis2, InsertCoordinateSystem, InsertDatumTag2, InsertFeatureShell, InsertGtol, InsertHelix, InsertNote, InsertProtrusionBlend2, InsertProtrusionSwept4, InsertRib, InsertScale, InsertSketch, InsertSketchForEdgeFlange, InsertSketchText, IsExploded, Lock, Parameter, Save, Save3, SaveAs, SaveAs2, SaveAs3, SaveBMP, Scale, Select, SetBendState, SetSaveFlag, SetUserPreferenceIntegerValue, SetUserPreferenceToggle, ShowConfiguration2, ShowNamedView2, SketchAddConstraints, SketchMirror, SketchOffset2, SketchTrim, SketchUseEdge, ViewZoomtofit, ViewZoomtofit2 |
+IModelDocExtension | 22 | 337 | 6.5%AddDimension, CreateMassProperty, CreateMeasure, CustomPropertyManager, DeleteSelection2, GetAnnotations, GetCoordinateSystemTransformByName, GetMassProperties, GetSectionProperties2, GetUserPreferenceInteger, GetUserPreferenceToggle, GetWhatsWrong, GetWhatsWrongCount, InsertBomTable4, IsExploded, RemoveMaterialProperty, SaveAs, SaveAs2, SaveAs3, SelectByID2, SetUserPreferenceInteger, SetUserPreferenceToggle |
IPartDoc | 16 | 167 | 9.6%CreateExplodedView, ExportToDWG2, FeatureByName, FeatureExtrusion2, FeatureExtrusion3, FeatureExtrusionThin2, FeatureRevolve2, FirstFeature, GetBodies2, GetExplodedViewNames, GetMaterialPropertyName2, GetPartBox, InsertCombineFeature, InsertMirrorFeature, SetMaterialPropertyName2, ShowExploded |
IAssemblyDoc | 19 | 198 | 9.6%AddComponent4, AddComponent5, AddMate5, AutoExplode, CompConfigProperties5, CreateExplodedView, FeatureByName, FixComponent, GetBox, GetComponentByName, GetComponentCount, GetComponents, GetExplodedViewNames, MirrorComponents3, ReplaceComponents2, SetComponentTransparent, ShowExploded, ShowExploded2, UnfixComponent |
IDrawingDoc | 18 | 272 | 6.6%ActivateView, AutoBalloon5, AutoDimension, Create1stAngleViews2, Create3rdAngleViews2, CreateAutoBalloonOptions, CreateDetailViewAt4, CreateDrawViewFromModelView3, CreateSectionViewAt5, EditSheet, EditSketch, EditTemplate, FeatureByName, GetCurrentSheet, GetFirstView, GetViews, InsertModelAnnotations3, SetupSheet5 |
-IFeatureManager | 34 | 268 | 12.7%CreateCustomBendAllowance, CreateDefinition, CreateFeature, CreateSaveBodyFeature, FeatureCircularPattern5, FeatureCut3, FeatureCut4, FeatureExtrusion2, FeatureExtrusion3, FeatureExtrusionThin2, FeatureFillet3, FeatureLinearPattern5, FeatureRevolve2, GetFeatureCount, GetFlatPatternFolder, HoleWizard5, InsertCombineFeature, InsertCosmeticThread3, InsertCutSwept5, InsertDeleteBody2, InsertFeatureChamfer, InsertMirrorFeature, InsertMoveCopyBody2, InsertMultiFaceDraft, InsertProtrusionBlend2, InsertProtrusionSwept4, InsertRefPlane, InsertReferencePoint, InsertRib, InsertScale, InsertSheetMetalBaseFlange2, InsertSheetMetalEdgeFlange2, PostSplitBody2, PreSplitBody2 |
-ISketchManager | 23 | 83 | 27.7%Create3PointArc, CreateArc, CreateCenterLine, CreateCenterRectangle, CreateChamfer, CreateCircleByRadius, CreateCircularSketchStepAndRepeat, CreateCornerRectangle, CreateEllipse, CreateFillet, CreateLine, CreateLinearSketchStepAndRepeat, CreatePoint, CreatePolygon, CreateSketchSlot, CreateSpline2, CreateTangentArc, InsertSketch, SketchExtend, SketchOffset2, SketchTrim, SketchUseEdge, SketchUseEdge3 |
+IFeatureManager | 37 | 268 | 13.8%CreateCustomBendAllowance, CreateDefinition, CreateFeature, CreateSaveBodyFeature, FeatureCircularPattern5, FeatureCut3, FeatureCut4, FeatureExtrusion2, FeatureExtrusion3, FeatureExtrusionThin2, FeatureFillet3, FeatureLinearPattern5, FeatureRevolve2, GetFeatureCount, GetFlatPatternFolder, HoleWizard5, InsertCenterOfMass, InsertCombineFeature, InsertCoordinateSystem, InsertCosmeticThread3, InsertCutSwept5, InsertDeleteBody2, InsertFeatureChamfer, InsertGlobalBoundingBox, InsertMirrorFeature, InsertMoveCopyBody2, InsertMultiFaceDraft, InsertProtrusionBlend2, InsertProtrusionSwept4, InsertRefPlane, InsertReferencePoint, InsertRib, InsertScale, InsertSheetMetalBaseFlange2, InsertSheetMetalEdgeFlange2, PostSplitBody2, PreSplitBody2 |
+ISketchManager | 24 | 83 | 28.9%Create3PointArc, CreateArc, CreateCenterLine, CreateCenterRectangle, CreateChamfer, CreateCircleByRadius, CreateCircularSketchStepAndRepeat, CreateCornerRectangle, CreateEllipse, CreateFillet, CreateLine, CreateLinearSketchStepAndRepeat, CreatePoint, CreatePolygon, CreateSketchSlot, CreateSpline2, CreateTangentArc, Insert3DSketch, InsertSketch, SketchExtend, SketchOffset2, SketchTrim, SketchUseEdge, SketchUseEdge3 |
ISelectionMgr | 4 | 61 | 6.6%CreateSelectData, GetSelectedObject6, GetSelectedObjectCount2, GetSelectedObjectType3 |
-IComponent2 | 21 | 147 | 14.3%CustomPropertyManager, FeatureByName, FirstFeature, GetBodies2, GetBox, GetChildren, GetConfigurationNames, GetConstrainedStatus, 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 |
+IComponent2 | 26 | 147 | 17.7%CustomPropertyManager, FeatureByName, FirstFeature, GetBodies2, GetBody, GetBox, GetChildren, GetConfigurationNames, GetConstrainedStatus, GetID, GetMaterialPropertyValues2, GetModelDoc2, GetPathName, GetSuppression2, GetType, GetXform, IsEnvelope, IsFixed, IsSuppressed, RemoveMaterialProperty, RemoveMaterialProperty2, Select, Select2, Select4, SetMaterialPropertyValues2, SetSuppression2 |
+IFeature | 27 | 115 | 23.5%GetBody, GetBox, GetChildren, GetDefinition, GetErrorCode2, GetFaces, GetFirstDisplayDimension, GetFirstSubFeature, GetID, GetMaterialPropertyValues2, GetNameForSelection, GetNextDisplayDimension, GetNextFeature, GetNextSubFeature, GetParents, GetSpecificFeature2, GetTypeName2, IsSuppressed, IsSuppressed2, ModifyDefinition, Parameter, RemoveMaterialProperty, RemoveMaterialProperty2, Select, Select2, SetMaterialPropertyValues2, SetSuppression2 |
ISketch | 7 | 102 | 6.9%AutoDimension, GetConstrainedStatus, GetLineCount, GetSketchContours, GetSketchPoints2, GetSketchSegments, GetSketchTextSegments |
diff --git a/docs/assets/progress/tool-list-size.md b/docs/assets/progress/tool-list-size.md
index b70f936b..d1721877 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` | 165 | 271 KB | 69,286 | 100% |
-| `core` | `list` | 124 | 193 KB | 49,382 | 71% |
-| `drawing` | `list` | 22 | 39 KB | 10,074 | 15% |
+| `all` | `list` | 171 | 279 KB | 71,512 | 100% |
+| `core` | `list` | 130 | 202 KB | 51,608 | 72% |
+| `drawing` | `list` | 22 | 39 KB | 10,074 | 14% |
| `automation` | `list` | 3 | 6 KB | 1,556 | 2% |
| `vba` | `list` | 10 | 17 KB | 4,356 | 6% |
-| `docs` | `list` | 6 | 15 KB | 3,916 | 6% |
-| `core,drawing` | `list` | 146 | 232 KB | 59,457 | 86% |
+| `docs` | `list` | 6 | 15 KB | 3,916 | 5% |
+| `core,drawing` | `list` | 152 | 241 KB | 61,682 | 86% |
| `all` | `search` | 4 | 4 KB | 908 | 1% |
| `core` | `search` | 4 | 4 KB | 908 | 1% |
diff --git a/docs/demos.md b/docs/demos.md
index 7cde1fc1..b75bef30 100644
--- a/docs/demos.md
+++ b/docs/demos.md
@@ -1162,6 +1162,73 @@ material orange.
6. `combine_bodies` subtract on each pair, `move_copy_body` the sphere's piece back by `[-100, 0, 0]`
7. `verify_model({"volume_mm3": 80755.2, "solid_body_count": 2})`
+## Colours and reference geometry {#appearance}
+
+Source: [`tests/live/test_live_sw_appearance_and_reference.py`](https://github.com/andrewbartels1/SolidworksMCP-python/blob/main/tests/live/test_live_sw_appearance_and_reference.py).
+
+### Colours on a block {#colours}
+
+
+
+> *Example prompt:* Colour this block green, make its top face blue, then
+> take the blue off again.
+
+**What it shows.** `set_appearance` colours a feature, a face, a body or the
+whole part, and `get_appearance` reads back the colour that actually shows
+on a face, with the level it comes from. SolidWorks shows the most specific
+colour: a face's own colour over its feature's, a feature's over its
+body's:
+
+| Step | Tools | Expected | Measured |
+| --- | --- | --- | --- |
+| The feature green | `set_appearance` | `#1fcc33` on Boss-Extrude1 | `#1fcc33` |
+| The top face blue | `set_appearance` | `#194cf2` on the face at (0, 10, 0) | `#194cf2` |
+| The body orange | `set_appearance` | `#f28c1a`; the feature's green still shows | `#f28c1a`; sides green |
+| What shows | `get_appearance` | top: blue (face); side: green (feature) | top `#194cf2` (face); side `#1fcc33` (feature) |
+| A feature and a face at once | `set_appearance` | refused, nothing changed | `invalid_input`: "Give one target" |
+| The top face's colour removed | `set_appearance` | the feature's green shows | `#1fcc33` (feature) |
+
+Two targets are refused **on purpose**.
+
+**Tool calls**
+
+1. A 40 x 40 mm square on the Top Plane extruded 10 mm, then `list_bodies`
+2. `set_appearance({"feature": "Boss-Extrude1", "color": "#1fcc33"})`
+3. `set_appearance({"face_point": [0, 10, 0], "color": [25, 76, 242]})`
+4. `set_appearance({"body": "Boss-Extrude1", "color": "#f28c1a"})`
+5. `get_appearance({"face_point": [0, 10, 0]})`, `get_appearance({"face_point": [20, 5, 0]})`
+6. `set_appearance` with a feature and a face, refused on purpose
+7. `set_appearance({"face_point": [0, 10, 0], "reset": true})`
+
+### Reference extras on a block {#reference-extras}
+
+
+
+> *Example prompt:* Give me the top face's section properties, put a
+> coordinate system on the corner, and add the centre of mass and a bounding
+> box.
+
+**What it shows.** Section properties of a face, and three pieces of
+reference geometry, each checked against the block's own numbers:
+
+| Step | Tools | Expected | Measured |
+| --- | --- | --- | --- |
+| The top face's section | `get_section_properties` | 1,600 mm², centroid (0, 10, 0), Ixx = 40⁴/12 = 213,333.3 mm⁴ | 1,600 mm², (0, 10, 0), 213,333.33 mm⁴ |
+| A coordinate system at the corner | `create_coordinate_system` | origin (20, 10, 20), axes along x, y, z | (20, 10, 20); x, y, z |
+| The Center of Mass point | `create_center_of_mass_point` | (0, 5, 0) | (0, 5, 0) |
+| A second Center of Mass point | `create_center_of_mass_point` | refused: a part has one at most | `invalid_input` |
+| The bounding box | `create_bounding_box` | 40 x 10 x 40 mm | 40 x 10 x 40 mm |
+
+The second Center of Mass point is refused **on purpose**.
+
+**Tool calls**
+
+1. A 40 x 40 mm square on the Top Plane extruded 10 mm
+2. `get_section_properties({"face_point": [0, 10, 0]})`
+3. `create_coordinate_system({"origin": [20, 10, 20]})`
+4. `create_center_of_mass_point()`, twice; the second is refused on purpose
+5. `create_bounding_box()`
+
## Run a demo yourself
The demos need Windows, SolidWorks open and idle, and the project's `.venv`.
diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md
index 7c1b4fc0..3348795d 100644
--- a/docs/getting-started/installation.md
+++ b/docs/getting-started/installation.md
@@ -80,7 +80,7 @@ Every tool's name, description and inputs are sent to the model on every turn, s
| Toolset | Tools |
| --- | --- |
-| `core` | Parts and assemblies: modelling, equations, multi-body tools, sketching, files, measuring and checking, materials and properties, export, the circuit-breaker reset |
+| `core` | Parts and assemblies: modelling, equations, multi-body tools, colours, reference geometry, sketching, files, measuring and checking, materials and properties, export, the circuit-breaker reset |
| `drawing` | Drawings: views, dimensions, the title block and sheet, the drawing package and check |
| `automation` | Macros, recording and batch automation |
| `vba` | The VBA code generators |
diff --git a/docs/index.md b/docs/index.md
index c381c03f..855acf76 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.
-🚀 **165 Tools** | 🤖 **Agent-Ready Workflows** | ⚡ **Automatic COM/VBA Routing** | 🧪 **Schema-Validated Prompt Runs**
+🚀 **171 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
-- 165 tools across modeling, multi-body parts, assemblies, sketching, drawing, engineering data, analysis, export, automation, templates, macros, and docs discovery
+- 171 tools across modeling, multi-body parts, colours, reference geometry, assemblies, 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 0d10c378..3263756b 100644
--- a/docs/llms.txt
+++ b/docs/llms.txt
@@ -36,10 +36,12 @@
## Tool Catalog
-- [Tool Catalog — All 165 Tools](https://andrewbartels1.com/SolidworksMCP-python/user-guide/tool-catalog/): This reference documents all **165 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 171 Tools](https://andrewbartels1.com/SolidworksMCP-python/user-guide/tool-catalog/): This reference documents all **171 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.
- [Body Tools](https://andrewbartels1.com/SolidworksMCP-python/user-guide/tool-catalog/bodies/): See, combine, split, move, copy, delete and scale the solid bodies of a part.
+- [Appearance Tools](https://andrewbartels1.com/SolidworksMCP-python/user-guide/tool-catalog/appearance/): Colour the part, a feature, a body or one face, and read a colour back.
+- [Reference and Analysis Extras](https://andrewbartels1.com/SolidworksMCP-python/user-guide/tool-catalog/reference-extras/): A coordinate system at a point, the centre-of-mass point, the bounding box, and a face's section properties.
- [Assembly Tools](https://andrewbartels1.com/SolidworksMCP-python/user-guide/tool-catalog/assembly/): Explode an assembly, repeat and mirror its components, and swap one for another file, the edits between inserting parts and drawing the assembly.
- [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.
diff --git a/docs/user-guide/tool-catalog/appearance.md b/docs/user-guide/tool-catalog/appearance.md
new file mode 100644
index 00000000..dcb1968d
--- /dev/null
+++ b/docs/user-guide/tool-catalog/appearance.md
@@ -0,0 +1,62 @@
+# Appearance Tools
+
+Colour the part, a feature, a body or one face, and read a colour back.
+
+> **Prerequisite:** an open part.
+
+**Total tools in this category: 2**
+
+A colour shows from the nearest level that has one: a face's colour over its feature's, a feature's over its body's, a body's over the part's. Every part has a colour; a feature, body or face has one only once it is given one. `set_appearance` reads the colour back from SolidWorks after setting it, and `get_appearance` says which level the visible colour comes from.
+
+A target is one of `feature` (its name in the tree), `body` (as `list_bodies` names it) or `face_point` (`[x, y, z]` mm, a point on the face); none means the whole part. Giving two targets is refused.
+
+---
+
+### `set_appearance`
+
+Colour the active part, one feature, one body or the face at a point, or remove a colour.
+
+`color` is `[r, g, b]`, each 0-255, or `#rrggbb`. `reset: true` removes a feature's, body's or face's own colour so the colour above it shows again; the reply's `showing` gives that colour and its level. The part's colour can't be reset, only changed. The geometry is never changed.
+
+**Prerequisite:** Active part.
+
+**Parameters:**
+
+| Parameter | Type | Required | Default | Description |
+|-----------|------|----------|---------|-------------|
+| `feature` | `str` | — | | A feature by its name in the tree, e.g. 'Boss-Extrude1' |
+| `body` | `str` | — | | A solid body, as list_bodies names it |
+| `face_point` | `list[float]` | — | | [x, y, z] in mm, a point on the face; give one target, or none for the whole part |
+| `color` | `list[int] \| str` | — | | [r, g, b], each 0-255, or '#rrggbb', e.g. [31, 119, 180] or '#1f77b4' |
+| `transparency` | `float` | — | `0.0` | 0 opaque (default) to 1 clear |
+| `reset` | `bool` | — | `false` | Remove the feature's, body's or face's own colour so the one above it shows; give no color |
+
+**Sample call:**
+
+```json
+{"color": "#1f77b4", "face_point": [0, 10, 0]}
+```
+
+---
+
+### `get_appearance`
+
+Read the colour the active part, a feature, a body or the face at a point shows, and where it comes from.
+
+The reply's `level` is `face`, `feature`, `body` or `part`: the nearest level with a colour of its own.
+
+**Prerequisite:** Active part.
+
+**Parameters:**
+
+| Parameter | Type | Required | Default | Description |
+|-----------|------|----------|---------|-------------|
+| `feature` | `str` | — | | A feature by its name in the tree, e.g. 'Boss-Extrude1' |
+| `body` | `str` | — | | A solid body, as list_bodies names it |
+| `face_point` | `list[float]` | — | | [x, y, z] in mm, a point on the face; give one target, or none for the whole part |
+
+**Sample call:**
+
+```json
+{"face_point": [20, 5, 0]}
+```
diff --git a/docs/user-guide/tool-catalog/index.md b/docs/user-guide/tool-catalog/index.md
index 2e44633f..e3734757 100644
--- a/docs/user-guide/tool-catalog/index.md
+++ b/docs/user-guide/tool-catalog/index.md
@@ -1,6 +1,6 @@
-# Tool Catalog — All 165 Tools
+# Tool Catalog — All 171 Tools
-This reference documents all **165 MCP tools** registered by the SolidWorks MCP server.
+This reference documents all **171 MCP tools** registered by the SolidWorks MCP server.
Each section covers one functional category with parameter tables and copy-paste sample calls.

@@ -12,6 +12,8 @@ Each section covers one functional category with parameter tables and copy-paste
| [Modeling Tools](modeling.md) | 44 | Parts, assemblies and drawings: extrusions, revolves, helices, sweeps and swept cuts, 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. |
| [Equation Tools](equations.md) | 3 | Equations and global variables: one value driving several dimensions, in all configurations or chosen ones. |
| [Body Tools](bodies.md) | 6 | A part's solid bodies by name: add, subtract or intersect them, split them at a plane, move, copy, delete or scale them, each step measured. |
+| [Appearance Tools](appearance.md) | 2 | Colour the part, a feature, a body or one face, and read back the colour that shows and where it comes from. |
+| [Reference and Analysis Extras](reference-extras.md) | 4 | A coordinate system at a point, the centre-of-mass point, the bounding box with the stock size, and a planar face's section properties. |
| [Assembly Tools](assembly.md) | 5 | Exploded views, component patterns and mirrors, and replacing a component with another file. |
| [Sketching Tools](sketching.md) | 27 | Sketches on a plane or a flat face: lines, circles, arcs, slots, splines, polygons, text, fillets, chamfers, trim and extend, construction geometry, relations, dimensions, offsets, mirrors and patterns. |
| [Drawing Tools](drawing.md) | 14 | Drawings from a model: standard, section, detail and exploded views, dimensions, notes, balloons, centre marks, the sheet format and title block, and a drawing check. |
diff --git a/docs/user-guide/tool-catalog/reference-extras.md b/docs/user-guide/tool-catalog/reference-extras.md
new file mode 100644
index 00000000..1cb1a5fd
--- /dev/null
+++ b/docs/user-guide/tool-catalog/reference-extras.md
@@ -0,0 +1,93 @@
+# Reference and Analysis Extras
+
+A coordinate system at a point, the centre-of-mass point, the bounding box, and a face's section properties.
+
+> **Prerequisite:** an open part; all but the coordinate system need a solid body.
+
+**Total tools in this category: 4**
+
+Each reply is read back from SolidWorks: the coordinate system's transform, the centre of mass, the bodies' box and the face's section. For the numbers alone, without adding a feature, `get_mass_properties` gives the centre of mass and `verify_model` the box size.
+
+---
+
+### `create_coordinate_system`
+
+Add a coordinate system with its origin at a point, axes along the model's.
+
+The origin is a point in a 3D sketch the tool draws for it. The axes lie along the model's; they can't yet be turned or reversed. Use the coordinate system as a frame for measurements, mass properties or exports.
+
+**Prerequisite:** Active part.
+
+**Parameters:**
+
+| Parameter | Type | Required | Default | Description |
+|-----------|------|----------|---------|-------------|
+| `origin` | `list[float]` | ✅ | | The origin [x, y, z] in mm |
+
+**Sample call:**
+
+```json
+{"origin": [20, 10, 20]}
+```
+
+---
+
+### `create_center_of_mass_point`
+
+Add SolidWorks's Center of Mass point to the active part, at its centre of mass.
+
+The point moves with the geometry. A part has one at most; a second call, or a part with no solid body, is refused.
+
+**Prerequisite:** Active part with a body.
+
+**Parameters:** none.
+
+**Sample call:**
+
+```json
+{}
+```
+
+---
+
+### `create_bounding_box`
+
+Add SolidWorks's Bounding Box feature around the active part's bodies and give the stock size.
+
+The box is SolidWorks's best fit and updates with the part. The reply's `size_mm`, `min_mm` and `max_mm` are the bodies' box in model axes. A part has one at most.
+
+**Prerequisite:** Active part with a body.
+
+**Parameters:**
+
+| Parameter | Type | Required | Default | Description |
+|-----------|------|----------|---------|-------------|
+| `include_hidden` | `bool` | — | `false` | Include hidden bodies in the box |
+
+**Sample call:**
+
+```json
+{}
+```
+
+---
+
+### `get_section_properties`
+
+Read the area, centroid and second moments of area of a planar face, picked by a point on it.
+
+Moments are about the face's centroid in model axes (`ixx` ... `iyz`, mm⁴), with the polar moment and the two principal moments. A 40 mm square face gives 1,600 mm² and 40⁴/12 = 213,333 mm⁴ about each in-plane axis. Changes nothing.
+
+**Prerequisite:** Active part.
+
+**Parameters:**
+
+| Parameter | Type | Required | Default | Description |
+|-----------|------|----------|---------|-------------|
+| `face_point` | `list[float]` | ✅ | | [x, y, z] in mm, a point on a planar face |
+
+**Sample call:**
+
+```json
+{"face_point": [0, 10, 0]}
+```
diff --git a/docs/user-guide/tools-overview.md b/docs/user-guide/tools-overview.md
index f961fcd0..0ab80cac 100644
--- a/docs/user-guide/tools-overview.md
+++ b/docs/user-guide/tools-overview.md
@@ -71,6 +71,22 @@ These read SolidWorks' installed files and never start it
[**6 tools available** :octicons-arrow-right-24:](tool-catalog/bodies.md)
+- :material-palette:{ .lg .middle } **Appearance Tools**
+
+ ---
+
+ Colour the part, a feature, a body or one face, and read back the colour that shows.
+
+ [**2 tools available** :octicons-arrow-right-24:](tool-catalog/appearance.md)
+
+- :material-axis-arrow:{ .lg .middle } **Reference and Analysis Extras**
+
+ ---
+
+ A coordinate system at a point, the centre-of-mass point, the bounding box and a face's section properties.
+
+ [**4 tools available** :octicons-arrow-right-24:](tool-catalog/reference-extras.md)
+
- :material-cogs:{ .lg .middle } **Assembly Tools**
---
@@ -201,7 +217,7 @@ These read SolidWorks' installed files and never start it
-**Total: 165 Tools**
+**Total: 171 Tools**
## Deprecated tools
diff --git a/mkdocs.yml b/mkdocs.yml
index c75dd830..8ffffcb8 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -51,6 +51,8 @@ nav:
- Modeling: user-guide/tool-catalog/modeling.md
- Equations: user-guide/tool-catalog/equations.md
- Bodies: user-guide/tool-catalog/bodies.md
+ - Appearance: user-guide/tool-catalog/appearance.md
+ - Reference Extras: user-guide/tool-catalog/reference-extras.md
- Assembly: user-guide/tool-catalog/assembly.md
- Sketching: user-guide/tool-catalog/sketching.md
- Drawing: user-guide/tool-catalog/drawing.md
diff --git a/openspec/changes/appearance-and-reference-tools/.openspec.yaml b/openspec/changes/appearance-and-reference-tools/.openspec.yaml
new file mode 100644
index 00000000..8c7aa0b9
--- /dev/null
+++ b/openspec/changes/appearance-and-reference-tools/.openspec.yaml
@@ -0,0 +1,2 @@
+schema: spec-driven
+created: 2026-11-27
diff --git a/openspec/changes/appearance-and-reference-tools/design.md b/openspec/changes/appearance-and-reference-tools/design.md
new file mode 100644
index 00000000..1d018018
--- /dev/null
+++ b/openspec/changes/appearance-and-reference-tools/design.md
@@ -0,0 +1,84 @@
+## Context
+
+Motivation: see proposal.md, under "Why".
+
+**Probes (SolidWorks 2026 SP4, 2026-11-28; scratch part, closed unsaved):**
+
+- **Colour.** A colour is nine doubles: R, G, B (0-1), ambient, diffuse,
+ specular, shininess, transparency, emission. It must be passed as a
+ `VARIANT(VT_ARRAY | VT_R8)` (`com_utils.double_array`): a plain list was
+ misread (the boolean demo's bodies came out green and see-through).
+ - Part: `IModelDoc2.MaterialPropertyValues` (read/write property). Reads
+ `[0.894, 0.894, 0.894, 1, 1, 0.5, 0.3125, 0, 0]` on a new part.
+ - Feature: `IFeature.SetMaterialPropertyValues2(values, 1, None)` (1 =
+ this configuration); `GetMaterialPropertyValues2(1, None)` reads it, all
+ `-1` when the feature has none; `RemoveMaterialProperty2(1, None)`
+ removes it.
+ - Face: `IFace2.MaterialPropertyValues` (property), `None` when the face
+ has none; `RemoveMaterialProperty2(1, None)` removes it.
+ - Body: `IBody2.MaterialPropertyValues2` (property; set live in the
+ boolean demo).
+ - A face's colour shows over its feature's, a feature's over the part's
+ (image: blue top face, green sides, red part colour hidden).
+- **Coordinate system.** `IFeatureManager.InsertCoordinateSystem(xFlip,
+ yFlip, zFlip)` with the origin selected with mark 1 and no axes selected
+ gives model-aligned axes. A vertex works, and so does a point in a 3D
+ sketch (`Insert3DSketch`, `CreatePoint(m)`, `Insert3DSketch` again; the
+ point selects as `Point1@3DSketch1`, type `EXTSKETCHPOINT`). An x axis
+ taken from an edge follows the edge's own direction (it came out
+ reversed), so edges are not offered. The transform reads back through
+ `IModelDocExtension.GetCoordinateSystemTransformByName(name).ArrayData`:
+ rotation rows `[0:9]`, origin in metres `[9:12]`.
+- **Centre of mass.** `IFeatureManager.InsertCenterOfMass()` returns the
+ feature, named "Center of Mass". The centre comes from
+ `IModelDocExtension.CreateMassProperty().CenterOfMass` (metres), with the
+ extension flagged `IModelDocExtension` (unflagged, it was read as a
+ property and failed).
+- **Bounding box.** `IFeatureManager.InsertGlobalBoundingBox(0, hidden,
+ surfaces, status)` needs `status` as `VARIANT(VT_BYREF | VT_I4, 0)`;
+ a plain `0` is a type mismatch. It makes "Bounding Box" (type
+ `BoundingBoxProfileFeat`). Type 0 is best fit.
+- **Section properties.** `IModelDocExtension.GetSectionProperties2(None)`
+ reads the current selection; passing the face in an array returned
+ status 1 and zeros. The array: `[0]` status (0 = ok), `[1]` area m²,
+ `[2:5]` centroid m, `[5:11]` Ixx, Iyy, Izz, Ixy, Izx, Iyz at the centroid
+ (m⁴), `[11]` polar moment, `[12]` the principal axes' angle, `[13:15]`
+ the principal moments. A 40 mm square: area 0.0016, centroid
+ `(0, 0.01, 0)`, Ixx = Izz = 2.133e-7, polar 4.267e-7.
+
+## Goals / Non-Goals
+
+**Goals:** colour any level and read it back; the four reference extras,
+each read back from SolidWorks rather than echoed.
+
+**Non-Goals:**
+- Appearances from the library (`.p2m` files, textures), decals, scenes.
+- Colours in assemblies (component overrides).
+- Coordinate systems from edges, faces or angles, or with reversed axes:
+ only a point with model-aligned axes. The flip flags of
+ `InsertCoordinateSystem` do nothing when no axis is selected (the live
+ test asked for z flipped and read +z back), so reversed axes need axis
+ lines drawn and selected, a later change.
+- Bounding boxes on a custom plane (type 1) or in sheet-metal cut lists.
+- Section properties of sketches or of a plane through a body.
+
+## Decisions
+
+1. **One `set_appearance`, a target by field.** Exactly one of `feature`,
+ `body`, `face_point`, or none for the part. Two targets are refused.
+ `reset` removes an override; resetting the part is refused.
+2. **Colours as the user says them.** `[r, g, b]` 0-255 or `#rrggbb` in;
+ both out, plus transparency. The other six values keep SolidWorks's
+ defaults for shading (ambient 1, diffuse 1, specular 0.5, shininess
+ 0.3125, emission 0); only transparency is the caller's.
+3. **Faces by point.** A face is picked by `SelectByID2("", "FACE", x, y, z)`
+ after a rebuild (pitfall #13), the way `select_face_edges` does.
+4. **Read back, not echo.** Each reply reads SolidWorks: the colour after
+ setting it, the coordinate system's transform, the centre of mass, the
+ box's size (the part box after the feature), the section array.
+5. **Module layout.** Appearance and the reference extras are separate
+ modules, adapter and mock, so neither grows `features.py` or
+ `modeling.py` (queue item 40).
+6. **Errors.** Unknown targets and two targets are `invalid_input`
+ (`InputRefused`); a SolidWorks call that makes nothing raises a
+ message the classifier maps to `feature_not_built`.
diff --git a/openspec/changes/appearance-and-reference-tools/proposal.md b/openspec/changes/appearance-and-reference-tools/proposal.md
new file mode 100644
index 00000000..0dde5780
--- /dev/null
+++ b/openspec/changes/appearance-and-reference-tools/proposal.md
@@ -0,0 +1,62 @@
+## Why
+
+Two gaps in the COM coverage, queue items 36 and 39:
+
+- **Appearance.** An agent can't colour anything. A part, a feature, a body or
+ one face can't be given a colour, so a demo, a rendering or a multi-body
+ part can't show which piece is which, and a colour can't be read back.
+ The boolean-logic demo had to colour its bodies with direct COM in the
+ test (queue item 35).
+- **Reference and analysis extras.** There is no coordinate system, no
+ centre-of-mass point, no bounding box feature and no section properties
+ of a face. These are what an agent needs to report stock size (bounding
+ box), place a measurement or export frame (coordinate system), mark where
+ the mass sits (centre of mass), or check a cross-section (area, centroid
+ and second moments of area of a face, for a beam or a bracket).
+
+## What Changes
+
+- **`set_appearance`**: colour the part, a feature, a body or the face at a
+ point, as `[r, g, b]` (0-255) or `#rrggbb`, with an optional
+ transparency; or with `reset: true` remove a feature's, body's or face's
+ colour so the one above it shows again. The reply reads the colour back.
+- **`get_appearance`**: read the colour of the part, a feature, a body or a
+ face, and say which level it comes from.
+- **`create_coordinate_system`**: a coordinate system with its origin at a
+ point given in mm, axes along the model's.
+ The reply reads its transform back.
+- **`create_center_of_mass_point`**: the Center of Mass reference point,
+ with the centre of mass in mm.
+- **`create_bounding_box`**: SolidWorks's Bounding Box feature around the
+ part's bodies, with the box size in mm.
+- **`get_section_properties`**: area, centroid, second moments of area about
+ the centroid, the polar moment and the principal moments of a planar face,
+ picked by a point on it.
+- Six new tools, beta until their live demo.
+
+## Capabilities
+
+### New Capabilities
+
+- `tools/appearance`: `set_appearance` and `get_appearance`.
+- `tools/reference-extras`: `create_coordinate_system`,
+ `create_center_of_mass_point`, `create_bounding_box` and
+ `get_section_properties`.
+
+### Modified Capabilities
+
+None.
+
+## Impact
+
+- New adapter modules `adapters/solidworks/appearance.py` and
+ `adapters/solidworks/reference_extras.py`, with mocks
+ `adapters/mock_appearance.py` and `adapters/mock_reference_extras.py`.
+ New non-abstract methods in `adapters/base.py`, with wrappers in
+ `circuit_breaker.py` and `connection_pool.py`.
+- New tool modules `tools/appearance.py` and `tools/reference_extras.py`,
+ registered in `tools/__init__.py`; the families join the core toolset.
+- Docs: two tool-catalog pages, counts, the skill's workflow notes, the
+ CHANGELOG.
+- Tests mirror `src`; a live test `tests/live/test_live_sw_appearance_and_reference.py`
+ with one refusal per tool family.
diff --git a/openspec/changes/appearance-and-reference-tools/specs/tools/appearance/spec.md b/openspec/changes/appearance-and-reference-tools/specs/tools/appearance/spec.md
new file mode 100644
index 00000000..36f6a86b
--- /dev/null
+++ b/openspec/changes/appearance-and-reference-tools/specs/tools/appearance/spec.md
@@ -0,0 +1,52 @@
+## ADDED Requirements
+
+### Requirement: Colour the part, a feature, a body or a face
+`set_appearance` SHALL take a `color`, either `[r, g, b]` with each value 0
+to 255 or a `#rrggbb` string, and an optional `transparency` from 0 (opaque,
+the default) to 1. It SHALL colour exactly one target: the whole part when
+no target is given, or the feature named by `feature`, the body named by
+`body` (as `list_bodies` names it), or the face at `face_point` (`[x, y, z]`
+mm, a point on the face). The reply SHALL read the colour back from
+SolidWorks and give it as `color` `[r, g, b]` (0-255), `hex` and
+`transparency`, with `target` saying what was coloured.
+
+A face's colour shows over its feature's, and a feature's over the part's
+(checked live, SolidWorks 2026).
+
+#### Scenario: A blue top face on a green block
+- **WHEN** a 40 × 40 × 10 mm block's feature `Boss-Extrude1` is set to
+ `#1fcc33` and the face at `[0, 10, 0]` to `[25, 76, 242]`
+- **THEN** both calls succeed, each reply reads back the colour asked for
+ (to the nearest 1/255), and the top face shows blue over the green sides
+
+#### Scenario: Two targets at once
+- **WHEN** `set_appearance` is given both `feature` and `face_point`
+- **THEN** it fails with `invalid_input`, saying to give one target
+
+#### Scenario: A target that doesn't exist
+- **WHEN** `feature` names no feature, `body` no body, or `face_point`
+ lies on no face
+- **THEN** it fails with `invalid_input`; for a body the message lists the
+ bodies there are
+
+### Requirement: Remove a colour
+`set_appearance` with `reset: true` and a `feature`, `body` or `face_point`
+SHALL remove that target's own colour so the colour above it shows again,
+and SHALL reply `color` null for it. `reset` on the whole part SHALL fail
+with `invalid_input`: the part's colour is the base, not an override.
+
+#### Scenario: A face back to its feature's colour
+- **WHEN** a coloured face is reset
+- **THEN** the call succeeds and `get_appearance` on that face reports the
+ feature's colour, from `level` "feature"
+
+### Requirement: Read a colour back
+`get_appearance` SHALL take the same targets (none for the part) and reply
+`color`, `hex`, `transparency` and `level`: the level the visible colour
+comes from (`face`, `body`, `feature` or `part`), walking up from the
+target until one has a colour of its own.
+
+#### Scenario: An uncoloured face of a coloured feature
+- **WHEN** only `Boss-Extrude1` is coloured and a side face is read
+- **THEN** `get_appearance` gives the feature's colour with `level`
+ "feature"
diff --git a/openspec/changes/appearance-and-reference-tools/specs/tools/reference-extras/spec.md b/openspec/changes/appearance-and-reference-tools/specs/tools/reference-extras/spec.md
new file mode 100644
index 00000000..074918f5
--- /dev/null
+++ b/openspec/changes/appearance-and-reference-tools/specs/tools/reference-extras/spec.md
@@ -0,0 +1,54 @@
+## ADDED Requirements
+
+### Requirement: A coordinate system at a point
+`create_coordinate_system` SHALL take `origin` (`[x, y, z]` mm) and SHALL
+insert a coordinate system there with its axes along the model's. The origin is a
+point in a 3D sketch the tool draws for it. The reply SHALL give the
+feature's `name` and read its transform back as `origin_mm` and the three
+axis directions `x_axis`, `y_axis` and `z_axis`.
+
+#### Scenario: At a corner of a block
+- **WHEN** it is called with `origin` `[20, 10, 20]` on a 40 × 40 × 10 mm
+ block
+- **THEN** it replies `name` "Coordinate System1", `origin_mm`
+ `[20, 10, 20]` and `x_axis` `[1, 0, 0]`
+
+#### Scenario: No turning yet
+- **WHEN** a caller wants turned or reversed axes
+- **THEN** the tool has no input for it: SolidWorks ignores the flip flags
+ when no axis is selected (checked live), so turned axes wait for axis
+ lines drawn and selected (a later change)
+
+### Requirement: The centre-of-mass point
+`create_center_of_mass_point` SHALL insert SolidWorks's Center of Mass
+reference point on the active part and reply with its `name` and
+`center_of_mass_mm`. A part that has one already, or has no solid body,
+SHALL fail with `invalid_input` saying so.
+
+#### Scenario: A block 10 mm tall on the Top Plane
+- **WHEN** it is called on a 40 × 40 × 10 mm block
+- **THEN** `center_of_mass_mm` is `[0, 5, 0]`
+
+### Requirement: The bounding box
+`create_bounding_box` SHALL insert SolidWorks's Bounding Box feature around
+the part's solid bodies (best fit), optionally including hidden bodies, and
+reply with its `name` and the box's `size_mm` `[x, y, z]`, read from
+SolidWorks.
+
+#### Scenario: A block
+- **WHEN** it is called on a 40 × 40 × 10 mm block
+- **THEN** `size_mm` holds 40, 10 and 40 (in model axes)
+
+### Requirement: Section properties of a planar face
+`get_section_properties` SHALL take `face_point` (`[x, y, z]` mm on a planar
+face) and reply with the face's `area_mm2`, `centroid_mm`, the second
+moments of area about the centroid in model axes (`ixx`, `iyy`, `izz`,
+`ixy`, `izx`, `iyz`, mm⁴), `polar_moment_mm4` and the principal moments
+`principal_moments_mm4`. It changes nothing in the model. A point on no
+face, or on a face SolidWorks can't take a section of, SHALL fail with
+`invalid_input`.
+
+#### Scenario: A 40 mm square face
+- **WHEN** it is given the top face of a 40 × 40 × 10 mm block
+- **THEN** `area_mm2` is 1600, `centroid_mm` is `[0, 10, 0]`, and `ixx` and
+ `izz` are 40⁴/12 = 213,333.3 mm⁴
diff --git a/openspec/changes/appearance-and-reference-tools/tasks.md b/openspec/changes/appearance-and-reference-tools/tasks.md
new file mode 100644
index 00000000..8d5182c0
--- /dev/null
+++ b/openspec/changes/appearance-and-reference-tools/tasks.md
@@ -0,0 +1,44 @@
+## 1. Probe
+
+- [x] 1.1 Probe colour (part, feature, face), the coordinate system (vertex,
+ edge, 3D-sketch point), the centre of mass, the bounding box and the
+ section properties on SolidWorks 2026 (two scripts; answers in
+ design.md)
+
+## 2. Adapter
+
+- [x] 2.1 `base.py`: parameter models and non-abstract methods for the six
+ operations; wrappers in `circuit_breaker.py` and `connection_pool.py`
+- [x] 2.2 `adapters/solidworks/appearance.py`: set, reset and read colours
+- [x] 2.3 `adapters/solidworks/reference_extras.py`: coordinate system,
+ centre-of-mass point, bounding box, section properties
+- [x] 2.4 Mocks: `mock_appearance.py`, `mock_reference_extras.py`
+- [x] 2.5 Pure helpers (colour parsing and conversion, the section array,
+ the transform) in `adapters/appearance_rules.py`
+
+## 3. Tools
+
+- [x] 3.1 `tools/appearance.py`: `set_appearance`, `get_appearance`
+- [x] 3.2 `tools/reference_extras.py`: `create_coordinate_system`,
+ `create_center_of_mass_point`, `create_bounding_box`,
+ `get_section_properties`
+- [x] 3.3 Register both; toolset families; support levels (beta); hints;
+ error classifier rules
+
+## 4. Tests
+
+- [x] 4.1 Unit tests mirroring src, 100% coverage
+- [x] 4.2 Live test `tests/live/test_live_sw_appearance_and_reference.py`:
+ a block with a coloured feature and face, read back; a coordinate
+ system, the centre of mass, the bounding box, the section properties;
+ one refusal per family. Run it, look at the images.
+ (Both passed on SolidWorks 2026, 2026-11-28; the picture showed the
+ blue top face, green sides, an orange face, the coordinate system at
+ the corner and the box. The first run caught the flip flags doing
+ nothing; they were dropped.)
+
+## 5. Docs
+
+- [x] 5.1 Tool-catalog pages, index and counts, tools overview, skill
+ workflow notes, description standard verbs, CHANGELOG, llms.txt
+- [x] 5.2 A demo section and GIF once the user has seen it
diff --git a/openspec/changes/helix-and-swept-cuts/.openspec.yaml b/openspec/changes/archive/2026-11-28-helix-and-swept-cuts/.openspec.yaml
similarity index 100%
rename from openspec/changes/helix-and-swept-cuts/.openspec.yaml
rename to openspec/changes/archive/2026-11-28-helix-and-swept-cuts/.openspec.yaml
diff --git a/openspec/changes/helix-and-swept-cuts/design.md b/openspec/changes/archive/2026-11-28-helix-and-swept-cuts/design.md
similarity index 100%
rename from openspec/changes/helix-and-swept-cuts/design.md
rename to openspec/changes/archive/2026-11-28-helix-and-swept-cuts/design.md
diff --git a/openspec/changes/helix-and-swept-cuts/proposal.md b/openspec/changes/archive/2026-11-28-helix-and-swept-cuts/proposal.md
similarity index 100%
rename from openspec/changes/helix-and-swept-cuts/proposal.md
rename to openspec/changes/archive/2026-11-28-helix-and-swept-cuts/proposal.md
diff --git a/openspec/changes/helix-and-swept-cuts/specs/tools/helix/spec.md b/openspec/changes/archive/2026-11-28-helix-and-swept-cuts/specs/tools/helix/spec.md
similarity index 100%
rename from openspec/changes/helix-and-swept-cuts/specs/tools/helix/spec.md
rename to openspec/changes/archive/2026-11-28-helix-and-swept-cuts/specs/tools/helix/spec.md
diff --git a/openspec/changes/helix-and-swept-cuts/specs/tools/swept-features/spec.md b/openspec/changes/archive/2026-11-28-helix-and-swept-cuts/specs/tools/swept-features/spec.md
similarity index 100%
rename from openspec/changes/helix-and-swept-cuts/specs/tools/swept-features/spec.md
rename to openspec/changes/archive/2026-11-28-helix-and-swept-cuts/specs/tools/swept-features/spec.md
diff --git a/openspec/changes/helix-and-swept-cuts/tasks.md b/openspec/changes/archive/2026-11-28-helix-and-swept-cuts/tasks.md
similarity index 100%
rename from openspec/changes/helix-and-swept-cuts/tasks.md
rename to openspec/changes/archive/2026-11-28-helix-and-swept-cuts/tasks.md
diff --git a/openspec/changes/multi-body-tools/.openspec.yaml b/openspec/changes/archive/2026-11-28-multi-body-tools/.openspec.yaml
similarity index 100%
rename from openspec/changes/multi-body-tools/.openspec.yaml
rename to openspec/changes/archive/2026-11-28-multi-body-tools/.openspec.yaml
diff --git a/openspec/changes/multi-body-tools/design.md b/openspec/changes/archive/2026-11-28-multi-body-tools/design.md
similarity index 100%
rename from openspec/changes/multi-body-tools/design.md
rename to openspec/changes/archive/2026-11-28-multi-body-tools/design.md
diff --git a/openspec/changes/multi-body-tools/proposal.md b/openspec/changes/archive/2026-11-28-multi-body-tools/proposal.md
similarity index 100%
rename from openspec/changes/multi-body-tools/proposal.md
rename to openspec/changes/archive/2026-11-28-multi-body-tools/proposal.md
diff --git a/openspec/changes/multi-body-tools/specs/tools/body-listing/spec.md b/openspec/changes/archive/2026-11-28-multi-body-tools/specs/tools/body-listing/spec.md
similarity index 100%
rename from openspec/changes/multi-body-tools/specs/tools/body-listing/spec.md
rename to openspec/changes/archive/2026-11-28-multi-body-tools/specs/tools/body-listing/spec.md
diff --git a/openspec/changes/multi-body-tools/specs/tools/body-operations/spec.md b/openspec/changes/archive/2026-11-28-multi-body-tools/specs/tools/body-operations/spec.md
similarity index 100%
rename from openspec/changes/multi-body-tools/specs/tools/body-operations/spec.md
rename to openspec/changes/archive/2026-11-28-multi-body-tools/specs/tools/body-operations/spec.md
diff --git a/openspec/changes/multi-body-tools/tasks.md b/openspec/changes/archive/2026-11-28-multi-body-tools/tasks.md
similarity index 100%
rename from openspec/changes/multi-body-tools/tasks.md
rename to openspec/changes/archive/2026-11-28-multi-body-tools/tasks.md
diff --git a/openspec/queue.md b/openspec/queue.md
index 41af0849..75a33984 100644
--- a/openspec/queue.md
+++ b/openspec/queue.md
@@ -46,10 +46,10 @@ Last updated 2026-11-25.
| 33 | Assembly depth and a ballooned drawing: exploded view, component patterns, mirror and replace components, hide/show/transparency, `AutoBalloon` on the drawing | #23 (part) | `assembly-depth` | Done (#260, archived 2026-11-22) |
| 34 | Helix and swept cuts: helix/spiral, a swept cut (`create_sweep` only adds material), thicken; springs and modelled threads | none | `helix-and-swept-cuts` | Built 2026-11-25: `create_helix`, `create_cut_sweep`, named and circular sweep profiles, both sweeps measured. Live demos passed 2026-11-26; beta for now (the user's choice) |
| 35 | Multi-body tools: combine (add, subtract, common), split, move/copy, delete/keep a body, scale | none | `multi-body-tools` | Done 2026-11-27: six tools, beta; the user ran the three demos (boolean logic on a cube and a sphere, split and keep, copies and scale) |
-| 36 | Appearance and colour: set a part's, body's or face's colour and read it back | none | not yet written | Planned (small; may ride with another item) |
+| 36 | Appearance and colour: set a part's, body's or face's colour and read it back | none | `appearance-and-reference-tools` | Built 2026-11-28 with item 39: `set_appearance`, `get_appearance`; live tests pass; beta until the user's demo |
| 37 | Drawing sheets and callouts: new and active sheet, auxiliary, break and broken-out views, hole callouts, ordinate dimensions, surface finish, revision table | #158 (part) | not yet written | Planned |
| 38 | Weldments: structural members, trim/extend, end caps, gussets, cut list | none | not yet written | Planned (needs live probes: the profile library location varies) |
-| 39 | Reference and analysis extras: coordinate system, bounding box, centre-of-mass point, section properties; wrap (text on a curved face) | none | not yet written | Planned |
+| 39 | Reference and analysis extras: coordinate system, bounding box, centre-of-mass point, section properties; wrap (text on a curved face) | none | `appearance-and-reference-tools` | Built 2026-11-28 except wrap: `create_coordinate_system` (model axes only; SolidWorks ignores the flips with no axis selected), `create_center_of_mass_point`, `create_bounding_box`, `get_section_properties`; live tests pass; beta until the user's demo. Wrap and turned axes are left |
| 40 | Structure review (the user's request 2026-11-19), not a rewrite: the adapter wrappers (`base`, `circuit_breaker`, `connection_pool`, each about 2,500 lines of near-identical per-tool methods) repeat every adapter method, and the largest modules (`mock_adapter` 4,900, `io` 4,000, `features` 3,800, `modeling` 3,200, `sketch` 2,900 lines) should split by topic, as `adapters/solidworks/` already does. Measure the repetition, propose a SOLID structure (one generic forwarding path; one module per topic), and move to it in steps that keep every test passing. Widened 2026-11-25 (the user's request): also audit every function for full type hints, Google-style docstrings with every section (Args, Returns, Raises, and an Example where the use isn't obvious), and inline comments that explain the logic, so each function's job is obvious; and the code sprawl: files and helpers that have grown in miscellaneous places, and a layout that scales to more tools and features (where a new tool's adapter method, wrapper, mock, schema and tests go). Its own PR, separate from feature work | none | not yet written | Planned (last) |
| 41 | Test in other SolidWorks languages: find how to switch SolidWorks' language on this machine (System Options > General > "Use English language", language packs from the Installation Manager, the registry), what that changes (UI, default template names, feature and sketch point names such as `Point1`, standard view names, `GetModelViewNames` order) and run the default-entity and selftest live tests in German and French. Prompted by #262: 2.2.0's language handling was only tested on English SolidWorks with renamed planes | #262 (follow-up) | not yet written | Planned |
| 42 | U-joint replay differences: decide, call by call, whether each of the nine calls that end differently on today's server is variance in a long agent run or something to fix on our end (a clearer error, a better description, or accepting `axis_entity: "centerline"` when the sketch has one centreline); rerun the prompt on today's server and compare | #278 | not yet written | Planned |
diff --git a/openspec/specs/tools/body-listing/spec.md b/openspec/specs/tools/body-listing/spec.md
new file mode 100644
index 00000000..96abf3c5
--- /dev/null
+++ b/openspec/specs/tools/body-listing/spec.md
@@ -0,0 +1,32 @@
+# tools/body-listing Specification
+
+## Purpose
+TBD - created by archiving change multi-body-tools. Update Purpose after archive.
+## Requirements
+### Requirement: The part's solid bodies, by name
+`list_bodies` SHALL take no arguments and SHALL reply, for the active part,
+with `bodies`, a list in the order SolidWorks gives them. Each entry SHALL carry `name`
+(the name every body tool accepts), `volume_mm3` and `bounding_box_mm`, the
+box's `min` and `max` corners `[x, y, z]` and its `size`. The reply SHALL
+also carry `count` and `total_volume_mm3`. Only solid bodies are listed;
+surface bodies are left out.
+
+#### Scenario: Two blocks not merged
+- **WHEN** a part holds a 40 × 40 × 10 mm block and a second
+ 20 × 20 × 30 mm block extruded with `merge_result: false`
+- **THEN** `list_bodies` replies `count` 2, with each body's name, the
+ volumes 16000 and 12000, and a `total_volume_mm3` of 28000
+
+#### Scenario: A part with no body yet
+- **WHEN** the active part has only sketches
+- **THEN** `list_bodies` succeeds with `count` 0 and an empty `bodies`
+
+### Requirement: Only on a part
+`list_bodies` SHALL fail with `invalid_input` when no document is open or
+the active document is an assembly or a drawing, and the message SHALL say
+a part must be active.
+
+#### Scenario: An assembly is active
+- **WHEN** `list_bodies` is called with an assembly active
+- **THEN** it fails with `invalid_input`, saying it reads a part's bodies
+
diff --git a/openspec/specs/tools/body-operations/spec.md b/openspec/specs/tools/body-operations/spec.md
new file mode 100644
index 00000000..461d8b84
--- /dev/null
+++ b/openspec/specs/tools/body-operations/spec.md
@@ -0,0 +1,129 @@
+# tools/body-operations Specification
+
+## Purpose
+TBD - created by archiving change multi-body-tools. Update Purpose after archive.
+## Requirements
+### Requirement: Bodies are named as list_bodies names them
+Every body operation SHALL take bodies by the names `list_bodies` gives,
+ignoring case. A name that matches no solid body SHALL fail with
+`invalid_input` before anything changes. The message SHALL name the unknown
+body and list the bodies that exist.
+
+#### Scenario: A misspelt body
+- **WHEN** `combine_bodies` names a tool body `Boss-Extrude9` that doesn't
+ exist
+- **THEN** the call fails with `invalid_input`, the message lists the
+ part's bodies, and the feature tree is unchanged
+
+### Requirement: Every operation is measured
+On success, every body operation SHALL reply with the new feature's `name`,
+`bodies_before` and `bodies_after` (the names), `body_count_before`,
+`body_count_after`, `volume_before_mm3`, `volume_after_mm3` and
+`volume_change_mm3`. When the result breaks the rule for its operation (in
+the requirements below), the call SHALL fail with `feature_not_built`, the
+new feature SHALL be deleted, and the message SHALL give the counts and
+volumes it found. Volumes count as unchanged within 0.1%.
+
+#### Scenario: A subtract that removes nothing
+- **WHEN** `combine_bodies` subtracts a tool body that doesn't touch the
+ main body, and SolidWorks still makes a feature
+- **THEN** the call fails with `feature_not_built`, the combine feature is
+ deleted, and both bodies are back as they were
+
+### Requirement: Combine bodies
+`combine_bodies` SHALL take `operation` (`add`, `subtract` or `common`),
+`main_body` and `tool_bodies` (one or more names, none of them the main
+body). The tool bodies are consumed. The result is measured by its own
+volume: the part's volume after, less the bodies the combine didn't touch.
+`add` SHALL leave fewer bodies and a result no larger than the combined
+bodies were. `subtract` and `common` SHALL leave a result smaller than the
+main body was. A tool lying elsewhere is consumed without cutting, so the
+part's total alone can't show the cut.
+
+#### Scenario: A block minus a cylinder
+- **WHEN** a 40 × 40 × 10 mm block has a 10 mm diameter cylinder through
+ it as a separate body, and `combine_bodies` subtracts the cylinder from
+ the block
+- **THEN** one body remains, its volume is
+ `16000 - pi * 5^2 * 10` mm³, and the reply names the combine feature
+
+#### Scenario: The main body among the tools
+- **WHEN** `tool_bodies` includes `main_body`
+- **THEN** the call fails with `invalid_input` and nothing changes
+
+### Requirement: Split a body
+`split_body` SHALL take `tool`, the name of a plane or a sketch, and SHALL
+split every body the tool crosses, as SolidWorks does. The result SHALL
+have more bodies than before and the same volume. The reply SHALL name the
+bodies made.
+
+#### Scenario: A block split at its middle
+- **WHEN** a 40 × 40 × 10 mm block centred on the origin is split by the
+ Right Plane
+- **THEN** there are two bodies of 8000 mm³ each, and the volume is
+ unchanged
+
+#### Scenario: A plane that misses the body
+- **WHEN** the tool is a plane that doesn't cross any body
+- **THEN** the call fails, and no split feature remains
+
+### Requirement: Move or copy bodies
+`move_copy_body` SHALL take `bodies`, a `translate` `[x, y, z]` in mm, and
+optionally a `rotate` `[x, y, z]` in degrees about `rotation_point`
+`[x, y, z]` mm (the origin by default). With `as_copy: true` and `copies` N
+(1 by default, at most 50), the bodies SHALL be copied N times instead of
+moved.
+
+- A move SHALL keep the body count and the volume, and SHALL change the
+ moved bodies' bounding boxes.
+- A copy SHALL add N bodies per body copied, and N times their volume.
+- A call with no translation and no rotation SHALL fail with
+ `invalid_input`.
+- A call with both a translation and a rotation SHALL fail with
+ `invalid_input`, saying to move twice. SolidWorks would apply only the
+ rotation.
+
+#### Scenario: A block moved 50 mm along x
+- **WHEN** a block is moved by `[50, 0, 0]`
+- **THEN** its bounding box moves 50 mm along x, and the count and volume
+ are unchanged
+
+#### Scenario: Three copies
+- **WHEN** a 1000 mm³ body is copied with `copies` 3 and `translate`
+ `[20, 0, 0]`
+- **THEN** there are 3 more bodies and 3000 mm³ more volume
+
+### Requirement: Delete or keep bodies
+`delete_bodies` SHALL take `bodies` and `keep` (false by default). With
+`keep` false the named bodies SHALL be removed. With `keep` true every
+other body SHALL be removed. In both cases the volume SHALL fall by the
+removed bodies' volumes. Removing every body SHALL fail with
+`invalid_input` before anything changes.
+
+#### Scenario: Keep one of three
+- **WHEN** a part has three bodies and `delete_bodies` keeps one
+- **THEN** one body remains, with its own volume
+
+### Requirement: Scale bodies
+`scale_body` SHALL take `scale` (one factor, uniform) or `scale_xyz`
+`[x, y, z]`, all above 0, `about` (`centroid`, the default, or `origin`),
+and optionally `bodies` (all by default). The volume of the scaled bodies
+SHALL be multiplied by the product of the factors, within 0.5%. A factor of
+exactly 1 on every axis SHALL fail with `invalid_input`.
+
+#### Scenario: A block scaled by 2
+- **WHEN** a 16000 mm³ block is scaled by 2 about its centroid
+- **THEN** its volume is 128000 mm³, and its centroid stays where it was
+
+### Requirement: Mock adapter
+The mock adapter SHALL keep a list of bodies with volumes and boxes, made
+by unmerged extrusions. It SHALL apply each operation to that list by the
+rules above, and SHALL refuse what the real adapter refuses, with the same
+messages.
+
+#### Scenario: Subtract on the mock
+- **WHEN** the mock part has two bodies and one is subtracted from the
+ other
+- **THEN** one body remains, and the reply carries the counts and volumes
+ before and after
+
diff --git a/openspec/specs/tools/helix/spec.md b/openspec/specs/tools/helix/spec.md
new file mode 100644
index 00000000..38fe0375
--- /dev/null
+++ b/openspec/specs/tools/helix/spec.md
@@ -0,0 +1,41 @@
+# tools/helix Specification
+
+## Purpose
+TBD - created by archiving change helix-and-swept-cuts. Update Purpose after archive.
+## Requirements
+### Requirement: A helix from a base circle
+`create_helix` SHALL make a helix (or a flat spiral) from a named sketch
+that holds exactly one circle. The circle's diameter is the helix's
+diameter and its centre is on the helix's axis, which is normal to the
+sketch. The helix is defined by two of height, pitch and revolutions,
+chosen by `defined_by`: `height_and_pitch` (the default),
+`height_and_revolutions` or `pitch_and_revolutions`; `spiral` takes pitch
+and revolutions and stays in the sketch's plane. Lengths are in mm and
+angles in degrees. Options: `clockwise`, `reverse` (the other side of the
+sketch), `start_angle`, and `taper_angle` with `taper_outward`.
+
+The reply SHALL give the helix's name, its height, pitch and revolutions
+(the two given and the one worked out from them), its diameter, its length,
+and the point where it starts in model mm, so a profile can be drawn there.
+
+#### Scenario: A helix by height and pitch
+- **WHEN** a sketch holds a 20 mm circle and `create_helix` is called with
+ `height` 48 and `pitch` 6
+- **THEN** a helix is made, and the reply gives 8 revolutions, a 20 mm
+ diameter, its length and its start point
+
+#### Scenario: The values that define it are checked first
+- **WHEN** `defined_by` is `height_and_revolutions` and `revolutions` is
+ missing, or any of height, pitch or revolutions is zero or negative
+- **THEN** the call fails as `invalid_input` naming the field, and nothing
+ is made
+
+#### Scenario: The base sketch must be one circle
+- **WHEN** the named sketch doesn't exist, or holds anything other than
+ exactly one circle
+- **THEN** the call fails, saying what the sketch holds, and nothing is made
+
+#### Scenario: A flat spiral
+- **WHEN** `defined_by` is `spiral` with `pitch` 5 and `revolutions` 3
+- **THEN** a spiral is made in the sketch's plane and the reply's height is 0
+
diff --git a/openspec/specs/tools/swept-features/spec.md b/openspec/specs/tools/swept-features/spec.md
new file mode 100644
index 00000000..8ef2a945
--- /dev/null
+++ b/openspec/specs/tools/swept-features/spec.md
@@ -0,0 +1,48 @@
+# tools/swept-features Specification
+
+## Purpose
+TBD - created by archiving change helix-and-swept-cuts. Update Purpose after archive.
+## Requirements
+### Requirement: Sweeps that add or remove material
+`create_sweep` SHALL sweep a closed profile along a path and add material;
+`create_cut_sweep` SHALL do the same and remove material. The path is a
+sketch or a curve such as a helix, named by `path`. The profile is, in
+order of preference: a circle of `circular_profile_diameter` mm (no profile
+sketch), the sketch named by `profile`, or the sketch closed last that
+isn't the path. Both take `twist_along_path` and `twist_angle` (degrees);
+`create_sweep` keeps `merge_result`.
+
+#### Scenario: A named profile
+- **WHEN** `create_sweep` is called with `path` and `profile` naming two
+ sketches
+- **THEN** that profile is swept along that path, whatever sketch was
+ closed last
+
+#### Scenario: A circle with no profile sketch
+- **WHEN** `create_sweep` is called with a helix as `path` and
+ `circular_profile_diameter` 2
+- **THEN** a 2 mm wire is swept along the helix, and the reply says the
+ profile was a 2 mm circle
+
+#### Scenario: A cut sweep removes material
+- **WHEN** `create_cut_sweep` sweeps a closed profile that overlaps a solid
+ along a helix
+- **THEN** the part's volume goes down, and the reply gives the volume
+ before, after and the change
+
+#### Scenario: The profile is unclear
+- **WHEN** neither `profile` nor `circular_profile_diameter` is given and
+ no sketch other than the path exists, or `profile` names the path itself
+- **THEN** the call fails as `invalid_input`, naming the sketches found
+
+### Requirement: A sweep is judged by the volume
+Both sweeps SHALL report the part's volume before and after and the change
+in mm³. A sweep that changes nothing, or changes it the wrong way (a cut
+that adds), SHALL be removed again and reported as an error, so a failed
+sweep never stays in the tree.
+
+#### Scenario: A cut that misses the part
+- **WHEN** `create_cut_sweep` sweeps a profile that doesn't touch the solid
+- **THEN** the call fails saying the volume didn't change, and the feature
+ is not left in the tree
+
diff --git a/src/solidworks_mcp/adapters/appearance_rules.py b/src/solidworks_mcp/adapters/appearance_rules.py
new file mode 100644
index 00000000..1f535f5a
--- /dev/null
+++ b/src/solidworks_mcp/adapters/appearance_rules.py
@@ -0,0 +1,255 @@
+"""Rules shared by the appearance and reference-extras adapters (queue items 36, 39).
+
+Pure functions, used by the SolidWorks adapter and the mock alike, so both
+refuse the same inputs with the same words and shape replies the same way:
+
+- :func:`target_kind` says which one target a call names, refusing two.
+- :func:`parse_color` reads ``[r, g, b]`` or ``#rrggbb``;
+ :func:`material_values` and :func:`color_reply` convert to and from
+ SolidWorks's nine material values.
+- :func:`section_reply` and :func:`transform_reply` read SolidWorks's
+ section-property and coordinate-system arrays (metres) into mm.
+
+The array layouts were measured on SolidWorks 2026 (design.md).
+"""
+
+from __future__ import annotations
+
+import re
+from collections.abc import Sequence
+from typing import Any
+
+from ..exceptions import InputRefused
+from .base import AppearanceParameters, AppearanceTarget
+
+#: SolidWorks's shading values a new colour keeps: ambient, diffuse,
+#: specular, shininess (read from a new part's colour on SolidWorks 2026).
+SHADING = (1.0, 1.0, 0.5, 0.3125)
+#: The levels a colour can come from, the one that shows first: SolidWorks's
+#: appearance hierarchy (a face over its feature over its body over the part).
+LEVELS = ("face", "feature", "body", "part")
+_HEX = re.compile(r"^#?([0-9a-fA-F]{6})$")
+#: ``GetSectionProperties2``'s status for a section it computed.
+SECTION_OK = 0
+
+
+def target_kind(target: AppearanceTarget) -> str:
+ """The one target a call names: ``part``, ``feature``, ``body`` or ``face``.
+
+ Args:
+ target: The call's target fields.
+
+ Returns:
+ str: The target's kind; ``part`` when none is given.
+
+ Raises:
+ InputRefused: More than one target, or a ``face_point`` that isn't
+ three numbers.
+
+ Example:
+ >>> target_kind(AppearanceTarget(feature="Boss-Extrude1"))
+ 'feature'
+ """
+ given = [
+ kind
+ for kind, value in (
+ ("feature", target.feature),
+ ("body", target.body),
+ ("face", target.face_point),
+ )
+ if value is not None
+ ]
+ if len(given) > 1:
+ raise InputRefused(
+ f"Give one target, not {' and '.join(given)}: a feature, a body, "
+ "a face_point, or none for the whole part."
+ )
+ if target.face_point is not None and len(target.face_point) != 3:
+ raise InputRefused("face_point must be [x, y, z] in mm.")
+ return given[0] if given else "part"
+
+
+def parse_color(value: Sequence[int] | str | None) -> tuple[int, int, int]:
+ """An ``[r, g, b]`` (0-255) or ``#rrggbb`` colour as three ints.
+
+ Args:
+ value: The colour as the caller gave it.
+
+ Returns:
+ tuple[int, int, int]: Red, green and blue, 0-255.
+
+ Raises:
+ InputRefused: No colour, or one that isn't three 0-255 values or a
+ six-digit hex string.
+
+ Example:
+ >>> parse_color("#1fcc33")
+ (31, 204, 51)
+ """
+ if value is None:
+ raise InputRefused(
+ "Give a color, [r, g, b] 0-255 or '#rrggbb', or reset: true to remove one."
+ )
+ if isinstance(value, str):
+ match = _HEX.match(value.strip())
+ if not match:
+ raise InputRefused(f"color '{value}' is not '#rrggbb'.")
+ digits = match.group(1)
+ red, green, blue = (int(digits[i : i + 2], 16) for i in (0, 2, 4))
+ return red, green, blue
+ if len(value) != 3 or not all(0 <= int(v) <= 255 for v in value):
+ raise InputRefused(f"color {list(value)} must be [r, g, b], each 0 to 255.")
+ return int(value[0]), int(value[1]), int(value[2])
+
+
+def check_set(params: AppearanceParameters) -> str:
+ """Refuse a ``set_appearance`` call that can't work; return its target kind.
+
+ Args:
+ params: The call.
+
+ Returns:
+ str: The target's kind.
+
+ Raises:
+ InputRefused: Two targets, a reset of the whole part, a colour with
+ a reset, no colour without one, or a transparency outside 0-1.
+ """
+ kind = target_kind(params)
+ if params.reset:
+ if kind == "part":
+ raise InputRefused(
+ "reset removes a feature's, body's or face's own colour; the "
+ "part's colour is the base. Give the part a colour instead."
+ )
+ if params.color is not None:
+ raise InputRefused("Give a color or reset: true, not both.")
+ return kind
+ parse_color(params.color)
+ if not 0.0 <= params.transparency <= 1.0:
+ raise InputRefused(
+ f"transparency must be 0 (opaque) to 1 (clear), not {params.transparency}."
+ )
+ return kind
+
+
+def material_values(rgb: tuple[int, int, int], transparency: float) -> list[float]:
+ """SolidWorks's nine material values for a colour.
+
+ Args:
+ rgb: Red, green and blue, 0-255.
+ transparency: 0 to 1.
+
+ Returns:
+ list[float]: R, G, B (0-1), ambient, diffuse, specular, shininess,
+ transparency, emission.
+ """
+ return [c / 255.0 for c in rgb] + [*SHADING, float(transparency), 0.0]
+
+
+def color_reply(values: Any) -> dict[str, Any] | None:
+ """A colour read from SolidWorks, or None when the target has none.
+
+ SolidWorks gives no colour as ``None`` (a face) or nine ``-1`` (a
+ feature).
+
+ Args:
+ values: The nine material values, or None.
+
+ Returns:
+ dict[str, Any] | None: ``color`` ``[r, g, b]`` 0-255, ``hex`` and
+ ``transparency``; None when there is no colour.
+
+ Example:
+ >>> color_reply([0.1, 0.8, 0.2, 1, 1, 0.5, 0.3125, 0, 0])["hex"]
+ '#1acc33'
+ """
+ if not isinstance(values, (list, tuple)) or len(values) < 8:
+ return None
+ if all(float(v) < 0 for v in values[:3]):
+ return None
+ rgb = [round(float(v) * 255) for v in values[:3]]
+ return {
+ "color": rgb,
+ "hex": "#{:02x}{:02x}{:02x}".format(*rgb),
+ "transparency": round(float(values[7]), 3),
+ }
+
+
+def section_reply(values: Any) -> dict[str, Any]:
+ """A face's section properties, in mm, from ``GetSectionProperties2``.
+
+ Args:
+ values: SolidWorks's array: status, area (m²), centroid (m), six
+ moments at the centroid (m⁴), the polar moment, the principal
+ axes' angle, the two principal moments.
+
+ Returns:
+ dict[str, Any]: ``area_mm2``, ``centroid_mm``, ``ixx`` ... ``iyz``
+ (mm⁴), ``polar_moment_mm4`` and ``principal_moments_mm4``.
+
+ Raises:
+ InputRefused: SolidWorks returned nothing or a status other than ok.
+ """
+ if not isinstance(values, (list, tuple)) or len(values) < 15:
+ raise InputRefused(
+ "SolidWorks gave no section properties for that face; pick a "
+ "point on a planar face."
+ )
+ if int(values[0]) != SECTION_OK:
+ raise InputRefused(
+ f"SolidWorks couldn't take a section of that face (status "
+ f"{int(values[0])}); pick a point on a planar face."
+ )
+ mm4 = 1e12
+ names = ("ixx", "iyy", "izz", "ixy", "izx", "iyz")
+ reply: dict[str, Any] = {
+ "area_mm2": round(float(values[1]) * 1e6, 4),
+ "centroid_mm": [round(float(v) * 1000, 4) for v in values[2:5]],
+ }
+ reply.update(
+ {
+ name: round(float(v) * mm4, 2)
+ for name, v in zip(names, values[5:11], strict=True)
+ }
+ )
+ reply["polar_moment_mm4"] = round(float(values[11]) * mm4, 2)
+ reply["principal_moments_mm4"] = [round(float(v) * mm4, 2) for v in values[13:15]]
+ return reply
+
+
+def transform_reply(array: Any) -> dict[str, Any]:
+ """A coordinate system's origin and axes from its transform's ``ArrayData``.
+
+ Args:
+ array: SolidWorks's 16 values: the 3x3 rotation by rows, the origin
+ (m), the scale and three unused.
+
+ Returns:
+ dict[str, Any]: ``origin_mm`` and ``x_axis``, ``y_axis``, ``z_axis``.
+
+ Raises:
+ RuntimeError: The transform couldn't be read.
+ """
+ if not isinstance(array, (list, tuple)) or len(array) < 12:
+ raise RuntimeError("Could not read the coordinate system's transform.")
+ axes = [[round(float(v), 6) + 0.0 for v in array[i : i + 3]] for i in (0, 3, 6)]
+ return {
+ "origin_mm": [round(float(v) * 1000, 4) for v in array[9:12]],
+ "x_axis": axes[0],
+ "y_axis": axes[1],
+ "z_axis": axes[2],
+ }
+
+
+def model_axes() -> dict[str, list[float]]:
+ """The axes of a coordinate system along the model's.
+
+ Returns:
+ dict[str, list[float]]: ``x_axis``, ``y_axis`` and ``z_axis``.
+ """
+ return {
+ "x_axis": [1.0, 0.0, 0.0],
+ "y_axis": [0.0, 1.0, 0.0],
+ "z_axis": [0.0, 0.0, 1.0],
+ }
diff --git a/src/solidworks_mcp/adapters/base.py b/src/solidworks_mcp/adapters/base.py
index a43b5772..f7628ea4 100644
--- a/src/solidworks_mcp/adapters/base.py
+++ b/src/solidworks_mcp/adapters/base.py
@@ -397,6 +397,64 @@ class ScaleBodyParameters(BaseModel):
bodies: list[str] | None = None
+class AppearanceTarget(BaseModel):
+ """What a colour is read from or set on: one of these, or none for the part.
+
+ Attributes:
+ feature (str | None): A feature, by its name in the tree.
+ body (str | None): A solid body, as ``list_bodies`` names it.
+ face_point (list[float] | None): ``[x, y, z]`` mm on a face.
+ """
+
+ feature: str | None = None
+ body: str | None = None
+ face_point: list[float] | None = None
+
+
+class AppearanceParameters(AppearanceTarget):
+ """A colour to set on a target, or ``reset`` to remove the target's own.
+
+ Attributes:
+ color (list[int] | str | None): ``[r, g, b]`` 0-255 or ``#rrggbb``.
+ transparency (float): 0 opaque to 1 clear.
+ reset (bool): Remove the target's own colour instead.
+ """
+
+ color: list[int] | str | None = None
+ transparency: float = 0.0
+ reset: bool = False
+
+
+class CoordinateSystemParameters(BaseModel):
+ """A coordinate system at a point, with the model's axes.
+
+ Attributes:
+ origin (list[float]): ``[x, y, z]`` mm.
+ """
+
+ origin: list[float]
+
+
+class BoundingBoxParameters(BaseModel):
+ """SolidWorks's Bounding Box feature around the part's bodies.
+
+ Attributes:
+ include_hidden (bool): Include hidden bodies.
+ """
+
+ include_hidden: bool = False
+
+
+class SectionPropertiesParameters(BaseModel):
+ """A planar face, picked by a point on it.
+
+ Attributes:
+ face_point (list[float]): ``[x, y, z]`` mm on the face.
+ """
+
+ face_point: list[float]
+
+
class LoftParameters(BaseModel):
"""Parameters for loft operations.
@@ -926,6 +984,97 @@ async def scale_body(
error="scale_body is not implemented by this adapter",
)
+ async def set_appearance(
+ self, params: AppearanceParameters
+ ) -> AdapterResult[dict[str, Any]]:
+ """Colour the part, a feature, a body or a face, or remove a colour.
+
+ Args:
+ params: The target, the colour and transparency, or ``reset``.
+
+ Returns:
+ AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
+ """
+ return AdapterResult(
+ status=AdapterResultStatus.ERROR,
+ error="set_appearance is not implemented by this adapter",
+ )
+
+ async def get_appearance(
+ self, params: AppearanceTarget
+ ) -> AdapterResult[dict[str, Any]]:
+ """Read the colour a target shows, and the level it comes from.
+
+ Args:
+ params: The target; none for the part.
+
+ Returns:
+ AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
+ """
+ return AdapterResult(
+ status=AdapterResultStatus.ERROR,
+ error="get_appearance is not implemented by this adapter",
+ )
+
+ async def create_coordinate_system(
+ self, params: CoordinateSystemParameters
+ ) -> AdapterResult[dict[str, Any]]:
+ """A coordinate system at a point, with the model's axes.
+
+ Args:
+ params: The origin.
+
+ Returns:
+ AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
+ """
+ return AdapterResult(
+ status=AdapterResultStatus.ERROR,
+ error="create_coordinate_system is not implemented by this adapter",
+ )
+
+ async def create_center_of_mass_point(self) -> AdapterResult[dict[str, Any]]:
+ """SolidWorks's Center of Mass reference point on the active part.
+
+ Returns:
+ AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
+ """
+ return AdapterResult(
+ status=AdapterResultStatus.ERROR,
+ error="create_center_of_mass_point is not implemented by this adapter",
+ )
+
+ async def create_bounding_box(
+ self, params: BoundingBoxParameters
+ ) -> AdapterResult[dict[str, Any]]:
+ """SolidWorks's Bounding Box feature around the part's bodies.
+
+ Args:
+ params: Whether to include hidden bodies.
+
+ Returns:
+ AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
+ """
+ return AdapterResult(
+ status=AdapterResultStatus.ERROR,
+ error="create_bounding_box is not implemented by this adapter",
+ )
+
+ async def get_section_properties(
+ self, params: SectionPropertiesParameters
+ ) -> AdapterResult[dict[str, Any]]:
+ """Area, centroid and second moments of area of a planar face.
+
+ Args:
+ params: A point on the face.
+
+ Returns:
+ AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
+ """
+ return AdapterResult(
+ status=AdapterResultStatus.ERROR,
+ error="get_section_properties is not implemented by this adapter",
+ )
+
@abstractmethod
async def create_loft(
self, params: LoftParameters
diff --git a/src/solidworks_mcp/adapters/circuit_breaker.py b/src/solidworks_mcp/adapters/circuit_breaker.py
index d91b92db..8d3a0e41 100644
--- a/src/solidworks_mcp/adapters/circuit_breaker.py
+++ b/src/solidworks_mcp/adapters/circuit_breaker.py
@@ -17,7 +17,11 @@
AdapterHealth,
AdapterResult,
AdapterResultStatus,
+ AppearanceParameters,
+ AppearanceTarget,
+ BoundingBoxParameters,
CombineBodiesParameters,
+ CoordinateSystemParameters,
DeleteBodiesParameters,
ExtrusionParameters,
HelixParameters,
@@ -26,6 +30,7 @@
MoveCopyBodyParameters,
RevolveParameters,
ScaleBodyParameters,
+ SectionPropertiesParameters,
SolidWorksAdapter,
SolidWorksFeature,
SolidWorksModel,
@@ -1353,6 +1358,64 @@ async def scale_body(
input_dict=_to_input_dict(params),
)
+ async def set_appearance(
+ self, params: AppearanceParameters
+ ) -> AdapterResult[dict[str, Any]]:
+ """Colour a target, or remove its colour. Through the circuit breaker."""
+ return await self._execute_with_circuit_breaker(
+ "set_appearance",
+ lambda: self.adapter.set_appearance(params),
+ input_dict=_to_input_dict(params),
+ )
+
+ async def get_appearance(
+ self, params: AppearanceTarget
+ ) -> AdapterResult[dict[str, Any]]:
+ """Read a target's colour. Through the circuit breaker."""
+ return await self._execute_with_circuit_breaker(
+ "get_appearance",
+ lambda: self.adapter.get_appearance(params),
+ input_dict=_to_input_dict(params),
+ )
+
+ async def create_coordinate_system(
+ self, params: CoordinateSystemParameters
+ ) -> AdapterResult[dict[str, Any]]:
+ """A coordinate system at a point. Through the circuit breaker."""
+ return await self._execute_with_circuit_breaker(
+ "create_coordinate_system",
+ lambda: self.adapter.create_coordinate_system(params),
+ input_dict=_to_input_dict(params),
+ )
+
+ async def create_center_of_mass_point(self) -> AdapterResult[dict[str, Any]]:
+ """The Center of Mass point. Through the circuit breaker."""
+ return await self._execute_with_circuit_breaker(
+ "create_center_of_mass_point",
+ lambda: self.adapter.create_center_of_mass_point(),
+ input_dict={},
+ )
+
+ async def create_bounding_box(
+ self, params: BoundingBoxParameters
+ ) -> AdapterResult[dict[str, Any]]:
+ """The Bounding Box feature. Through the circuit breaker."""
+ return await self._execute_with_circuit_breaker(
+ "create_bounding_box",
+ lambda: self.adapter.create_bounding_box(params),
+ input_dict=_to_input_dict(params),
+ )
+
+ async def get_section_properties(
+ self, params: SectionPropertiesParameters
+ ) -> AdapterResult[dict[str, Any]]:
+ """A face's section properties. Through the circuit breaker."""
+ return await self._execute_with_circuit_breaker(
+ "get_section_properties",
+ lambda: self.adapter.get_section_properties(params),
+ input_dict=_to_input_dict(params),
+ )
+
async def create_loft(
self, params: LoftParameters
) -> AdapterResult[SolidWorksFeature]:
diff --git a/src/solidworks_mcp/adapters/connection_pool.py b/src/solidworks_mcp/adapters/connection_pool.py
index 26dfea53..5a3143e7 100644
--- a/src/solidworks_mcp/adapters/connection_pool.py
+++ b/src/solidworks_mcp/adapters/connection_pool.py
@@ -16,7 +16,11 @@
AdapterHealth,
AdapterResult,
AdapterResultStatus,
+ AppearanceParameters,
+ AppearanceTarget,
+ BoundingBoxParameters,
CombineBodiesParameters,
+ CoordinateSystemParameters,
DeleteBodiesParameters,
ExtrusionParameters,
HelixParameters,
@@ -25,6 +29,7 @@
MoveCopyBodyParameters,
RevolveParameters,
ScaleBodyParameters,
+ SectionPropertiesParameters,
SolidWorksAdapter,
SolidWorksFeature,
SolidWorksModel,
@@ -1171,6 +1176,55 @@ async def scale_body(
"scale_body", lambda adapter: adapter.scale_body(params)
)
+ async def set_appearance(
+ self, params: AppearanceParameters
+ ) -> AdapterResult[dict[str, Any]]:
+ """Colour a target, or remove its colour. Using the pool."""
+ return await self._execute_with_pool(
+ "set_appearance", lambda adapter: adapter.set_appearance(params)
+ )
+
+ async def get_appearance(
+ self, params: AppearanceTarget
+ ) -> AdapterResult[dict[str, Any]]:
+ """Read a target's colour. Using the pool."""
+ return await self._execute_with_pool(
+ "get_appearance", lambda adapter: adapter.get_appearance(params)
+ )
+
+ async def create_coordinate_system(
+ self, params: CoordinateSystemParameters
+ ) -> AdapterResult[dict[str, Any]]:
+ """A coordinate system at a point. Using the pool."""
+ return await self._execute_with_pool(
+ "create_coordinate_system",
+ lambda adapter: adapter.create_coordinate_system(params),
+ )
+
+ async def create_center_of_mass_point(self) -> AdapterResult[dict[str, Any]]:
+ """The Center of Mass point. Using the pool."""
+ return await self._execute_with_pool(
+ "create_center_of_mass_point",
+ lambda adapter: adapter.create_center_of_mass_point(),
+ )
+
+ async def create_bounding_box(
+ self, params: BoundingBoxParameters
+ ) -> AdapterResult[dict[str, Any]]:
+ """The Bounding Box feature. Using the pool."""
+ return await self._execute_with_pool(
+ "create_bounding_box", lambda adapter: adapter.create_bounding_box(params)
+ )
+
+ async def get_section_properties(
+ self, params: SectionPropertiesParameters
+ ) -> AdapterResult[dict[str, Any]]:
+ """A face's section properties. Using the pool."""
+ return await self._execute_with_pool(
+ "get_section_properties",
+ lambda adapter: adapter.get_section_properties(params),
+ )
+
async def create_loft(
self, params: LoftParameters
) -> AdapterResult[SolidWorksFeature]:
diff --git a/src/solidworks_mcp/adapters/mock_adapter.py b/src/solidworks_mcp/adapters/mock_adapter.py
index 1b1e5a69..d278aefd 100644
--- a/src/solidworks_mcp/adapters/mock_adapter.py
+++ b/src/solidworks_mcp/adapters/mock_adapter.py
@@ -29,9 +29,11 @@
SolidWorksFeature,
SolidWorksModel,
)
+from .mock_appearance import MockAppearanceMixin
from .mock_bodies import MockBodiesMixin
from .mock_drawing_pack import MockDrawingPackMixin
from .mock_equations import MockEquationsMixin
+from .mock_reference_extras import MockReferenceExtrasMixin
from .mock_sheet_metal import MockSheetMetalMixin
from .mock_swept import MockSweptMixin
from .mock_templates import MockTemplatesMixin
@@ -145,6 +147,8 @@ def __bool__(self) -> bool:
class MockSolidWorksAdapter(
+ MockAppearanceMixin,
+ MockReferenceExtrasMixin,
MockBodiesMixin,
MockSheetMetalMixin,
MockSweptMixin,
diff --git a/src/solidworks_mcp/adapters/mock_appearance.py b/src/solidworks_mcp/adapters/mock_appearance.py
new file mode 100644
index 00000000..5392fff5
--- /dev/null
+++ b/src/solidworks_mcp/adapters/mock_appearance.py
@@ -0,0 +1,192 @@
+"""The mock adapter's colours (queue item 36).
+
+Colours are held per open part, by level: the part's, each feature's, each
+body's and each face's (a face by the point that picked it, on one of the
+mock's box bodies, :mod:`mock_bodies`). A face belongs to the body whose box
+it lies on, and to the feature of the same name, as the mock names a body
+after the feature that made it. Refusals use the real adapter's rules
+(:mod:`appearance_rules`).
+"""
+
+from __future__ import annotations
+
+from collections.abc import Callable
+from typing import Any
+
+from ..exceptions import InputRefused
+from . import appearance_rules as rules
+from . import body_rules
+from .base import (
+ AdapterResult,
+ AdapterResultStatus,
+ AppearanceParameters,
+ AppearanceTarget,
+)
+from .body_rules import BodyState
+
+#: A new part's colour, as SolidWorks 2026 reads it.
+_DEFAULT_PART = [0.894118, 0.894118, 0.894118, 1.0, 1.0, 0.5, 0.3125, 0.0, 0.0]
+#: How close a point must be to a box's face to lie on it, mm.
+_ON_FACE = 1e-6
+
+
+def _error(message: str) -> AdapterResult[Any]:
+ """An error result."""
+ return AdapterResult(status=AdapterResultStatus.ERROR, error=message)
+
+
+def face_of(bodies: list[BodyState], point: list[float]) -> tuple[BodyState, int, int]:
+ """The box face a point lies on: the body, the face's normal axis and side.
+
+ Args:
+ bodies: The part's box bodies.
+ point: ``[x, y, z]`` mm.
+
+ Returns:
+ tuple[BodyState, int, int]: The body, the axis (0-2) the face is
+ normal to, and 0 for its low side or 1 for its high side.
+
+ Raises:
+ InputRefused: The point lies on no face.
+ """
+ for body in bodies:
+ inside = all(
+ body.box_min[i] - _ON_FACE <= point[i] <= body.box_max[i] + _ON_FACE
+ for i in range(3)
+ )
+ if not inside:
+ continue
+ for axis in range(3):
+ for side, plane in enumerate((body.box_min[axis], body.box_max[axis])):
+ if abs(point[axis] - plane) <= _ON_FACE:
+ return body, axis, side
+ raise InputRefused(
+ f"No face at {list(point)} mm; give a point on the face's surface."
+ )
+
+
+class MockAppearanceMixin:
+ """``set_appearance`` and ``get_appearance``, in memory."""
+
+ _current_model: Any
+ _features: dict[str, Any]
+ #: From :class:`MockBodiesMixin`: the active part's box bodies.
+ _bodies: Callable[[], list[BodyState]]
+
+ def _colour_store(self) -> dict[tuple[int, str, str], list[float]]:
+ """Each part's colours by ``(part, level, key)``."""
+ if "_mock_colours" not in self.__dict__:
+ self._mock_colours: dict[tuple[int, str, str], list[float]] = {}
+ return self._mock_colours
+
+ def _resolve_target(
+ self, kind: str, target: AppearanceTarget
+ ) -> list[tuple[str, str]]:
+ """The target and the levels above it, as ``(level, key)``, nearest first.
+
+ Raises:
+ InputRefused: The feature, body or face isn't there.
+ """
+ if kind == "feature":
+ names = [f.name for f in self._features.values()]
+ if target.feature not in names:
+ raise InputRefused(
+ f"No feature named '{target.feature}'; list_features names them."
+ )
+ return [("feature", str(target.feature)), ("part", "")]
+ if kind == "body":
+ real = body_rules.resolve_bodies(self._bodies(), [str(target.body)])[0]
+ return [("body", real), ("part", "")]
+ if kind == "face":
+ point = list(target.face_point or [])
+ body, axis, side = face_of(self._bodies(), point)
+ return [
+ ("face", f"{body.name}:{axis}:{side}"),
+ ("feature", body.name),
+ ("body", body.name),
+ ("part", ""),
+ ]
+ return [("part", "")]
+
+ def _values(self, level: str, key: str) -> list[float] | None:
+ """A level's own colour; the part has the default when unset."""
+ own = self._colour_store().get((id(self._current_model), level, key))
+ if own is None and level == "part":
+ return list(_DEFAULT_PART)
+ return own
+
+ def _showing(self, chain: list[tuple[str, str]]) -> dict[str, Any]:
+ """The colour that shows, walking up the chain.
+
+ Every chain ends at the part, which always has a colour here.
+ """
+ level, color = next(
+ (level, color)
+ for level, key in chain
+ if (color := rules.color_reply(self._values(level, key))) is not None
+ )
+ return {**color, "level": level}
+
+ def _named(self, kind: str, target: AppearanceTarget) -> dict[str, Any]:
+ """The reply field naming the target."""
+ field = {"feature": "feature", "body": "body", "face": "face_point"}.get(kind)
+ return {field: getattr(target, field)} if field else {}
+
+ async def set_appearance(
+ self, params: AppearanceParameters
+ ) -> AdapterResult[dict[str, Any]]:
+ """Mock: colour a target, or remove its colour.
+
+ Args:
+ params: The target, the colour and transparency, or ``reset``.
+
+ Returns:
+ AdapterResult[dict[str, Any]]: As the real adapter's.
+ """
+ if not self._current_model:
+ return _error("No active model")
+ try:
+ kind = rules.check_set(params)
+ chain = self._resolve_target(kind, params)
+ except InputRefused as refused:
+ return _error(str(refused))
+ level, key = chain[0]
+ store = self._colour_store()
+ if params.reset:
+ store.pop((id(self._current_model), level, key), None)
+ reply: dict[str, Any] = {"reset": True, "showing": self._showing(chain)}
+ else:
+ rgb = rules.parse_color(params.color)
+ store[(id(self._current_model), level, key)] = rules.material_values(
+ rgb, params.transparency
+ )
+ reply = dict(
+ rules.color_reply(store[(id(self._current_model), level, key)]) or {}
+ )
+ return AdapterResult(
+ status=AdapterResultStatus.SUCCESS,
+ data={"target": kind, **self._named(kind, params), **reply},
+ )
+
+ async def get_appearance(
+ self, params: AppearanceTarget
+ ) -> AdapterResult[dict[str, Any]]:
+ """Mock: the colour a target shows and its level.
+
+ Args:
+ params: The target; none for the part.
+
+ Returns:
+ AdapterResult[dict[str, Any]]: As the real adapter's.
+ """
+ if not self._current_model:
+ return _error("No active model")
+ try:
+ kind = rules.target_kind(params)
+ chain = self._resolve_target(kind, params)
+ except InputRefused as refused:
+ return _error(str(refused))
+ return AdapterResult(
+ status=AdapterResultStatus.SUCCESS,
+ data={"target": kind, **self._named(kind, params), **self._showing(chain)},
+ )
diff --git a/src/solidworks_mcp/adapters/mock_bodies.py b/src/solidworks_mcp/adapters/mock_bodies.py
index 30bb941e..47452384 100644
--- a/src/solidworks_mcp/adapters/mock_bodies.py
+++ b/src/solidworks_mcp/adapters/mock_bodies.py
@@ -183,7 +183,7 @@ async def _body_operation(
operation: str,
change: Callable[[list[BodyState], str], list[BodyState]],
verdict: Callable[[list[BodyState], list[BodyState]], tuple[str, bool]],
- extra: Callable[[], dict[str, Any]],
+ own_fields: Callable[[], dict[str, Any]],
) -> AdapterResult[dict[str, Any]]:
"""Apply one body operation and judge it by its rule.
@@ -193,7 +193,7 @@ async def _body_operation(
change: Gives the bodies after, from those before and the
feature's name; raises InputRefused to refuse.
verdict: The rule: the expectation in words and whether it held.
- extra: The reply's own fields, read after ``change``.
+ own_fields: The reply's own fields, read after ``change``.
Returns:
AdapterResult[dict[str, Any]]: The measured reply, or the
@@ -217,7 +217,7 @@ async def _body_operation(
self._body_store()[id(self._current_model)] = after
return AdapterResult(
status=AdapterResultStatus.SUCCESS,
- data={**rules.measured_reply(feature, before, after), **extra()},
+ data={**rules.measured_reply(feature, before, after), **own_fields()},
execution_time=self._delays["feature_operation"],
)
diff --git a/src/solidworks_mcp/adapters/mock_reference_extras.py b/src/solidworks_mcp/adapters/mock_reference_extras.py
new file mode 100644
index 00000000..6000c793
--- /dev/null
+++ b/src/solidworks_mcp/adapters/mock_reference_extras.py
@@ -0,0 +1,215 @@
+"""The mock adapter's reference and analysis extras (queue item 39).
+
+Worked out from the mock's box bodies (:mod:`mock_bodies`):
+
+- the centre of mass is the volume-weighted centre of the boxes;
+- the bounding box is the box around them;
+- a face's section is a rectangle (the box face the point lies on), its
+ second moments those of a rectangle about its centroid;
+- a coordinate system has the model's axes.
+
+A part has one Center of Mass point and one bounding box at most, as on
+SolidWorks.
+"""
+
+from __future__ import annotations
+
+from collections.abc import Callable
+from typing import Any
+
+from ..exceptions import InputRefused
+from . import appearance_rules as rules
+from .base import (
+ AdapterResult,
+ AdapterResultStatus,
+ BoundingBoxParameters,
+ CoordinateSystemParameters,
+ SectionPropertiesParameters,
+)
+from .body_rules import BodyState
+from .mock_appearance import face_of
+
+
+def _error(message: str) -> AdapterResult[Any]:
+ """An error result."""
+ return AdapterResult(status=AdapterResultStatus.ERROR, error=message)
+
+
+def _ok(data: dict[str, Any]) -> AdapterResult[dict[str, Any]]:
+ """A success result."""
+ return AdapterResult(status=AdapterResultStatus.SUCCESS, data=data)
+
+
+def rectangle_section(body: BodyState, axis: int, side: int) -> dict[str, Any]:
+ """A box face's section properties, in mm, as ``section_reply`` gives them.
+
+ Args:
+ body: The box.
+ axis: The axis the face is normal to.
+ side: 0 for the box's low face, 1 for its high face.
+
+ Returns:
+ dict[str, Any]: ``area_mm2``, ``centroid_mm``, the six moments,
+ ``polar_moment_mm4`` and ``principal_moments_mm4``.
+ """
+ lengths = [body.box_max[i] - body.box_min[i] for i in range(3)]
+ lengths[axis] = 0.0
+ centroid = [(body.box_min[i] + body.box_max[i]) / 2 for i in range(3)]
+ centroid[axis] = (body.box_min[axis], body.box_max[axis])[side]
+ area = 1.0
+ for i in range(3):
+ if i != axis:
+ area *= lengths[i]
+ # S_j: the integral of the squared distance along axis j over the face.
+ spread = [area * length**2 / 12 for length in lengths]
+ moments = [sum(spread[j] for j in range(3) if j != i) for i in range(3)]
+ in_plane = sorted(moments[i] for i in range(3) if i != axis)
+ return {
+ "area_mm2": round(area, 4),
+ "centroid_mm": [round(v, 4) for v in centroid],
+ "ixx": round(moments[0], 2),
+ "iyy": round(moments[1], 2),
+ "izz": round(moments[2], 2),
+ "ixy": 0.0,
+ "izx": 0.0,
+ "iyz": 0.0,
+ "polar_moment_mm4": round(moments[axis], 2),
+ "principal_moments_mm4": [round(v, 2) for v in in_plane],
+ }
+
+
+class MockReferenceExtrasMixin:
+ """Coordinate system, centre of mass, bounding box, section properties."""
+
+ _current_model: Any
+ #: From :class:`MockBodiesMixin`: the active part's box bodies.
+ _bodies: Callable[[], list[BodyState]]
+
+ def _reference_store(self) -> dict[int, dict[str, Any]]:
+ """Each part's coordinate-system count, COM point and bounding box."""
+ if "_mock_reference" not in self.__dict__:
+ self._mock_reference: dict[int, dict[str, Any]] = {}
+ return self._mock_reference
+
+ def _part_reference(self) -> dict[str, Any]:
+ """The active part's entry."""
+ return self._reference_store().setdefault(
+ id(self._current_model), {"systems": 0}
+ )
+
+ async def create_coordinate_system(
+ self, params: CoordinateSystemParameters
+ ) -> AdapterResult[dict[str, Any]]:
+ """Mock: a coordinate system at a point.
+
+ Args:
+ params: The origin (mm).
+
+ Returns:
+ AdapterResult[dict[str, Any]]: As the real adapter's.
+ """
+ if not self._current_model:
+ return _error("No active model")
+ if len(params.origin) != 3:
+ return _error("origin must be [x, y, z] in mm.")
+ entry = self._part_reference()
+ entry["systems"] += 1
+ count = entry["systems"]
+ return _ok(
+ {
+ "name": f"Coordinate System{count}",
+ "sketch": f"3DSketch{count}",
+ "origin_mm": [float(v) for v in params.origin],
+ **rules.model_axes(),
+ }
+ )
+
+ async def create_center_of_mass_point(self) -> AdapterResult[dict[str, Any]]:
+ """Mock: the Center of Mass point.
+
+ Returns:
+ AdapterResult[dict[str, Any]]: As the real adapter's.
+ """
+ if not self._current_model:
+ return _error("No active model")
+ bodies = self._bodies()
+ if not bodies:
+ return _error("The part has no solid body, so no centre of mass.")
+ entry = self._part_reference()
+ if entry.get("com"):
+ return _error(
+ "The part has a Center of Mass point already ('Center of Mass'); "
+ "a part has one at most."
+ )
+ entry["com"] = True
+ total = sum(b.volume for b in bodies)
+ centre = [
+ sum(b.volume * (b.box_min[i] + b.box_max[i]) / 2 for b in bodies) / total
+ for i in range(3)
+ ]
+ return _ok(
+ {
+ "name": "Center of Mass",
+ "center_of_mass_mm": [round(v, 4) for v in centre],
+ }
+ )
+
+ async def create_bounding_box(
+ self, params: BoundingBoxParameters
+ ) -> AdapterResult[dict[str, Any]]:
+ """Mock: the Bounding Box feature.
+
+ Args:
+ params: Whether to include hidden bodies (the mock has none).
+
+ Returns:
+ AdapterResult[dict[str, Any]]: As the real adapter's.
+ """
+ if not self._current_model:
+ return _error("No active model")
+ bodies = self._bodies()
+ if not bodies:
+ return _error("The part has no solid body to box.")
+ entry = self._part_reference()
+ if entry.get("box"):
+ return _error(
+ "The part has a bounding box already ('Bounding Box'); a part "
+ "has one at most."
+ )
+ entry["box"] = True
+ low = [min(b.box_min[i] for b in bodies) for i in range(3)]
+ high = [max(b.box_max[i] for b in bodies) for i in range(3)]
+ return _ok(
+ {
+ "name": "Bounding Box",
+ "size_mm": [round(high[i] - low[i], 4) for i in range(3)],
+ "min_mm": low,
+ "max_mm": high,
+ }
+ )
+
+ async def get_section_properties(
+ self, params: SectionPropertiesParameters
+ ) -> AdapterResult[dict[str, Any]]:
+ """Mock: a box face's section properties.
+
+ Args:
+ params: A point on the face (mm).
+
+ Returns:
+ AdapterResult[dict[str, Any]]: As the real adapter's.
+ """
+ if not self._current_model:
+ return _error("No active model")
+ if len(params.face_point) != 3:
+ return _error("face_point must be [x, y, z] in mm.")
+ try:
+ body, axis, side = face_of(self._bodies(), list(params.face_point))
+ except InputRefused as refused:
+ return _error(str(refused))
+ return _ok(
+ {
+ "face_point": list(params.face_point),
+ **rectangle_section(body, axis, side),
+ }
+ )
diff --git a/src/solidworks_mcp/adapters/pywin32_adapter.py b/src/solidworks_mcp/adapters/pywin32_adapter.py
index 1192a29e..55067365 100644
--- a/src/solidworks_mcp/adapters/pywin32_adapter.py
+++ b/src/solidworks_mcp/adapters/pywin32_adapter.py
@@ -25,6 +25,7 @@
SolidWorksAdapter,
)
from .solidworks import (
+ SolidWorksAppearanceMixin,
SolidWorksAssemblyMixin,
SolidWorksBodiesMixin,
SolidWorksConfigurationsMixin,
@@ -35,6 +36,7 @@
SolidWorksFeaturesMixin,
SolidWorksIOMixin,
SolidWorksPartFeaturesMixin,
+ SolidWorksReferenceExtrasMixin,
SolidWorksSelectionMixin,
SolidWorksSheetMetalMixin,
SolidWorksSketchMixin,
@@ -1724,6 +1726,8 @@ def _is_feature_suppressed(self, feature: Any) -> bool:
class PyWin32Adapter(
+ SolidWorksAppearanceMixin,
+ SolidWorksReferenceExtrasMixin,
SolidWorksAssemblyMixin,
SolidWorksBodiesMixin,
SolidWorksSheetMetalMixin,
diff --git a/src/solidworks_mcp/adapters/solidworks/__init__.py b/src/solidworks_mcp/adapters/solidworks/__init__.py
index 74b88d9c..85c03529 100644
--- a/src/solidworks_mcp/adapters/solidworks/__init__.py
+++ b/src/solidworks_mcp/adapters/solidworks/__init__.py
@@ -1,5 +1,6 @@
"""Grouped SolidWorks mixins for the PyWin32 adapter."""
+from .appearance import SolidWorksAppearanceMixin
from .assembly import SolidWorksAssemblyMixin
from .bodies import SolidWorksBodiesMixin
from .configurations import SolidWorksConfigurationsMixin
@@ -10,6 +11,7 @@
from .features import SolidWorksFeaturesMixin
from .io import SolidWorksIOMixin
from .part_features import SolidWorksPartFeaturesMixin
+from .reference_extras import SolidWorksReferenceExtrasMixin
from .selection import SolidWorksSelectionMixin
from .sheet_metal import SolidWorksSheetMetalMixin
from .sketch import SolidWorksSketchMixin
@@ -17,6 +19,7 @@
from .templates import SolidWorksTemplatesMixin
__all__ = [
+ "SolidWorksAppearanceMixin",
"SolidWorksAssemblyMixin",
"SolidWorksBodiesMixin",
"SolidWorksConfigurationsMixin",
@@ -27,6 +30,7 @@
"SolidWorksFeaturesMixin",
"SolidWorksIOMixin",
"SolidWorksPartFeaturesMixin",
+ "SolidWorksReferenceExtrasMixin",
"SolidWorksSelectionMixin",
"SolidWorksSheetMetalMixin",
"SolidWorksSketchMixin",
diff --git a/src/solidworks_mcp/adapters/solidworks/appearance.py b/src/solidworks_mcp/adapters/solidworks/appearance.py
new file mode 100644
index 00000000..9fe5480a
--- /dev/null
+++ b/src/solidworks_mcp/adapters/solidworks/appearance.py
@@ -0,0 +1,269 @@
+"""Colours on SolidWorks: set, remove and read a part's, feature's, body's or face's.
+
+A colour is SolidWorks's nine material values, passed as a ``VT_R8`` array
+(a plain list is misread). Each level has its own call, measured on
+SolidWorks 2026 (design.md of the ``appearance-and-reference-tools`` change):
+
+- part: ``IModelDoc2.MaterialPropertyValues`` (a property);
+- feature: ``IFeature.SetMaterialPropertyValues2`` /
+ ``GetMaterialPropertyValues2`` / ``RemoveMaterialProperty2`` (nine ``-1``
+ when it has none);
+- body: ``IBody2.MaterialPropertyValues2`` / ``RemoveMaterialProperty``;
+- face: ``IFace2.MaterialPropertyValues`` (``None`` when it has none) /
+ ``RemoveMaterialProperty2``.
+
+Every call runs inside :meth:`_handle_com_operation`, on the connect thread.
+"""
+
+from __future__ import annotations
+
+from typing import Any, cast
+
+from ...exceptions import InputRefused
+from .. import appearance_rules as rules
+from .. import body_rules, sw_type_info
+from ..base import (
+ AdapterResult,
+ AdapterResultStatus,
+ AppearanceParameters,
+ AppearanceTarget,
+)
+from .com_utils import double_array
+from .features import _null_callout
+
+#: ``swInConfigurationOpts_e.swThisConfiguration``.
+_THIS_CONFIGURATION = 1
+
+
+class SolidWorksAppearanceMixin:
+ """``set_appearance`` and ``get_appearance`` on SolidWorks."""
+
+ def _face_at(self, point: list[float]) -> Any:
+ """The face at ``point`` (mm), with the selection cleared after.
+
+ Args:
+ point: ``[x, y, z]`` mm on the face.
+
+ Returns:
+ Any: The ``IFace2`` dispatch.
+
+ Raises:
+ InputRefused: No face lies at the point.
+ """
+ adapter: Any = self
+ face = select_face_at(adapter, point)
+ adapter._attempt(lambda: adapter.currentModel.ClearSelection2(True))
+ return face
+
+ def _feature_named(self, name: str) -> Any:
+ """The feature ``name``, flagged, or a refusal."""
+ adapter: Any = self
+ feature = adapter._attempt(lambda: adapter.currentModel.FeatureByName(name))
+ if feature is None:
+ raise InputRefused(f"No feature named '{name}'; list_features names them.")
+ return sw_type_info.flagged(feature, "IFeature")
+
+ def _body_named(self, name: str) -> Any:
+ """The body ``name`` (ignoring case), flagged, or a refusal listing them."""
+ adapter: Any = self
+ measured = adapter._measure_bodies()
+ real = body_rules.resolve_bodies([state for state, _ in measured], [name])[0]
+ body = next(body for state, body in measured if state.name == real)
+ return sw_type_info.flagged(body, "IBody2")
+
+ def _appearance_target(self, kind: str, target: AppearanceTarget) -> Any:
+ """The dispatch a target names: the model, a feature, a body or a face."""
+ adapter: Any = self
+ if kind == "feature":
+ return self._feature_named(str(target.feature))
+ if kind == "body":
+ return self._body_named(str(target.body))
+ if kind == "face":
+ return self._face_at(list(target.face_point or []))
+ return adapter.currentModel
+
+ def _own_values(self, kind: str, dispatch: Any) -> Any:
+ """The target's own nine material values, or None/-1s when it has none."""
+ adapter: Any = self
+ readers = {
+ "part": lambda: dispatch.MaterialPropertyValues,
+ "feature": lambda: dispatch.GetMaterialPropertyValues2(
+ _THIS_CONFIGURATION, None
+ ),
+ "body": lambda: dispatch.MaterialPropertyValues2,
+ "face": lambda: dispatch.MaterialPropertyValues,
+ }
+ return adapter._attempt(readers[kind])
+
+ def _write_values(self, kind: str, dispatch: Any, values: list[float]) -> None:
+ """Set the target's own colour."""
+ array = double_array(values)
+ if kind == "feature":
+ dispatch.SetMaterialPropertyValues2(array, _THIS_CONFIGURATION, None)
+ elif kind == "body":
+ dispatch.MaterialPropertyValues2 = array
+ else:
+ dispatch.MaterialPropertyValues = array
+
+ def _remove_values(self, kind: str, dispatch: Any) -> None:
+ """Remove a feature's, body's or face's own colour."""
+ if kind == "body":
+ dispatch.RemoveMaterialProperty(_THIS_CONFIGURATION, None)
+ else:
+ dispatch.RemoveMaterialProperty2(_THIS_CONFIGURATION, None)
+
+ def _showing(self, kind: str, dispatch: Any) -> dict[str, Any]:
+ """The colour a target shows and the level it comes from.
+
+ Walks up from the target in SolidWorks's order (face, feature, body,
+ part) until a level has a colour of its own.
+ """
+ adapter: Any = self
+ chain: list[tuple[str, Any]] = [(kind, dispatch)]
+ if kind == "face":
+ feature = adapter._attempt(lambda: dispatch.GetFeature())
+ body = adapter._attempt(lambda: dispatch.GetBody())
+ if feature is not None:
+ chain.append(("feature", sw_type_info.flagged(feature, "IFeature")))
+ if body is not None:
+ chain.append(("body", sw_type_info.flagged(body, "IBody2")))
+ if kind != "part":
+ chain.append(("part", adapter.currentModel))
+ for level, item in chain:
+ color = rules.color_reply(self._own_values(level, item))
+ if color is not None:
+ return {**color, "level": level}
+ return {"color": None, "hex": None, "transparency": None, "level": None}
+
+ def _appearance_call(
+ self,
+ operation: str,
+ target: AppearanceTarget,
+ act: Any,
+ check: Any = rules.target_kind,
+ ) -> AdapterResult[dict[str, Any]]:
+ """Run ``act(kind, dispatch)`` for the target inside the COM boundary.
+
+ Args:
+ operation: The operation's name, for the boundary and errors.
+ target: The call's target fields.
+ act: Does the work on the target's dispatch; returns reply fields.
+ check: Refuses the call before anything is touched; returns the
+ target's kind.
+
+ Returns:
+ AdapterResult[dict[str, Any]]: ``target``, its name or point and
+ ``act``'s fields.
+ """
+ adapter: Any = self
+ if not adapter.currentModel:
+ return AdapterResult(
+ status=AdapterResultStatus.ERROR, error="No active model"
+ )
+
+ def build() -> dict[str, Any]:
+ kind = check(target)
+ dispatch = self._appearance_target(kind, target)
+ reply = act(kind, dispatch)
+ adapter._attempt(lambda: adapter.currentModel.GraphicsRedraw2())
+ return {"target": kind, **_target_name(kind, target), **reply}
+
+ return cast(
+ AdapterResult[dict[str, Any]],
+ adapter._handle_com_operation(operation, build),
+ )
+
+ async def set_appearance(
+ self, params: AppearanceParameters
+ ) -> AdapterResult[dict[str, Any]]:
+ """Colour the part, a feature, a body or a face, or remove a colour.
+
+ Args:
+ params: The target, the colour and transparency, or ``reset``.
+
+ Returns:
+ AdapterResult[dict[str, Any]]: The target and the colour read
+ back; for a reset, ``color`` None and what now ``showing``.
+ """
+
+ def act(kind: str, dispatch: Any) -> dict[str, Any]:
+ if params.reset:
+ self._remove_values(kind, dispatch)
+ return {"reset": True, "showing": self._showing(kind, dispatch)}
+ rgb = rules.parse_color(params.color)
+ self._write_values(
+ kind, dispatch, rules.material_values(rgb, params.transparency)
+ )
+ read = rules.color_reply(self._own_values(kind, dispatch))
+ if read is None:
+ raise RuntimeError(f"SolidWorks did not keep the colour on the {kind}.")
+ return read
+
+ return self._appearance_call(
+ "set_appearance", params, act, check=lambda _: rules.check_set(params)
+ )
+
+ async def get_appearance(
+ self, params: AppearanceTarget
+ ) -> AdapterResult[dict[str, Any]]:
+ """Read the colour a target shows, and the level it comes from.
+
+ Args:
+ params: The target; none for the part.
+
+ Returns:
+ AdapterResult[dict[str, Any]]: ``color``, ``hex``,
+ ``transparency`` and ``level``.
+ """
+ return self._appearance_call(
+ "get_appearance",
+ params,
+ lambda kind, dispatch: self._showing(kind, dispatch),
+ )
+
+
+def _target_name(kind: str, target: AppearanceTarget) -> dict[str, Any]:
+ """The reply field naming the target: its name or point."""
+ if kind == "feature":
+ return {"feature": target.feature}
+ if kind == "body":
+ return {"body": target.body}
+ if kind == "face":
+ return {"face_point": target.face_point}
+ return {}
+
+
+def select_face_at(adapter: Any, point: list[float]) -> Any:
+ """Select the face at ``point`` (mm) and return it, left selected.
+
+ Args:
+ adapter: The connected adapter.
+ point: ``[x, y, z]`` mm on the face.
+
+ Returns:
+ Any: The ``IFace2`` dispatch, still selected.
+
+ Raises:
+ InputRefused: No face lies at the point.
+ """
+ model = adapter.currentModel
+ # New faces are not selectable by coordinates until a rebuild
+ # (COM pitfall #13).
+ adapter._attempt(lambda: model.ForceRebuild3(True))
+ adapter._attempt(lambda: model.ClearSelection2(True))
+ extension = sw_type_info.flagged(model.Extension, "IModelDocExtension")
+ x, y, z = (float(v) / 1000.0 for v in point)
+ picked = adapter._attempt(
+ lambda: extension.SelectByID2(
+ "", "FACE", x, y, z, False, 0, _null_callout(), 0
+ ),
+ default=False,
+ )
+ manager = sw_type_info.flagged(model.SelectionManager, "ISelectionMgr")
+ face = adapter._attempt(lambda: manager.GetSelectedObject6(1, -1))
+ if not picked or face is None:
+ adapter._attempt(lambda: model.ClearSelection2(True))
+ raise InputRefused(
+ f"No face at {list(point)} mm; give a point on the face's surface."
+ )
+ return sw_type_info.flagged(face, "IFace2")
diff --git a/src/solidworks_mcp/adapters/solidworks/bodies.py b/src/solidworks_mcp/adapters/solidworks/bodies.py
index ded4fbef..a22351e7 100644
--- a/src/solidworks_mcp/adapters/solidworks/bodies.py
+++ b/src/solidworks_mcp/adapters/solidworks/bodies.py
@@ -167,7 +167,7 @@ def _body_operation(
operation: str,
act: Callable[[list[Measured]], tuple[Any, str]],
verdict: Callable[[list[BodyState], list[BodyState]], tuple[str, bool]],
- extra: Callable[[list[BodyState], list[BodyState]], dict[str, Any]],
+ own_fields: Callable[[list[BodyState], list[BodyState]], dict[str, Any]],
) -> AdapterResult[dict[str, Any]]:
"""Measure, act, measure again and judge one body operation.
@@ -177,7 +177,7 @@ def _body_operation(
when SolidWorks made nothing) and what it did in words, for
the "made nothing" message. Raises InputRefused to refuse.
verdict: The rule: the expectation in words and whether it held.
- extra: The reply's own fields, from the bodies before and after.
+ own_fields: The reply's own fields, from the bodies before and after.
Returns:
AdapterResult[dict[str, Any]]: The measured reply, or the refusal.
@@ -208,7 +208,7 @@ def build() -> dict[str, Any]:
raise RuntimeError(failed)
return {
**rules.measured_reply(name, before, after),
- **extra(before, after),
+ **own_fields(before, after),
}
return cast(
diff --git a/src/solidworks_mcp/adapters/solidworks/com_utils.py b/src/solidworks_mcp/adapters/solidworks/com_utils.py
index 838ae0a6..548636a8 100644
--- a/src/solidworks_mcp/adapters/solidworks/com_utils.py
+++ b/src/solidworks_mcp/adapters/solidworks/com_utils.py
@@ -114,3 +114,18 @@ def dispatch_array(values: list[Any]) -> Any:
return w32.VARIANT(pythoncom.VT_ARRAY | pythoncom.VT_DISPATCH, list(values))
except ImportError: # non-Windows
return tuple(values)
+
+
+def long_ref(value: int = 0) -> Any:
+ """``VARIANT(VT_BYREF | VT_I4)`` for a ``Long`` out-parameter (int when pywin32 is absent).
+
+ ``IFeatureManager.InsertGlobalBoundingBox``'s ``Status`` is a type
+ mismatch as a plain int (checked on SolidWorks 2026).
+ """
+ try:
+ import pythoncom
+ import win32com.client as w32
+
+ return w32.VARIANT(pythoncom.VT_BYREF | pythoncom.VT_I4, int(value))
+ except ImportError: # non-Windows
+ return int(value)
diff --git a/src/solidworks_mcp/adapters/solidworks/reference_extras.py b/src/solidworks_mcp/adapters/solidworks/reference_extras.py
new file mode 100644
index 00000000..5ca91c72
--- /dev/null
+++ b/src/solidworks_mcp/adapters/solidworks/reference_extras.py
@@ -0,0 +1,258 @@
+"""Reference and analysis extras on SolidWorks (queue item 39).
+
+A coordinate system at a point, the Center of Mass point, the Bounding Box
+feature and a face's section properties. How each call behaves was measured
+on SolidWorks 2026 (design.md of the ``appearance-and-reference-tools``
+change):
+
+- ``InsertCoordinateSystem(xFlip, yFlip, zFlip)`` takes its origin selected
+ with mark 1; with no axes selected they lie along the model's, and the
+ three flip flags are ignored (checked live: ``True`` for z left +z). The origin
+ is a point in a 3D sketch drawn for it, selected as ``Point1@