CadQuery part — functional geometry only
Purpose
Model one manufacturable component's functional solid: primary shape, structural voids (shells, pockets), and mating interface geometry (bores, spigots, slots, snap ledges) — so it assembles correctly. This pass is not cosmetic and not full DFM.
What this pass is NOT
Do not add in this pass (other skills own these):
| Feature |
Owner |
| Fillets, cosmetic chamfers, ribs, gussets |
cadquery-part-detailing |
| Clearance holes, tap drills, counterbores, countersinks |
cadquery-manufacturability |
| Vendor procurement BOM comments, engraved P/N |
cadquery-manufacturability |
| Process draft, sheet-metal bend notes |
cadquery-manufacturability |
A functional bracket may have a mounting bore (interface diameter) here; the clearance + counterbore for an M6 cap screw come in DFM.
Authoritative rules
Follow cad-generation.txt — Critical Pitfalls, Boolean Rules, Geometry Constraints, Mechanical Interfaces (model the interface shape, not full fastener spec).
Required file shape
"""<function_name> — <one-line role>. Origin: <part-local origin rule>."""
import cadquery as cq
import math
from common import (
HOUSING_W, M3_BORE_DIA, # every shared dim used
)
def build_<function_name>() -> cq.Workplane:
# ---- functional geometry only ----
...
return <part_name>
result = build_<function_name>()
- Path:
parts/<function_name>.py
- Import shared dimensions from
common.py — never duplicate HOUSING_W, mate PCDs, or partner bore diameters.
- Part-local origin documented in module docstring (e.g. "center of footprint, Z=0 on bottom face").
Inputs from orchestrator
- Function name, file path, manufacturing process guess
- Envelope +
MATE_* constants from common.py
- Per-mate: what this part provides (socket, spigot, clearance bore, weld face, snap ledge)
Build order (mandatory)
- Parameters — only dims not already in
common.py.
- Primary body — one main extrude, revolve, or
.box() / .cylinder().
- Structural voids —
.shell(), pockets that define wall thickness (functional, not cosmetic).
- Interface features — one single-extrusion tool per
cut/union:
- Bearing bores, shaft journals, keyways, drip-tray pockets, snap ledges
- Pilot or clearance diameter only if it is the functional interface (e.g. bearing pocket Ø); thread/clearance pairs wait for DFM
- No edge treatments — no
.fillet() / .chamfer() except a functional shaft lead-in under 0.5 mm if required for assembly simulation
return the workplane from build_*(); result = build_*() at module level
Design realism (functional tier)
Apply what the function requires — not full cosmetics:
- Housings: hollow via
.shell(-WALL_T) on simple faces — not solid blocks
- Shafts: bearing journal steps, keyway slot if driven
- Brackets: outline + mounting bore locations (use
MATE_* positions from common.py)
- Plates: hole positions via
pushPoints or construction rect + .vertices() — diameters may be finalized in DFM
Skip ribs, gussets, and fillets — detailing adds those.
Vendor / OTS parts
- Model interface envelope (bore, boss, cutout for body) in this pass.
- At most a short
# VENDOR — <category>, <key dims> above the cut — no SKU paragraph until DFM.
- If a STEP file is injected, use
cq.importers.importStep('file.step') per cad-generation.txt; do not redraw the catalog part.
Anti-patterns — refuse to emit
rect(..., centered=False) — use .center(dx, dy).rect(w, h)
cq.selectors.* — string selectors only
- Compound boolean tools (
tool = a.union(b); body.cut(tool))
- Nested booleans in arguments
.translate() on empty Workplane
- Reused rotated Workplane for multiple cuts
- Loft/sweep as boolean tools
extrude(0) or revolve profile crossing axis
- Fillets/chamfers (detailing pass)
- Counterbores, tap drills, clearance pairs (DFM pass)
- Duplicating constants that exist in
common.py
Validation before hand-off
python -c "import runpy; ns=runpy.run_path('parts/<name>.py'); bb=ns['result'].val().BoundingBox(); print(bb)" — non-zero spans.
- Bounding box roughly matches envelope from
common.py (± sensible feature tolerance).
- Hand to orchestrator for
cadquery-render and cadquery-interference-check — do not render from this skill.
Output
parts/<function_name>.py with build_<function_name>() and top-level result. No edits to assembly.py from this skill.
1---2name: cadquery-part3description: Generate a single CadQuery part as a standalone `.py` file following all rules in `leo-monolith/resources/functions/system-messages/cad-generation.txt`. Use when the orchestrator (`cadquery-assembly`) requests one part, or when the user asks for an individual mechanical component (bracket, hub, plate, housing, shaft, etc.) modelled in CadQuery. Returns a file whose final line assigns `result` to the part workplane.4---56# CadQuery part — functional geometry only78## Purpose910Model **one manufacturable component's functional solid**: primary shape, structural voids (shells, pockets), and **mating interface geometry** (bores, spigots, slots, snap ledges) — so it assembles correctly. This pass is **not** cosmetic and **not** full DFM.1112## What this pass is NOT1314Do **not** add in this pass (other skills own these):1516| Feature | Owner |17|---------|--------|18| Fillets, cosmetic chamfers, ribs, gussets | `cadquery-part-detailing` |19| Clearance holes, tap drills, counterbores, countersinks | `cadquery-manufacturability` |20| Vendor procurement BOM comments, engraved P/N | `cadquery-manufacturability` |21| Process draft, sheet-metal bend notes | `cadquery-manufacturability` |2223A functional bracket may have a **mounting bore** (interface diameter) here; the **clearance + counterbore** for an M6 cap screw come in DFM.2425## Authoritative rules2627Follow `cad-generation.txt` — Critical Pitfalls, Boolean Rules, Geometry Constraints, Mechanical Interfaces (model the interface shape, not full fastener spec).2829## Required file shape3031```python32"""<function_name> — <one-line role>. Origin: <part-local origin rule>."""33import cadquery as cq34import math35from common import (36 HOUSING_W, M3_BORE_DIA, # every shared dim used37)3839def build_<function_name>() -> cq.Workplane:40 # ---- functional geometry only ----41 ...42 return <part_name>4344result = build_<function_name>()45```4647- Path: `parts/<function_name>.py`48- **Import shared dimensions from `common.py`** — never duplicate `HOUSING_W`, mate PCDs, or partner bore diameters.49- Part-local origin documented in module docstring (e.g. "center of footprint, Z=0 on bottom face").5051## Inputs from orchestrator5253- Function name, file path, manufacturing process guess54- Envelope + `MATE_*` constants from `common.py`55- Per-mate: what **this** part provides (socket, spigot, clearance bore, weld face, snap ledge)5657## Build order (mandatory)58591. **Parameters** — only dims not already in `common.py`.602. **Primary body** — one main extrude, revolve, or `.box()` / `.cylinder()`.613. **Structural voids** — `.shell()`, pockets that define wall thickness (functional, not cosmetic).624. **Interface features** — one single-extrusion tool per `cut`/`union`:63 - Bearing bores, shaft journals, keyways, drip-tray pockets, snap ledges64 - **Pilot or clearance diameter only if it is the functional interface** (e.g. bearing pocket Ø); thread/clearance pairs wait for DFM655. **No edge treatments** — no `.fillet()` / `.chamfer()` except a **functional** shaft lead-in under 0.5 mm if required for assembly simulation666. `return` the workplane from `build_*()`; `result = build_*()` at module level6768## Design realism (functional tier)6970Apply what the **function** requires — not full cosmetics:7172- Housings: hollow via `.shell(-WALL_T)` on simple faces — not solid blocks73- Shafts: bearing journal steps, keyway slot if driven74- Brackets: outline + mounting **bore** locations (use `MATE_*` positions from `common.py`)75- Plates: hole **positions** via `pushPoints` or construction `rect` + `.vertices()` — diameters may be finalized in DFM7677Skip ribs, gussets, and fillets — detailing adds those.7879## Vendor / OTS parts8081- Model **interface envelope** (bore, boss, cutout for body) in this pass.82- At most a short `# VENDOR — <category>, <key dims>` above the cut — **no SKU paragraph** until DFM.83- If a STEP file is injected, use `cq.importers.importStep('file.step')` per `cad-generation.txt`; do not redraw the catalog part.8485## Anti-patterns — refuse to emit8687- `rect(..., centered=False)` — use `.center(dx, dy).rect(w, h)`88- `cq.selectors.*` — string selectors only89- Compound boolean tools (`tool = a.union(b); body.cut(tool)`)90- Nested booleans in arguments91- `.translate()` on empty Workplane92- Reused rotated Workplane for multiple cuts93- Loft/sweep as boolean tools94- `extrude(0)` or revolve profile crossing axis95- Fillets/chamfers (detailing pass)96- Counterbores, tap drills, clearance pairs (DFM pass)97- Duplicating constants that exist in `common.py`9899## Validation before hand-off1001011. `python -c "import runpy; ns=runpy.run_path('parts/<name>.py'); bb=ns['result'].val().BoundingBox(); print(bb)"` — non-zero spans.1022. Bounding box roughly matches envelope from `common.py` (± sensible feature tolerance).1033. Hand to orchestrator for **`cadquery-render`** and **`cadquery-interference-check`** — do not render from this skill.104105## Output106107`parts/<function_name>.py` with `build_<function_name>()` and top-level `result`. No edits to `assembly.py` from this skill.