GPath Laser

Saving G-code

Last updated Dec 4, 2026, 5:24 PM

G-code is the list of instructions your laser follows. This page covers saving it as a file, choosing a post-processor, and making sure the file burns in the right place.

Key idea: what's a post-processor? Each controller reads a slightly different version of G-code. A post-processor writes your job in the version your controller understands. GPath picks the right one from your machine profile, so you rarely need to change it.

Run or save?

Run from GPath Save a file
Use it when Your laser is plugged in over USB You run jobs from an SD card or other software, or use LinuxCNC
Needs a connection Yes No
Live controls Frame, Pause, Speed, Stop and more. See Running a job. Whatever your machine or other software offers
Operations The visible ones The ones you tick, whether they're visible or not

1. Open the dialog

gpath laser setup and output menu

Use either:

  • the Save laser operations icon in the Setup & output row of the Laser operations tab, or
  • Laser operations → Save laser operations in the top menu.

You need at least one laser operation first.

gpath laser gcode save menu


2. Choose the operations

Every operation is ticked each time you open the dialog, including hidden ones. Each row shows the operation's name and type, with its power, speed, passes and number of vectors.

  • Click anywhere on a row to include it or leave it out.
  • Click All or None, above the list on the right, to select everything or clear the list.

Operations run in the order they're listed. To change the order, reorder them in the Laser operations tab before you save.


3. Set the output

Setting What it does
Post-processor The G-code version to write. It starts on your machine's post. See section 6.
Program name A note at the top of the file, such as (Laser job: Coaster). It starts as your project's file name, or Untitled. It doesn't name the file. Brackets are written as [ ], so Sign (1) becomes Sign [1].
Single file Shown when you've picked more than one operation. Combine into one file is on by default.

The chips under Post-processor show the file types and whether curves are written as true arcs. The first file type listed is the one used when you save. Hover over a post in the list to read what it's for.

Combined or separate? A combined file runs everything in one go. Separate files are useful when you want to run operations at different times, for example engraving a batch of pieces first, then cutting them out. Each file has its own start and end, so the head returns at the end of each one (see section 5).


4. Save

The footer tells you what will be written, for example:

  • 1 laser operation → 1 file
  • 3 laser operations → 1 file (combined)
  • 3 laser operations → 3 files (separate)

Click Save…, choose where to save, and click Save in your computer's save window.

  • A combined file is suggested as combined_toolpaths, such as combined_toolpaths.gcode. Rename it to anything you like.
  • Separate files open one save window per operation, each named after its operation, such as Fill 1.gcode.

5. Where the file burns

The file doesn't set a work zero. It runs from wherever your controller's work zero is, so this is the step to get right. Choose the mode on the Origin tab of the Laser panel before you save. See Absolute vs Current origin.

Origin mode What the file does What to do on the machine
Absolute Uses the canvas positions, measured from the project's reference point Make sure work zero is at the reference point. Homing usually does this.
Current Moves the job so its chosen Job origin point lands on a set position See below

In Current mode, GPath writes that set position into the file when you save. It uses the first of these that applies:

  1. A start you've saved: your last Run or Frame, if you haven't moved the head since, or Save job start on an offline profile.
  2. The head's position, if your laser is connected.
  3. Work zero (0, 0).

Example: with your laser not connected, a Job origin at the bottom-left and no earlier Run or Frame, the bottom-left of the job burns at work zero. Jog to the corner of your material, set work zero there on your machine, and run the file.

If you save again after moving the head, you'll get a new position, but a file you've already saved won't change.

At the end of the file, the laser turns off and the head returns to your Home Position in Absolute, or to the job's start in Current.

Good to know: the work area check only happens when you click Run, so nothing warns you if a saved job goes past the edge of the bed. Check the size on the Simulate tab, and frame the job on your machine if you can.


6. Which post-processor?

Use the one that matches your controller. GPath chooses it for you, and starts on it each time you open the dialog.

Your controller Post-processor Saves as Laser on
GRBL, or unsure GRBL 1.1 Laser .gcode or .nc M4 or M3, following Dynamic Power (M4)
FluidNC FluidNC Laser .gcode or .nc The same as GRBL 1.1 Laser
grblHAL grblHAL Laser .gcode or .nc The same as GRBL 1.1 Laser
Marlin Marlin Laser .gcode M3 I, where each move sets its own power
Smoothieware Smoothieware Laser .gcode or .nc M3. Program name isn't written in the file.
LinuxCNC LinuxCNC Laser .ngc, .nc or .gcode M3, with line numbers and M30 at the end

A few posts have limits worth knowing:

  • Marlin Laser is chosen for every Marlin machine, including one set to Marlin CNC, but the laser only fires if the firmware is built with LASER_FEATURE. Air assist (M8) only works if the firmware has AIR_ASSIST or COOLANT_CONTROL, otherwise Marlin ignores it.
  • LinuxCNC Laser suits Line jobs best. LinuxCNC doesn't change power in step with movement, so Fill and Image jobs can slow down and burn unevenly.

Changing the post here only affects this save. Run always uses your machine's post. To change that too, edit the machine's Post-processor in Machine setup.

Power values

Power is written in your machine's max S range, whichever post you choose. For example, 50% is S500 on a machine with a range of 1000, and S0.500 on a Smoothieware machine with a range of 1. If your project has no machine, GPath uses the first machine in your list.

With no machines set up at all, Smoothieware Laser writes 0 to 1, Marlin Laser writes 0 to 255, and the others write 0 to 1000. So add your machine first.

Good to know: FluidNC's laser usually runs 0 to 255, so the FluidNC · Laser machine template starts at 255. If you connect over USB, GPath reads the real range from the controller. If you only save files, check max S matches your FluidNC config. See Machine setup.


7. Laser operation summary

The summary is a quick check of the order and settings before you save. Open it with the Summary icon in the Setup & output row, or Laser operations → Laser operation summary.

Part What it shows
Show All operations, or Selected to tick which ones to include, with All and None links
Laser operations Each operation in order, with its type, power, speed, passes and number of vectors
Footer How many operations are shown

Click Save as text… to save it as a .txt file to keep beside the machine, or Close when you're done.


8. Custom post-processors (advanced)

If none of the built-in posts suit your laser, you can import your own. A post-processor is a small text file in TOML format.

  1. Open the Post-processor list and click Import Custom... at the bottom.
  2. Choose your .toml file.

It's selected straight away, with (custom) after its name, and it's kept when you restart GPath.

The file's sections are explained under Custom post-processors in the CNC docs' Saving G-code page. For a laser post:

  • Set target = "laser" under [meta]. A post with target = "cnc" won't appear in the list.
  • You can add a [laser_export_rewrite] section:
Option What it does
map_m4_laser_on_to_m3 = true Writes M3 wherever the laser would switch on with M4
inline_laser_mode = true Marlin only: switches the laser on in inline mode, such as M3 I
power_full_scale = 1 The power range to write when no machine is set up

Troubleshooting

Save… is greyed out Pick at least one operation in the list.

I don't see the Combine into one file switch It only appears when you've picked more than one operation.

An operation I'd hidden was burned too The dialog ticks every operation, whether it's visible or not. Untick the ones you don't want.

The file burned in the wrong place Check your controller's work zero, then see section 5.

The head moves but the laser doesn't burn, or burns far too faint Check the file was saved for the right machine, with the right max S. See Machine setup. Reconnect your laser so GPath can read its range, then save again.

My post went back to the default The dialog starts on your machine's post each time. To keep a different one, change it in Machine setup.

"Save operation cancelled by user" You closed your computer's save window without saving. Nothing was written, so click Save… to try again.

"Cannot save" The post-processor has a problem, usually a mistake in a custom post. The message says what's wrong. Fix the .toml file and import it again, or choose another post.

Job on several sheets? All sheets under Sheets saves a file for each one. See Sheets.


See also

GPath Laser See every feature, pricing, and the free trial.