Beam Bench Docs

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:

  1. Job header (if configured in the machine profile), your custom prefix commands.
  2. Coordinate setup: typically G21 (mm), G90 (absolute), G94 (units per minute).
  3. Per-layer / per-segment commands:
    • Rapid moves (G0) with the laser off.
    • Cutting / engraving moves (G1) with S<power> for power and the layer's feed rate.
    • Laser on / off as needed (M3 or M4 for constant or dynamic power, M5 for off).
    • Air assist commands if configured.
  4. 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 ControlSave 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:

CodeMeaning
G0 X Y FRapid move to X, Y at feed rate F. Laser off.
G1 X Y S FLinear move with laser on at power S, feed rate F.
M3 SSpindle / laser on, constant power mode.
M4 SSpindle / laser on, dynamic power mode (varies with feed).
M5Spindle / laser off.
M7 / M8 / M9Coolant / 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).
G21Set units to millimeters.
G90Absolute positioning.
G91Relative positioning.
G92 X YSet 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.

On this page