# gcode-preflight

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

- **Space:** manufacturing-public (https://github.com/Tech-Realm/space-manufacturing-public/tree/main/gcode-preflight)
- **Level:** L2 (as the registry reports it)
- **Keys it needs (names only):** none
- **Tools:** python3
- **Routes:** local-python; checks: 2
- **Uses:** new (no recorded use yet)
- **Install:** `logicpacks pack use manufacturing-public/gcode-preflight` or MCP `get_pack manufacturing-public/gcode-preflight`
- **Files:** CHANGELOG.md, code/gcode_check.py, outcome/EVIDENCE.md, outcome/checks.yaml, outcome/fixtures/bad.nc, outcome/fixtures/good.nc, outcome/results.json, pack.yaml, spec/SPEC.md, spec/source.md

## Purpose (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.



---

Canonical URL: https://logicpacks.io/packs/manufacturing-public/gcode-preflight

Developed by TechRealm (techrealm.online), the software team. Operated by Al Jash Trading (Establishment), Abu Dhabi, since 1994, the legal entity that hosts and is responsible for the service. Economic licence CN-1030597, Abu Dhabi Registration Authority. Address: Office 5, Bani Yas West 4, Bani Yas, Abu Dhabi, UAE. Website: https://aljashtrading.com. Contact: hello@logicpacks.io, security@logicpacks.io, WhatsApp +1 713 632 2262 (https://wa.me/17136322262).

Machine-readable index: [/llms.txt](/llms.txt). Plain facts: [/about.md](/about.md). Safety: [/safety.md](/safety.md).
