Repository navigation
Conversation
On build123d turns the LLM now also emits a machining plan (a \`cam\` JSON block: material + face/drill/pocket/profile ops with toolbit ids). Mnft.Cad.CamPlan validates it against priv/cam/toolbits.json (23 ids: Genmitsu MC40A/BN10A geometry vendored from potsed's SainSmart library, plus per-material feeds/RPM/stepdown tables). A validated plan flows through the worker payload into a FreeCAD 1.1 --console CAM job (cad_worker/cam.py + cam_freecad.py) that machines the exported STEP and posts it with the grbl post-processor; model.gcode lands as a downloadable artifact next to STEP/STL/GLB. - Deterministic geometry selection: ops name the toolbit, the FreeCAD script picks faces/edges (largest +Z face = top, +Z planar faces below it = pocket floors, full-circle edges = holes); origin = stock min corner, Z0 = stock top. - Honest output: header comments list tools/feeds/ops; warnings for oversized parts, holes narrower than the tool, undersized drilled holes, missing pockets, aluminum lube. - CAM failures are non-fatal: missing FreeCAD, timeouts and rejected plans surface as chat notes/amber warnings; the model still lands. - OpenSCAD stays mesh-only (prompt explains CNC needs build123d). - Worker SIGALRM and Elixir port deadline extend by the CAM budget. - Tests: CamPlan validator (16 cases), cam.py bridge (11 cases, FreeCAD mocked); E2E-verified on the live pipeline: aluminum plate G-code carries 340/140 @ 10000 rpm for flat-3.175 with four drills at the exact corner positions; birch wood gives 900/300 @ 12000. Note: vbit-20 uses 20deg/0.1mm/3.175mm-shank MC50A entry (exact match for the nano-blue bits) instead of the 6.35mm-shank WC04A.
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
Every successful build123d build can now also produce a GRBL
model.gcodefor a desktop CNC. The assistant emits a machining plan (```camJSON block: material + face/drill/pocket/profile ops with toolbit ids), it is validated Elixir-side, and a FreeCAD 1.1--console` CAM job machines the exported STEP with the real toolbit geometry. The G-code appears as a "G-code (GRBL)" download next to STEP/STL/GLB; CAM notes/warnings render as an amber card in chat.How it works
mnft_cad/priv/cam/toolbits.json(feeds/plunge/RPM/stepdown per material, work envelope, post) + 24 vendored.fctbfiles from potsed/freecad_sainsmart_toolbits (Genmitsu MC40A flat ends 0.8–3.175, BN10A/MC40A ball noses, 20°/0.1 mm V-bit). Ball noses 1.2–3.0 mm are synthesized from same-size flat-end geometry (provenance noted in-file). Tune feeds by editing the JSON — no code change.Mnft.Cad.CamPlan— strict schema, toolbit ids must exist; rejection is non-fatal ("CAM plan rejected: …" note, model still lands).cad_worker/cam.py→cam_freecad.py. Geometry selection is deterministic (largest +Z face = top, +Z planar faces below it = pocket floors, full-circle edges = holes — the LLM never picks faces). Origin = stock min corner, Z0 = stock top. Ops clear their SetupSheet expression bindings so scripted depth/stepdown values stick.Verification
{aluminum, face+drill+profile, flat-3.175}; G-code headerrpm=10000 feed=340 plunge=140; four drills at exactly (6,6)/(34,6)/(34,74)/(6,74) through Z-3; perimeter profile with radius offset; feeds only 140/340.MNFT_ENGINE=openscad+ CNC ask → no G-code, chat explains build123d requirement.Deviations worth review
20deg_V-Bit_0.100mm_Tip_MC50A.fctb(3.175 mm shank, 20°, 0.1 mm tip — exact match for the nano-blue bits) instead of the planned WC04A entry, which has a 6.35 mm shank that doesn't fit the 3.175 mm collet.ToolBit.from_filecrashes on°under the macOS C locale → the bridge usesToolBit.from_dictafter reading the JSON itself.Config
MNFT_FREECAD_CMD(default the macOS bundle) andMNFT_CAM_TIMEOUT_S(default 180) — documented in.env.exampleand the README.