swdraw
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@swdraw build the drawing from bush.drawing.yaml and show me any failed checks"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
swdraw
Turn a SolidWorks part into a finished, checked engineering drawing, and change parts from a spec with the same checks. Ask Claude, or run it yourself.
From part to drawing
Start with a part. Use your own, or generate one by script like the example flanged bush, which is built from a parameters file.
Describe the drawing in YAML. List the views, sections, details, dimensions, tolerances, GD&T, notes and title-block values. Each dimension also gets the value it should measure.
swdraw builds it. If a dimension measures wrong, it deletes it, regenerates the views and tries your alternative picks. If nothing works, it leaves the last attempt on the sheet and flags it.
Check the PDF and PNG. The result lists anything that failed.
Keep it current. Issue revisions, renumber parts without breaking references, tidy the working folder and update the drawing register.
Related MCP server: AutoCAD MCP Pro
Editing parts
Change an existing part from a short YAML spec: dimensions by full name (D1@Sketch1), global
variables, equations, the configuration or a design-table row. swdraw rebuilds the part, then
checks it:
every changed dimension reads back what you set
no feature has a rebuild error
volume, mass, surface area and bounding box match your
expectvalues
If anything fails, nothing is saved. With save: true it copies the original to
<name>.bak.SLDPRT first. model inspect lists what a part has and writes a spec to start from.
See references/modelling.md.
Planned: building parts from a spec (sketches, extrudes, revolves, cuts, holes, fillets,
chamfers, patterns), with an expect after each feature.
Tools
Tool | What it does |
| scale, clear, layout, sections, details, self-checked dimensions and tolerances, datums and GD&T frames, leader notes, numbered notes block, title block, house-style fonts, PDF + PNG export with a check summary |
| revision-table row, REV box, approver and date, "SEE NOTE n" reference, moving dimensions and GD&T frames to model coordinates |
| reference-safe rename of a part and its drawing: properties, Save As in the right order, number swap in notes, dependency check, supersede old files, folder rename and verify |
| replace the numbered notes block, or delete copies that lost their numbering |
| keep only live files in a working folder; identical copies merged, nothing overwritten |
| drawing register workbook: Register, Revision History (inputs) and Numbering tabs |
| check part numbers and allocate the next part or assembly number |
| read-only probes: views and transforms, selection, annotations, file references |
| read-only: a part's dimensions, global variables, equations, configurations, design table, rebuild errors and mass properties, plus a spec stub |
| change a part from a spec, rebuild, self-check; saves after a backup only with |
Run it from the command line, from Python, or from Claude through the MCP server.
Requirements
Windows with SolidWorks 2025 or later. Earlier versions probably work but aren't tested.
uv (
winget install astral-sh.uv). It installs Python and the dependencies on first run.
validate, model validate, tidy, register, number, setup and the tests don't need
SolidWorks.
Install
git clone https://github.com/<you>/swdraw.git
cd swdraw
uv sync --extra mcp --extra previewThen connect it to your AI client.
Claude Desktop extension. Get swdraw-<version>.mcpb from Releases (or build it with
npx @anthropic-ai/mcpb pack . swdraw.mcpb) and open it in Claude Desktop. Set:
Output folder: traces, results, PDFs and PNG previews
Profiles folder (optional): your
house_style.yaml,title_block.yaml,numbering.yamlScripts folder (optional): the only folder
swdraw_run_scriptcan run scripts fromPart backup folder (optional): where part edits copy the original before saving (default: next to the part)
One command from the clone. setup shows the change first. Add --apply to make it. Config
files get a .bak backup.
uv run python -m swdraw setup claude-code --skill --output-dir ~/swdraw-output --apply
uv run python -m swdraw setup claude-desktop --output-dir ~/swdraw-output --apply # not if you installed the .mcpb
uv run python -m swdraw setup codex --output-dir ~/swdraw-output --apply--skill copies SKILL.md, references/ and subskills/ to ~/.claude/skills/swdraw so
Claude Code knows the workflow. Restart the client after.
Other MCP clients. Run uv run --directory <clone> --extra mcp --extra preview python mcp_server/server.py over stdio. See mcp_server/README.md.
Profiles and template
Copy profiles/ somewhere and point SWDRAW_PROFILES (or the extension setting) at it. Anything
missing falls back to the bundled files. See references/profiles.md.
For a matching A3 sheet format and drawing template, import templates/A3_SheetFormat.bas into a
new SolidWorks macro, edit the constants at the top and run main. The constants cover company
name, projection, confidentiality block, and linked properties or placeholders.
Quick start: the flanged bush
# 1. make the part and a drawing with front + isometric views
uv run python examples/flanged_bush/make_part.py --args "{\"out\": \"~/swdraw-example\"}"
# 2. check the spec (no SolidWorks needed)
uv run python -m swdraw validate --spec examples/flanged_bush/bush.drawing.yaml
# 3. with the new drawing active in SolidWorks, build it
uv run python -m swdraw build --spec examples/flanged_bush/bush.drawing.yamlThe result lists each step, what each dimension measured, which pick pair worked, and a check
block with anything that failed. Look at the exported PNG too. The self-check proves the right
edges got dimensioned, not that the layout is good.
To re-run part of the build, include clear or you'll get everything twice:
uv run python -m swdraw build --spec bush.drawing.yaml --steps clear,dimensions,gdt,leader_notes,notes,fonts,exportWiden the flange to 42 mm and check the new volume (add --save to keep it):
uv run python -m swdraw model edit --spec examples/flanged_bush/bush.edit.yamlIssue revision B:
uv run python -m swdraw revise --args "{\"rev\": \"B\", \"desc\": \"BORE TOLERANCE CHANGED\", \"drawn\": \"AD\", \"approved\": \"CC\", \"approver_name\": \"C. CHECKER\"}"Writing a spec
Anything on geometry (pick, text_at, section line, detail centre) is in model mm.
Positions on the sheet (at) are sheet mm from the bottom-left corner. Every dimension has an
expect value.
Start from the spec template. The flanged bush spec is a full example, and references/drawing-spec.md covers every key.
Your own scripts
The helpers are small, so one-off scripts are easy:
import swdraw as sw
dwg = sw.active()
names = [sw.call(v, "GetName2") for v in sw.views(dwg)]
sw.result({"views": names, "args": sw.args()})Run it with uv run python -m swdraw run my_script.py --args "{...}", or from Claude with
swdraw_run_script if it's in your scripts folder.
When something goes wrong
Check references/troubleshooting.md, then references/api-gotchas.md. Most surprises are the SolidWorks API.
uv run python -m swdraw diag views # names, origins, scales, whether model +Y is up
uv run python -m swdraw diag annotations # incl. dangling centre marksEvery run logs to swdraw.log in the output folder.
Repository layout
Path | What's there |
| instructions for Claude: which tool when, which reference to read |
| drawing specs, part editing, profiles, workflows, troubleshooting, SolidWorks API gotchas |
| end-to-end drawing workflow and a spec template |
| part-editing workflow and an edit spec template |
| every MCP tool with its arguments (generated) |
| the Python package: COM helpers, drawing builder, part editing ( |
| the MCP server (stdio) |
| the Claude Desktop extension manifest |
| example house style, title block and numbering profiles |
| A3 sheet-format macro and a feature-dump macro (VBA source) |
| worked example: part generator, edit spec and drawing spec |
| tests against a fake SolidWorks API |
| CI on Windows and Linux; release builds the |
Tests
uv run --extra dev python -m pytestThe tests run against a fake SolidWorks API (tests/fakes.py). They cover:
selection and dimension self-checking, including the fallbacks and tolerances
title-block matching, revisions and notes
tidy, the register (including formula results when LibreOffice is installed) and numbering
spec validation and the example's geometry
part edits: globals, equations, dimensions, configurations, design tables, read-back, rebuild errors,
expect, revert, backup and save
CONTRIBUTING.md lists what they can't cover. CI runs them on Windows and Linux on every push.
Licence
MIT. See LICENSE.
Available Tools
11 toolsswdraw_build_drawingA
Build the ACTIVE SolidWorks drawing from a spec: scale, clear, layout, sections, details, self-checked
dimensions, GD&T, leader notes, notes block, title block, fonts, PDF/PNG export. Does not save.
spec_path must be absolute. steps runs a subset (e.g. ["clear", "dimensions", "gdt", "export"]).
Look at result.check and the PNG afterwards.
Inputs: spec_path (required), steps, strict, title_block. Returns: result
swdraw_diagnosticsB
Read-only probes of the active drawing: 'views', 'selection', 'annotations'; or 'refs' with args.paths.
Inputs: what (required), args. Returns: result
swdraw_export_pdfA
Export the active drawing (or args.drawing) to PDF, plus a PNG preview for visual checking (args.path, args.png).
Inputs: args. Returns: result
swdraw_notesB
action 'replace': delete and re-insert the numbered NOTES: block (args: lines, pos [mm], values, drawing, save). action 'dedupe': keep the numbered block, delete copies that lost their numbering (args: pos, drawing, save).
Inputs: args (required), action (required). Returns: result
swdraw_numberC
Part numbers. action 'check' (args.numbers), 'next-part' (args.assembly, args.used), 'next-assembly' (args.used, args.discipline).
Inputs: args (required), action (required). Returns: result
swdraw_registerB
Generate the drawing register workbook (Register / Revision History / Numbering). Keys: out, title, drawings [{number,title,type,parent,file}], revisions [{number,rev,date,description,by,approved,status}], or data: path to a YAML/JSON file with those keys; numbering_profile.
Inputs: args (required). Returns: result
swdraw_renumberB
Reference-safe renumber of a part and its drawing (part Save As with the drawing open, notes swap, drawing Save As, dependency check, optional supersede/folder rename/verify). Keys: drawing, old, new, old_parent, new_parent, description, revision, part, notes_lines, save, supersede, rename_folder.
Inputs: args (required). Returns: result
swdraw_reviseB
Apply a revision to a drawing (active, or args.drawing): rev row, REV box, approval, SEE NOTE n, view shifts, moving dims/GTols to model points. Keys: rev, row, desc, date, drawn, approved, approver_name, approved_date, finish_note, shift_views, notes_pos, move_dims, move_gtols, save.
Inputs: args (required). Returns: result
swdraw_run_scriptB
Run one of your own Python scripts from SWDRAW_SCRIPTS_DIR with swdraw importable
(import swdraw as sw; sw.args(); sw.result({...})).
Inputs: script (required), args. Returns: result
swdraw_tidyB
Move files that aren't live out of a working folder. DRY RUN unless dry_run is false. Keys: working, keep (glob list), superseded, move_folders, dry_run.
Inputs: args (required). Returns: result
swdraw_validate_specA
Check a drawing spec (YAML/JSON, absolute path) for missing keys, bad points and dimensions without expect. No SolidWorks needed.
Inputs: spec_path (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Each tool targets a fairly distinct operation (validate, build, revise, renumber, export, tidy, register, number, diagnostics, notes, script). There is minor overlap: swdraw_build_drawing already handles PDF/PNG export while swdraw_export_pdf also does it, and swdraw_revise touches notes/REV that swdraw_notes also manages, which could cause slight misselection.
All tools share the swdraw_ prefix and snake_case, giving a predictable namespace. Most follow verb_noun (validate_spec, build_drawing, export_pdf, run_script) but a few are bare verbs (revise, renumber, tidy) or nouns (notes, diagnostics), a minor deviation from a strict pattern.
11 tools is well within the ideal 3-15 range and each maps to a meaningful stage of the drawing lifecycle. No tool appears redundant filler.
The surface covers validate, build, revise, renumber, notes, export, tidy, register, number, diagnostics, plus an escape hatch via run_script, which is strong lifecycle coverage. Minor gaps: build explicitly does not save, and there is no dedicated read/get or delete operation, but agents can work around these.
Maintenance
Related MCP Connectors
Read title blocks, parts lists, revision history and notes from 2D engineering drawings.
Headless CAD engine & MCP server for 2D/3D drafting, solids, DXF/SVG export, and automation.
CAD in ChatGPT and Claude: editable parts, STEP/STL/drawings, in-chat 3D, automatic checks.
Turn datasheets into source-backed JSON contracts, pinout matrices, and KiCad CAD for AI agents.
Related MCP Servers
- FlicenseNot gradedqualityAmaintenanceEnables AI agents to author, read, dimension, and validate production CAD drawings through one typed contract, driving either a live AutoCAD session over COM on Windows or a headless ezdxf engine on any platform. It covers mechanical parts and sheets, architectural plans with measured room areas, P&ID drafting and graph read-back, ISO GD&T and tolerance checks, drawing understanding, and takeoff exports to Excel.-
- FlicenseNot gradedqualityAmaintenanceEnables AI agents to automate CAD drafting either live through COM on Windows or headlessly via ezdxf on any platform, with one typed contract across both engines. It covers ISO-compliant mechanical, architectural and P&ID drawing generation, dimension and tolerance validation, and reading back, critiquing and taking off from existing drawings.-
- FlicenseNot gradedqualityAmaintenanceEnables AI agents to create, edit, inspect, and validate production drawings through one typed tool contract, driving either a live AutoCAD seat over COM on Windows or a headless ezdxf engine anywhere. It covers drafting, P&ID, mechanical, and architectural workflows with ISO/ANSI standards, dimension and tolerance checks, takeoffs, and drawing understanding.-
- FlicenseNot gradedqualityAmaintenanceEnables AI agents to draft, edit and inspect CAD drawings through a single typed tool contract, driving a live AutoCAD session over COM on Windows or working headlessly with ezdxf on any platform. It covers ISO-compliant dimensioning and GD&T, P&ID, mechanical and architectural sheets, drawing critique and understanding, and quantity takeoffs exported to workbooks.-