audit.ts

cad/audit.ts
// Machine-safety + dimensional audit of every generated G-code job.
// Run with: npm run audit
//
// Catches the things that break bits, gouge stock, or halt GRBL mid-cut:
// 1. lines GRBL can't parse (incl. parens inside comments)
// 2. commands outside the known-safe whitelist
// 3. XY motion before Z is ever commanded (bit-drag on job start)
// 4. motion before units/absolute/spindle are established
// 5. rapids plunging into stock, or traveling with the bit at/below surface
// 6. XY travel below the safe height
// 7. cutting moves with no feed (or zero feed)
// 8. vertical descents into stock faster than the plunge feed
// 9. diagonal (XY+Z) entries into stock
// 10. cuts deeper than the material + overcut
// 11. coordinates outside the machine area
// 12. missing spindle-off / program-end, or parking the bit low
// ...plus the dimensional audit: every part's toolpath corners, window
// corners, depths, and hole positions must land exactly on the 3D plan.
import { camBoard, CAM, type CamJob } from "./gcode";

Showing the first 20 lines.

Get full code

Support

Talk to the developers of this project to learn more

We have been building professional websites for big clients for over 15 years. Gallop templates and blocks is our best foundation for SEO websites and web apps.

© 2026 Web Plant Media, LLC