Skip to content

Commit 4d844c7

Browse files
Merge pull request #251 from andrewbartels1/fix/title-block-fit-every-field
generate_drawing_package fits every title-block field
2 parents e9eada4 + 02bad3b commit 4d844c7

15 files changed

Lines changed: 331 additions & 21 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
1313
## [Unreleased]
1414

15+
### Changed
16+
17+
- **`generate_drawing_package` fits every title-block field** (#158):
18+
not just DWG NO. and TITLE but every field the sheet format fills from a
19+
property (material, drawn by, company...), each listed in the reply's
20+
`title_block`.
21+
- **`subtitle` is the TITLE's second line, not the company** (#158):
22+
ISO 7200 treats it as the supplementary title under the title, and the
23+
company field as the legal owner's name only. The TITLE is set at 60% of
24+
the format's height so both lines fit.
25+
1526
### Added
1627

1728
- **`save_body_as_part` leaves no extra assembly open** (queue item 27,

‎docs/assets/progress/progress.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@
998998
"total": 2838
999999
},
10001000
"api": {
1001-
"covered": 277,
1001+
"covered": 278,
10021002
"total": 5985
10031003
},
10041004
"interfaces": [

‎docs/assets/progress/progress.svg‎

Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
| `SOLIDWORKS_MCP_TOOLSETS` | `SOLIDWORKS_MCP_TOOL_MODE` | Tools listed | Size | Tokens (estimate) | Of the full list |
22
| --- | --- | ---: | ---: | ---: | ---: |
3-
| `all` | `list` | 140 | 227 KB | 58,124 | 100% |
3+
| `all` | `list` | 140 | 227 KB | 58,160 | 100% |
44
| `core` | `list` | 100 | 151 KB | 38,717 | 67% |
5-
| `drawing` | `list` | 21 | 37 KB | 9,580 | 16% |
5+
| `drawing` | `list` | 21 | 38 KB | 9,616 | 17% |
66
| `automation` | `list` | 3 | 6 KB | 1,556 | 3% |
77
| `vba` | `list` | 10 | 17 KB | 4,356 | 7% |
88
| `docs` | `list` | 6 | 15 KB | 3,914 | 7% |
9-
| `core,drawing` | `list` | 121 | 189 KB | 48,297 | 83% |
9+
| `core,drawing` | `list` | 121 | 189 KB | 48,333 | 83% |
1010
| `all` | `search` | 4 | 4 KB | 908 | 2% |
1111
| `core` | `search` | 4 | 4 KB | 908 | 2% |

‎docs/user-guide/tool-catalog/drawing-automation.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ Set the active drawing sheet's scale, e.g. 1:2; views that use the sheet scale f
9898

9999
Create a complete A3 drawing of a part or assembly in one call, and save it with a PDF.
100100

101+
Every title-block field the sheet format fills from a property (DWG NO., TITLE, material, drawn by and the rest) is shrunk until it fits its box; the reply's `title_block` lists each one with `fits` and its text height before and after.
102+
101103
**Prerequisite:** SolidWorks running
102104

103105
**Parameters:**
@@ -107,15 +109,15 @@ Create a complete A3 drawing of a part or assembly in one call, and save it with
107109
| `model_path` | `str` | ✅ | | Full path to the .SLDPRT or .SLDASM |
108110
| `output_dir` | `str?` | — | `null` | Where to save the drawing; the model's folder when omitted |
109111
| `title` | `str?` | — | `null` | Short title, e.g. 'Mounting Plate - Rev A'; the file name when omitted |
110-
| `subtitle` | `str?` | — | `null` | Sheet title, e.g. 'Base support' |
112+
| `subtitle` | `str?` | — | `null` | A second, smaller line under the TITLE (ISO 7200's supplementary title), e.g. 'Base support' |
111113
| `drawing_number` | `str?` | — | `null` | DWG NO., also the drawing file name, e.g. 'MP-RevA-01' |
112114
| `author` | `str` | — | `""` | DRAWN name |
113115
| `revision` | `str` | — | `"A"` | Revision letter |
114116
| `company` | `str` | — | `""` | Company name |
115117
| `notes` | `list[str]` | — | `[]` | Extra note lines (material, process, connections); 3-7 lines in total |
116118
| `include_isometric` | `bool` | — | `true` | Add an isometric view |
117119
| `write_model_properties` | `bool` | — | `true` | Write Description/Material/Weight into the model so the title block shows them, and save it |
118-
| `title_block_text_height_mm` | `float?` | — | `null` | Largest text height (mm) for the title block's DWG NO. and TITLE, e.g. 3 for smaller text. By default they keep the sheet format's height and are only shrunk to fit their boxes. |
120+
| `title_block_text_height_mm` | `float?` | — | `null` | Largest text height (mm) for the title block's fields (DWG NO., TITLE and every other field the format fills from a property), e.g. 3 for smaller text. By default they keep the sheet format's height and are only shrunk to fit their boxes. |
119121
| `include_bom` | `bool` | — | `false` | Assemblies only: put a bill of materials in the top of the isometric view's cell, with the isometric fitted below it |
120122

121123
**Sample call:**
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
schema: spec-driven
2+
created: 2026-11-17
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
## Why
2+
3+
`generate_drawing_package` shrinks the title block's DWG NO. and TITLE text
4+
until each fits its box, but no other field. A long material name, company
5+
or DRAWN BY value runs over the next cell the same way (#158, "Only two
6+
fields are fitted"). The two fitted fields are named in code; every other
7+
field is left as the format draws it.
8+
9+
## What Changes
10+
11+
- The title-block step fits **every field the sheet format links to a
12+
property** (`$PRP:"..."` or `$PRPSHEET:"..."`), the same way the two
13+
fitted today are: shrunk until its text ends before the next note in its
14+
row, never below the minimum height, and capped by
15+
`title_block_text_height_mm` when given.
16+
- The reply's `title_block` lists each fitted field. The two fitted today
17+
keep their names (`drawing number`, `title`); the drawing's own fields
18+
use the names `update_title_block` takes (`drawn by`, `drawn date`,
19+
`revision`, `company`); any other is named by its property, as the format
20+
links it (e.g. `SW-Material`).
21+
- A property the format shows twice is fitted once.
22+
23+
Out of scope: measuring against the format's cell lines instead of the
24+
next note (#158's first point), and where `subtitle` goes (#158's third
25+
point, a decision for the user).
26+
27+
## Capabilities
28+
29+
### New Capabilities
30+
31+
- `tools/drawing-package-title-block`: how the generated drawing's title
32+
block fields are fitted to their boxes.
33+
34+
### Modified Capabilities
35+
36+
None.
37+
38+
## Impact
39+
40+
- `adapters/solidworks/drawing_standard.py` (`_fit_title_block`, a helper
41+
reading the linked property); its unit tests.
42+
- `generate_drawing_package`'s catalog entry, the CHANGELOG, the queue.
43+
- Live: the existing `test_generate_drawing_package_on_a_block` evidence
44+
shows every field fitted.
45+
- #158 (part of it).
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
## Purpose
2+
3+
The drawing `generate_drawing_package` builds has a title block whose
4+
fields each fit their box, whatever the values' lengths.
5+
6+
## ADDED Requirements
7+
8+
### Requirement: Every linked field fits its box
9+
The title-block step SHALL fit every sheet-format note linked to a property
10+
(`$PRP:"name"` or `$PRPSHEET:"name"`): its text SHALL be shrunk until it
11+
ends before the next note in its row (or the title block's right edge),
12+
no smaller than the minimum height, and no larger than
13+
`title_block_text_height_mm` when that is given. A property shown by more
14+
than one note SHALL be fitted once, by its first note.
15+
16+
#### Scenario: A long material name
17+
- **WHEN** the part's material name is longer than its cell
18+
- **THEN** the reply's `title_block` has an entry for it with `fits` true,
19+
and its text height is below the format's
20+
21+
#### Scenario: A short value
22+
- **WHEN** a field's value already fits
23+
- **THEN** its entry has `fits` true and the same height before and after
24+
25+
### Requirement: Each fitted field is named in the reply
26+
The reply's `title_block` SHALL name the DWG NO. `drawing number` and the
27+
TITLE `title`; the drawing's own fields SHALL use the names
28+
`update_title_block` takes, with spaces (`drawn by`, `drawn date`,
29+
`revision`, `company`); any other field SHALL be named by its property.
30+
31+
#### Scenario: The ISO A3 format
32+
- **WHEN** a drawing is generated on `a3 - iso`
33+
- **THEN** `title_block` lists `drawing number` and `title`, and an entry
34+
for each other property the format links
35+
36+
### Requirement: The subtitle is the TITLE's second line
37+
A `subtitle` SHALL be shown as a second line of the TITLE field (ISO 7200's
38+
supplementary title), with the TITLE's text height at most 60% of the
39+
format's (or the caller's cap, if smaller). The company field SHALL show
40+
`company` only.
41+
42+
#### Scenario: A subtitle and no company
43+
- **WHEN** `subtitle` is `Base support` and `company` is empty
44+
- **THEN** the TITLE reads `Package Block` then `Base support`, and the
45+
company field is empty
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## 1. Fit
2+
3+
- [x] 1.1 `_fit_title_block` fits every linked note after the two named fields; a property shown twice is fitted once; names from `update_title_block`'s fields, else the property; unit tests (a long linked field shrunk, a short one unchanged, a duplicate fitted once, a note with no link left alone)
4+
5+
## 1b. Subtitle (the user's question on #158: follow standard practice)
6+
7+
- [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
8+
- [ ] 1b.2 Live: the drawing test passes a subtitle and checks the TITLE's two lines
9+
10+
## 2. Docs
11+
12+
- [x] 2.1 `generate_drawing_package`'s catalog entry, CHANGELOG, queue row 31
13+
- [x] 2.2 Full mock suite at 100% coverage, ruff, mypy, `mkdocs build --strict`
14+
15+
## 3. Live
16+
17+
- [ ] 3.1 `test_generate_drawing_package_on_a_block` asserts every listed field fits; run by the user
18+
- [ ] 3.2 Archive after the user's pass

‎openspec/queue.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Last updated 2026-11-16.
3939
| 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 |
4040
| 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 |
4141
| 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 |
42+
| 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` | Built, unit-tested; checked live 2026-11-18 (`test_live_sw_drawing_package_tools.py::test_generate_drawing_package_on_a_block`) |
4243
## Removed tools (item 10, release 2.1.0)
4344

4445
33 tools were registered but never implemented: every call returned

0 commit comments

Comments
 (0)