Repository navigation
Add the build123d CAD toolchain with validation and quality gates - #1
Merged
Merged
Conversation
One command (scripts/fab_export.sh) produces Gerbers + Excellon drill + JLCPCB BOM + CPL and a gerber zip for upload. scripts/jlc_bom.py reads the schematic's LCSC Part properties; scripts/jlc_cpl.py converts the KiCad pos file to JLCPCB's CPL columns. Default is SMT-only assembly with the BOM restricted to the CPL designators so the two agree; --tht includes through-hole parts. Ordering stays manual and approval-gated: JLCPCB's official Open Platform API is application-gated and not wired. Full flow in docs/jlcpcb-fabrication.md.
Agents can now author and edit the printed wedge enclosure as code and export STEP + printable STL end to end, with no human relaying. - cad/parameters.py every dimension (single source of truth) - cad/wedge.py parameterised wedge; exports STEP/STL + a 4-view preview - scripts/cad-setup.sh sudo-free bootstrap of the repo-local .venv toolchain - scripts/cad-run.sh run the model with the right env - docs/cad-toolchain.md tool decision, layout, conventions, requirements map - cad/exports/ committed STEP + STL (input to the Bambu print task) Model satisfies P1 (150x55x150 mm on the 180^3 A1 mini bed), P2 (wedge), T2/T5 (metal interface plate in a rebate, plastic off the hot path), T4 (SmCo magnet pockets), S2 (M3 retention holes) and the section 8 1.4 MPa clamp (four M4 bosses, ~2.9 kN). See docs/cad-toolchain.md.
Author the same enclosure (same cad/parameters.py) with two more agent-drivable tools so the result can be judged by review and print quality, not by description. - cad/bakeoff/cadquery/wedge_cq.py CadQuery port (same OCCT kernel) - cad/bakeoff/solidcraft/wedge.json SolidCraft command script (truck kernel) - cad/bakeoff/*/exports/ committed STEP + STL + preview per tool - scripts/cad-setup-cadquery.sh, cad-run-cadquery.sh .venv-cadquery toolchain - scripts/cad-solidcraft.sh pins + downloads the SolidCraft CLI - cad/bakeoff/README.md comparison, how to run, print guidance - cad/bakeoff/render_stl.py kernel-agnostic 4-view preview from STL All three fit the Bambu A1 mini 180 mm bed and agree on the solid to <0.01% volume (150x55x150 mm; 248.4 cm^3). build123d keeps its canonical exports at cad/exports/ for the Bambu print task; the contenders export under cad/bakeoff/.
The user asked to also consider FreeCAD. Author the same wedge enclosure with
FreeCAD's Part scripting API (headless freecadcmd) and add it to the bake-off.
- cad/bakeoff/freecad/wedge_fc.py FreeCAD port (same OCCT kernel)
- cad/bakeoff/freecad/exports/ committed STEP + STL + preview
- scripts/cad-run-freecad.sh pins + downloads the FreeCAD AppImage
- cad/bakeoff/freecad/README.md gotchas (makeThickness, freecadcmd argv,
binary STL via MeshPart)
- cad/bakeoff/README.md, docs/cad-toolchain.md updated for four tools
FreeCAD matches the other three exactly: 150x55x150 mm, 248.4 cm^3 (build123d,
CadQuery and FreeCAD are all OCCT and agree; SolidCraft's truck kernel matches to
rounding). FreeCAD wrote the smallest STEP (54 KB) and coarsest mesh (4,112
facets).
- scripts/validate_cad.py checks committed STEP/STL artifacts: manifold and single-body meshes, bed fit, STEP<->STL agreement, bake-off agreement, and a stale-export rebuild of cad/wedge.py. - scripts/validate.sh is the single entry point (--cad / --hardware) and now gates on KiCad error-level violations while reporting warnings. - .github/workflows/validate.yml runs the CAD, hardware (ERC/DRC + JLCPCB package) and script-syntax jobs and uploads the reports. - docs/validation.md documents what runs, local usage, failure fixes, scope.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
The code-CAD toolchain for the TEG wedge enclosure, plus the gates that keep it correct.
cad/parameters.py(every dimension) +cad/wedge.py— build123d on the OpenCASCADE kernel. STEP + printable STL are committed undercad/exports/.scripts/validate_cad.pychecks the committed STEP/STL (parse, watertight single-body mesh, sits on the bed, fits the A1 mini 180 mm cube, STEP↔STL agreement, stale-export rebuild). Wired intoscripts/validate.sh --cadand CI.wedge_enclosure.{stl,step,png}.docs/cad-toolchain.md(toolchain contract + VS Code OCP CAD Viewer workflow),docs/validation.md,cad/README.md.scripts/fab_export.sh,scripts/jlc_bom.py,scripts/jlc_cpl.py,docs/jlcpcb-fabrication.md. Ordering stays manual and approval-gated.The earlier CadQuery / SolidCraft / FreeCAD bake-off was a comparison exercise; build123d is the tool we are maintaining, so the bake-off sources, exports and runner scripts have been removed from this branch.
Verification
scripts/cad-lint.sh— ruff + mypy cleanscripts/cad-test.sh— 13 passedscripts/validate.sh --cad— all artifact checks passReviewer notes