CadQuery part detailing — geometric finish pass
Purpose
Make the part look and behave like engineered hardware: ribs, gussets, stress-relief fillets, hole lead-ins, rounded plate outlines. The functional solid from cadquery-part must already assemble and interference-check clean before this pass.
What this pass is NOT
| Do NOT add | Why |
|---|---|
| New holes, slots, tapped features | cadquery-part or cadquery-manufacturability |
| Clearance / counterbore / tap drill | DFM |
| Vendor BOM / SKU comments | DFM |
| Shells or wall thickness changes | Functional |
| Fastener patterns | DFM |
If functional geometry is missing a rib required for strength, add it here — but do not add mounting holes.
Authoritative rules
cad-generation.txt — Design Realism, Edge Selectors, fillets/chamfers last, sketch-level fillets when possible.
Inputs
parts/<function_name>.pyafter functional pass + local interference OK- Mechanical role: cantilevered walls, handled edges, molded corners
- Mating direction (usually +Z) for lead-in chamfers
Build order — strict
- Re-open the functional file — preserve parameters and functional block; append a
# ---- Detailing ----section. - Structural reinforcement (single-extrusion
unioneach):- Ribs / gussets on cantilevers:
polyline(...).close().extrude(t) - Boss pads only where functional pass left thin material around an existing hole — do not re-drill
- Ribs / gussets on cantilevers:
- Lead-in chamfers on existing hole entries and spigot leads — small (0.3–0.8 mm), 1–2 string selectors
- Fillets last — inside corners first, then external ergonomics; radius ≤ 40% of local wall thickness
- Sketch-level rounding for plate outlines when the whole perimeter should be round:
plate = (
cq.Workplane("XY")
.sketch().rect(w, h).vertices().fillet(r).finalize()
.extrude(t)
)
Prefer sketch-level for plate corners — post-extrusion edges(">Z") often fails silently.
result = build_<function_name>()— update the builder to return the detailed body, not a orphan variable.
Template (append inside build_*())
# ---- Detailing: reinforcement ----
gusset = (
cq.Workplane("XZ", origin=(gx, 0, gz))
.polyline([(0, 0), (rib_l, 0), (0, rib_h)]).close()
.extrude(rib_t)
)
part = part.union(gusset)
# ---- Detailing: lead-in chamfers (holes face +Z) ----
part = part.edges("|Z").edges(">Z").chamfer(0.5)
# ---- Detailing: fillets (inside corners) ----
part = part.edges("|Z").fillet(1.5)
return part
Anti-patterns
- Fillets before all unions/cuts in this section complete
cq.selectors.*- Fillet radius > local thickness
- Duplicating ribs/bosses already in functional pass
- New
cut()features except tiny lead-in chamfers on existing geometry
Validation
Orchestrator runs cadquery-render then compares to functional renders:
- Sharp edge where fillet expected → selector failed; tighten (
|Z+>X) or use sketch fillet - New clash with neighbor → reposition rib or hand to interference skill
Re-run local cadquery-interference-check after detailing — ribs often cause clashes.
Output
Same file parts/<function_name>.py, same build_<function_name>(), with detailing inside the builder. Top-level result = build_<function_name>().