Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ Each GIF is a live test driving SolidWorks 2026 through the MCP tools, with the
<td width="33%" valign="top"><a href="https://andrewbartels1.com/SolidworksMCP-python/demos/#wrench"><img src="docs/assets/demos/equations/test_a_combination_wrench_sized_by_one_variable-motion.gif" alt="A steel combination wrench sized by one global variable and lettered with its size: 13 mm, then 19 mm, then 8 mm in its own configuration" width="100%"></a><br><sub>One variable sizes a combination wrench: equations and configurations</sub></td>
<td width="33%" valign="top"><a href="https://andrewbartels1.com/SolidworksMCP-python/demos/#boolean-logic"><img src="docs/assets/demos/multi-body/test_boolean_logic_on_a_cube_and_a_sphere-motion.gif" alt="A cube and a sphere as separate bodies: joined, each cut by the other, their common quarter, and the exclusive or" width="100%"></a><br><sub>Boolean logic on a cube and a sphere: every combine of two bodies</sub></td>
</tr>
<tr>
<td width="33%" valign="top"><a href="https://andrewbartels1.com/SolidworksMCP-python/demos/#thread-runouts"><img src="docs/assets/demos/modelled-threads/test_thread_runouts-motion.gif" alt="An M6 thread whose groove fades out along the helix's tangent, then an M6 bolt threaded to its collar with a DIN 76-1 undercut and a chamfered end" width="100%"></a><br><sub>A threaded M6 bolt: a faded runout, then a DIN 76-1 undercut at the collar</sub></td>
</tr>
</table>

**[See every demo in the docs](https://andrewbartels1.com/SolidworksMCP-python/demos/)**: what each one shows, its prompt, every tool call with its arguments (all 58 for the demo at the top), and how to run them yourself.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
- [x] 4.7 `add_sketch_text` (design: Text on the wrench's handle): adapter (`InsertSketchText` at a point, `CharHeight`, `center_at` by measuring its edges), `base`/`circuit_breaker`/`connection_pool`/mock, the tool, hints, support level, toolset, catalog; tests. The wrench debosses "solidworksmcp-python" and its size (`$PRP:` linked to a Size dimension) into both faces of the handle, centred at every size (cut on a spare block, patterned onto the handle by `"Size" * 6.48 + 190mm`), and each evidence line shows the equation set and the size before and after
- [x] 4.8 `set_sketch_text` (design: Text on the wrench's handle): re-letter a sketch's text in edit mode, rebuild; adapter, wrappers, mock, tool, hints, support level, catalog, tool count 145; tests. The wrench demo re-letters after each size change
- [x] 4.6 Once the user approves the wrench: re-record, then the demos page section, README tile, catalog notes and CHANGELOG (approved and recorded 2026-11-18: 27 equations, captions at the start of each step)
- [ ] 4.4 The user runs `tests/live/test_live_sw_equations.py` (block tests) and approves the demo; archive after
- [x] 4.4 The user runs `tests/live/test_live_sw_equations.py` (block tests) and approves the demo; archive after
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
## 1b. Subtitle (the user's question on #158: follow standard practice)

- [x] 1b.1 ISO 7200: `subtitle` is the supplementary title, the TITLE's second line; the company field holds `company` only; the TITLE at 60% of the format's height (or the caller's cap); unit tests
- [ ] 1b.2 Live: the drawing test passes a subtitle and checks the TITLE's two lines
- [x] 1b.2 Live: the drawing test passes a subtitle and checks the TITLE's two lines

## 2. Docs

Expand All @@ -14,5 +14,5 @@

## 3. Live

- [ ] 3.1 `test_generate_drawing_package_on_a_block` asserts every listed field fits; run by the user
- [ ] 3.2 Archive after the user's pass
- [x] 3.1 `test_generate_drawing_package_on_a_block` asserts every listed field fits; run by the user
- [x] 3.2 Archive after the user's pass
12 changes: 6 additions & 6 deletions openspec/queue.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@ Last updated 2026-11-25.
| 26 | `execute_macro` runs VBA source text (a `generate_vba_*` result, or the agent's own), saved as a `.swb` and run with the dialog watchdog. Opt-in (`SOLIDWORKS_MCP_ALLOW_VBA_SOURCE`), the user's choice 2026-11-17 | #96 | `macro-from-vba-source` (archived) | Done 2026-11-17 (#246), checked live |
| 27 | `save_body_as_part` leaves an extra unsaved assembly open (the Save Bodies feature's create-assembly option) | #101 | `save-body-no-stray-assembly` (archived) | Done 2026-11-17 (#247), checked live: the stray `Assem<N>` is closed |
| 28 | Restricted VBA source: `SOLIDWORKS_MCP_ALLOW_VBA_SOURCE` = off / restricted / full; `restricted` checks the source against the SolidWorks type library and a blocklist before it runs, with every default and option disclosed in the docs (the user's choice 2026-11-17) | none | `vba-source-restricted` (archived) | Done 2026-11-17 (#248), checked live: restricted source runs, a `Shell` line is refused, `off` refuses |
| 29 | Equations and global variables: `list_equations`, `set_equation` (add or change, in all configurations by default) and `delete_equation`, so one value drives several dimensions. The base for macro-driven parametric features | none | `equations-and-global-variables` | Done 2026-11-18 (#250): all three live tests passed; the wrench demo recorded. Archive after the user signs off the two small demos (task 4.4) |
| 29 | Equations and global variables: `list_equations`, `set_equation` (add or change, in all configurations by default) and `delete_equation`, so one value drives several dimensions. The base for macro-driven parametric features | none | `equations-and-global-variables` (archived) | Done 2026-11-18 (#250): all three live tests passed; the wrench demo recorded. The two small demos signed off and archived 2026-12-01 |
| 30 | Build a part from an engineering drawing (image or PDF): research first, then an OpenSpec change for a first version | #249 | not yet written | Research to do (the user's request 2026-11-17) |
| 31 | `generate_drawing_package` fits every title-block field the sheet format fills from a property, not just DWG NO. and TITLE | #158 (part) | `title-block-fit-every-field` | Done 2026-11-19 (#251), checked live |
| 31 | `generate_drawing_package` fits every title-block field the sheet format fills from a property, not just DWG NO. and TITLE | #158 (part) | `title-block-fit-every-field` (archived) | Done 2026-11-19 (#251), checked live; the user's rerun passed and archived 2026-12-01 |
| 32 | Sketch essentials: sketch fillet and chamfer, slots, trim and extend, tangent and 3-point arcs, centre rectangle, construction geometry on and off (ISketchManager; the user's choice 2026-11-19, first of the COM-coverage packages) | none | `sketch-essentials` (archived) | Done 2026-11-19 (#253): six tools, live demo passed |
| 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 | `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) | `drawing-sheets` (sheets only) | Sheets built 2026-11-28: `list_sheets`, `add_sheet`, `activate_sheet`; live test passes; beta until the user's demo. Callouts, auxiliary, break and broken-out views, ordinate dimensions, surface finish and the revision table are left |
| 36 | Appearance and colour: set a part's, body's or face's colour and read it back | none | `appearance-and-reference-tools` (archived) | Done 2026-11-30 (#284) with item 39: `set_appearance`, `get_appearance`; demo signed off; archived 2026-12-01 |
| 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) | `drawing-sheets` (sheets only, archived) | Sheets done 2026-12-01 (#286): `list_sheets`, `add_sheet`, `activate_sheet`; demo signed off; a first view keeps the sheet's scale (#287, `drawing-view-keeps-sheet-scale`, archived). Callouts, auxiliary, break and broken-out views, ordinate dimensions, surface finish and the revision table are left |
| 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 | `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 |
| 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` (archived) | Done 2026-11-30 (#284) 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`; demo signed off. 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 |
| 43 | Modelled threads (the user's request 2026-11-26): external (male) and internal (female) threads through SolidWorks' Thread feature (`IThreadFeatureData`, the installed die and tap profiles), at standard sizes with coarse and fine pitches read from the installed Hole Wizard tables (`<P>_DATA_HW_TappedHole`), the thread depth reported from the ISO 68-1 profile, and a thread runout (DIN 76 / ISO 4755). Research notes: `openspec/research/modelled-threads.md` | none | `modelled-threads` | Built 2026-11-28: `list_thread_sizes`, `create_thread` (die and tap profiles, coarse or fine, ISO 68-1 depth, ISO 3508 runout reported); live tests pass; beta until the user's demo. Runout as geometry and M1/M1.4 are open questions |
| 43 | Modelled threads (the user's request 2026-11-26): external (male) and internal (female) threads through SolidWorks' Thread feature (`IThreadFeatureData`, the installed die and tap profiles), at standard sizes with coarse and fine pitches read from the installed Hole Wizard tables (`<P>_DATA_HW_TappedHole`), the thread depth reported from the ISO 68-1 profile, and a thread runout (DIN 76 / ISO 4755). Research notes: `openspec/research/modelled-threads.md` | none | `modelled-threads` (archived) | Done 2026-11-30 (#285): `list_thread_sizes`, `create_thread` (die and tap profiles, coarse or fine, ISO 68-1 depth, a bolt-like start, `lead_in`, and a `fade` or DIN 76-1 `undercut_a` runout); demos signed off; archived 2026-12-01. M1/M1.4 is an open question |

## Removed tools (item 10, release 2.1.0)

Expand Down
56 changes: 56 additions & 0 deletions openspec/specs/tools/appearance/spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# tools/appearance Specification

## Purpose
TBD - created by archiving change appearance-and-reference-tools. Update Purpose after archive.
## 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"

45 changes: 45 additions & 0 deletions openspec/specs/tools/drawing-package-title-block/spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# tools/drawing-package-title-block Specification

## Purpose
The drawing `generate_drawing_package` builds has a title block whose
fields each fit their box, whatever the values' lengths.
## Requirements
### Requirement: Every linked field fits its box
The title-block step SHALL fit every sheet-format note linked to a property
(`$PRP:"name"` or `$PRPSHEET:"name"`): its text SHALL be shrunk until it
ends before the next note in its row (or the title block's right edge),
no smaller than the minimum height, and no larger than
`title_block_text_height_mm` when that is given. A property shown by more
than one note SHALL be fitted once, by its first note.

#### Scenario: A long material name
- **WHEN** the part's material name is longer than its cell
- **THEN** the reply's `title_block` has an entry for it with `fits` true,
and its text height is below the format's

#### Scenario: A short value
- **WHEN** a field's value already fits
- **THEN** its entry has `fits` true and the same height before and after

### Requirement: Each fitted field is named in the reply
The reply's `title_block` SHALL name the DWG NO. `drawing number` and the
TITLE `title`; the drawing's own fields SHALL use the names
`update_title_block` takes, with spaces (`drawn by`, `drawn date`,
`revision`, `company`); any other field SHALL be named by its property.

#### Scenario: The ISO A3 format
- **WHEN** a drawing is generated on `a3 - iso`
- **THEN** `title_block` lists `drawing number` and `title`, and an entry
for each other property the format links

### Requirement: The subtitle is the TITLE's second line
A `subtitle` SHALL be shown as a second line of the TITLE field (ISO 7200's
supplementary title), with the TITLE's text height at most 60% of the
format's (or the caller's cap, if smaller). The company field SHALL show
`company` only.

#### Scenario: A subtitle and no company
- **WHEN** `subtitle` is `Base support` and `company` is empty
- **THEN** the TITLE reads `Package Block` then `Base support`, and the
company field is empty

43 changes: 43 additions & 0 deletions openspec/specs/tools/drawing-sheets/spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# tools/drawing-sheets Specification

## Purpose
TBD - created by archiving change drawing-sheets. Update Purpose after archive.
## Requirements
### Requirement: The drawing's sheets
`list_sheets` SHALL list the active drawing's sheets in order, each with
`name`, `active`, `paper_mm` (`[width, height]`), `scale` (`"1:2"`) and
`projection` (`first` or `third`), read without changing the active sheet,
with `count` and `active`. It SHALL fail when the active document is not a
drawing.

#### Scenario: A new drawing
- **WHEN** it is called on a new drawing
- **THEN** it lists `Sheet1`, active, with its paper size and scale

### Requirement: A new sheet
`add_sheet` SHALL add a sheet named `name` with the format `sheet_format`
(a name found in SolidWorks's sheet format folders or a `.slddrt` path),
the paper size (from the format's name unless given), `scale` and
`projection` (the active sheet's unless given), make it active, and reply
with `added`, `sheet_format` and the listing after. A name in use (ignoring
case), an unknown format, a bad scale or projection SHALL fail with
`invalid_input`, changing nothing.

#### Scenario: A details sheet
- **WHEN** it is called with `name` "Details", `sheet_format` "a2 - iso"
and `scale` "1:2"
- **THEN** the listing has Details, active, 594 x 420 mm, at 1:2

#### Scenario: A name in use
- **WHEN** it is called with `name` "sheet1" on a drawing with Sheet1
- **THEN** it fails with `invalid_input`, listing the sheets

### Requirement: The active sheet
`activate_sheet` SHALL make the sheet named `name` (ignoring case) the
active one and reply with the listing after. An unknown name SHALL fail
with `invalid_input`, listing the sheets.

#### Scenario: Back to the first sheet
- **WHEN** it is called with "SHEET1" while Details is active
- **THEN** Sheet1 is active

Loading
Loading