Skip to content

Device Settings: Custom GCode

Internal Note

  • As with the other tabs, this screenshot should eventually become an interactive SVG.
  • Content for this is almost entirely contained within a snippet, since we'll also need a more detailed breakdown on creating a Custom GCode device, and that will allow us to reuse the information.
  • I left the MillMage-only options in, since our goal is to reuse this for MillMage docs, and I think that anybody dealing with this tab in detail (as opposed to copy/pasting what they're told) is going to be the type of person to want and not be scared off by that info.

The Custom GCode tab of Device Settings allows for advanced GCode customization when using the Custom GCode device type.

The Custom GCode tab of Device Settings

Custom GCode Options

In this section, you can set some baseline options for your custom GCode profile.

Name Description
GCode Flavor What flavor of GCode to use as a base
Dwell Units Whether pause times are given in seconds or milliseconds
Comment Characters What character(s) are used to indicate comments
Suppress Comments Enabling this will strip all comments from the GCode LightBurn generates
Tool State Automatic Enabling this will cause the tool to automatically turn on during a cut move
Variable Laser Power Enabling this will allow you to control the laser's power beyond on and off

GCode Commands

This section lists each command that can be customized. Leaving a command blank will leave it unchanged from the default based on your Custom GCode Options:

  • The title indicates what command you're working with.
  • The text box contains the default value in gray text, if there is a default. If there is no default value, the text box is blank.
  • Below the text box is a preview of what the output for the command would look like, based on current settings.

Hover over a section for more detailed information. For information on variables to use in the commands, see Custom GCode Variables

Custom GCode Variables

These variables can be used in your GCode templates. Some variables are only available for MillMage.

Variable Description Availability
x X axis position
y Y axis position
z Z axis position
r, a, u, rot, rotation Rotary axis position
x_probe X probe offset MillMage-only
y_probe Y probe offset MillMage-only
z_probe Z probe offset MillMage-only
s, speed Movement speed
feed, feedrate Movement speed MillMage-only
p, power Laser Power
rpms, spindlespeed Spindle speed or RPM/s MillMage-only
dwell Dwell time
tool Tool number

Custom GCode Macros

Relative and absolute mode are controlled by the software, so if you need to change it within your GCode template, use the following macros to prevent the software overriding your changes. You must always use |RESTORE| when you're done to ensure a return to the previous mode.

Macro Description
|REL| Enter relative mode
|ABS| Enter absolute mode
|RESTORE| Restore previous mode

Optional and Required Values

Surrounding the letter before a variable with [] will tell LightBurn that this portion of the command has not changed since the last emit. Putting a * in front of any variable will tell LightBurn to skip the entire line if it has not been changed.

  • G1 X{x} Y{y} Z{z} will always output the X, Y, and Z values.
  • G1 [X]{x} [Y]{y} [Z]{z} will skip any values that have not changed.
  • M106 S{*power} this will output the M106 command only if it has been changed.

Non-Printable / Non-Typeable Characters

Control characters can be output by using \x followed by the two digit hex value of the character. For instance, \x18 represents an immediate job abort on a GRBL device.

Troubleshooting

  • If you aren't seeing a setting you expected to see, check which tab you're in and make sure it's applicable to your laser.

For more help using LightBurn, please visit our forum to talk with LightBurn staff and users, or email support.