Skip to content

Packs / manufacturing-public

gcode-preflight

Preflight a CNC G-code file: units, bounds, feed rates and spindle state before it runs on the machine

L2 Checks passed 3 of 3 runsv1.0.0Tech-Realm/space-manufacturing-public

Install

logicpacks pack use manufacturing-public/gcode-preflight
get_pack manufacturing-public/gcode-preflight

The second line is the MCP tool call for the LogicPacks connector (Claude Code, Codex, Claude.ai and others). The first run of a pack someone else wrote asks for your yes.

Keys it needs (names only)

None.

Playbooks included

  • Spec: spec/SPEC.md (goal, steps, edge cases, don’ts)
  • Routes: local-python
  • Checks: 2 in outcome/checks.yaml
  • Code: gcode_check.py
  • Tools: python3

Usage, last 8 weeks

New: no recorded use yet.

Purpose (from spec/SPEC.md)

Goal

A pass/fail report for a G-code file: units set (G20/G21), absolute mode, XYZ travel within the machine envelope, no cutting moves with spindle off, feed within limits.

Verified by: A good fixture passes; a fixture that cuts with spindle off and exceeds Y travel fails with those reasons.

Steps

  1. Run python3 code/gcode_check.py part.nc --x 300 --y 300 --z 80 --max-feed 3000.
  2. Fix every FAIL line in CAM, re-export, re-check.
  3. Air-cut first on the machine anyway.

Edge cases

  • Incremental mode (G91) sections: positions are accumulated.
  • Arcs (G2/G3) are checked at endpoints only.

Don'ts

  • Don't treat a pass as permission to skip the air cut.
  • Don't edit G-code by hand to silence a failure.