Python 3.12 · CadQuery · MCP

enclosure-fab

A short YAML file describes the part: a case for a board, a box, a tray, a pipe clip. You get STL, 3MF, STEP, and two pictures. Open the 3MF in a slicer yourself. Nothing here talks to a printer.

CPython 3.12 8 templates Draft, not a print MIT
Snap-fit case with roof slots, assembled
fixtures/demo_snap.yaml · assembled

How it works

The shape comes from a template in the repo. Change the numbers in YAML instead of writing a script for each part.

Draft first

You can build a file before the sizes are checked. The name starts with PREVIEW-. Do not print that file yet.

Then print

print runs only after a person confirmed the sizes that decide the fit. If the part crosses a keep-out, no file is written.

Then the slicer

The 3MF is the shape only, with no slicer settings. Turn the parts on the bed yourself.

Examples

Every template has a fixture in fixtures/. The numbers are made up. Copy a file and put in your own measurements.

Use with an agent

The skill is already in the paths that Cursor, Claude Code, and Codex read. Open the clone as the project. The MCP server fab has the same gates as the CLI.

  • Skill: .cursor/skills/, .claude/skills/, .agents/skills/
  • Tools: validate_spec, generate_preview, generate_print, measurement_protocol and four more
  • The agent never sets confirmed. A person measures.
Read the skill
mcp.json
{
  "mcpServers": {
    "fab": {
      "command": "/path/to/enclosure-fab/.venv/bin/python",
      "args": ["/path/to/enclosure-fab/mcp/server.py"]
    }
  }
}

Install

CadQuery 2.8 needs Python 3.12. Do not run pip install -U: VTK, Numba, and NumPy would move together, and the geometry can change.

Full instructions
powershell
git clone https://github.com/BelyaevAD/enclosure-fab.git
cd enclosure-fab
py -3.12 -m venv .venv
.\.venv\Scripts\python.exe -m pip install -r requirements.txt
.\.venv\Scripts\python.exe scripts\fab.py preview fixtures\demo_snap.yaml