G-code output
What Beam Bench emits when a job runs. How to read it, save it, and feed it to a machine outside Beam Bench.
When you run a job (or click Save GCode in Laser Control), Beam Bench emits standard G-code that GRBL-based controllers understand. This page describes the high-level structure and how to use the output.
What it contains
A Beam Bench G-code file is structured as:
- Job header (if configured in the machine profile), your custom prefix commands.
- Coordinate setup: typically
G21(mm),G90(absolute),G94(units per minute). - Per-layer / per-segment commands:
- Rapid moves (
G0) with the laser off. - Cutting / engraving moves (
G1) withS<power>for power and the layer's feed rate. - Laser on / off as needed (
M3orM4for constant or dynamic power,M5for off). - Air assist commands if configured.
- Rapid moves (
- Job footer (if configured), your custom suffix commands.
The exact dialect depends on:
- The machine profile's Output Policy settings (see Device Settings → Profiles):
- Constant Power (M3) vs dynamic (M4).
- Emit S on Every G1: repeat power per line vs once at start.
- S-value Max: the controller's max S value (usually 1000 or 255).
- Use G0 for Overscan: overscan via rapids vs feed.
How to get the file
- GUI: Laser Control → Save GCode opens a save dialog when a machine is connected, or use Laser Tools → Save Machine Files after preview is current.
- CLI:
beambench-cli export gcode /abs/path/project.lzrproj /abs/path/out.gcode(positional input and output).
Saving G-code through the menu or CLI does not require a connected machine. Useful for:
- Sending the file to a machine on a different computer.
- Feeding GRBL via a different sender or bridge.
- Inspecting the output for debugging.
Reading the output
For GRBL specifically, the relevant codes are:
| Code | Meaning |
|---|---|
G0 X Y F | Rapid move to X, Y at feed rate F. Laser off. |
G1 X Y S F | Linear move with laser on at power S, feed rate F. |
M3 S | Spindle / laser on, constant power mode. |
M4 S | Spindle / laser on, dynamic power mode (varies with feed). |
M5 | Spindle / laser off. |
M7 / M8 / M9 | Coolant / air assist on / off (varies by config). |
S<n> | Power, scaled to S-value Max. |
F<n> | Feed rate (mm/min in default GRBL config). |
G21 | Set units to millimeters. |
G90 | Absolute positioning. |
G91 | Relative positioning. |
G92 X Y | Set current position to (X, Y), used for Job Origin. |
Edge cases
- The same Beam Bench project can produce different G-code with different machine profiles (different Output Policy, different S-value Max, different Air commands). The output is profile-specific.
- The Job Header and Job Footer in the profile are emitted verbatim. They can contain machine-specific setup (homing, coordinate system selection, etc.).
- Beam Bench's planner outputs lines and points the optimizer produced. Hand-editing the output is possible but fragile, small changes can confuse subsequent moves.
Related
- Laser Control: Save GCode button
- Device Settings dialog: Output Policy fields
- GRBL essentials
- Console panel: manual G-code testing