Post-processors in GCarve
How to change a built-in post for your machine, or write your own.
A post-processor turns GCarve's toolpaths into the G-code dialect your controller reads. GCarve comes with built-in posts for GRBL, Mach3/4, LinuxCNC, UCCNC, Centroid, Masso, WinCNC, ShopBot, Haas and others. You can also add your own: a GCarve .json post, or a Vectric .pp post you already have.
Change a built-in post
- Open Toolpaths › Post-Processors….
- Find the built-in post closest to your controller. Search by machine, controller, units or file extension, for example Shapeoko, Mach4, mm or .sbp.
- Click the export icon on its row, Export as editable JSON. GCarve saves a
.jsonfile. - Open the file in any text editor (Notepad, TextEdit in plain-text mode, VS Code). Give it a new
"name"so you can tell it apart, then change what you need (see below). - Back in Post-Processors, click Upload post… and pick your file. It's added as a custom post, and the built-in post is left as it was. The new post is selected for the current board straight away.
- Export a job, then run File › Export Air-Cut Test… (the same file raised well above the board) before cutting wood.
To change it again, edit the file and upload it once more: a post with the same "id" replaces the old one. A custom post can be deleted with the bin icon on its row.
.pp post for your machine? Upload it as it is: GCarve translates it. Air-cut the first file to make sure it reads the same way.What's in a post file
Here's the built-in GRBL (inch) post as it exports. A key you leave out keeps its default, and unknown keys are ignored.
{
"id": "grbl-in",
"name": "GRBL (inch, .nc)",
"controller": "GRBL",
"machines": "Shapeoko, X-Carve, …",
"extension": "nc",
"inches": true,
"decimals": 4,
"arcs": true,
"maxArcSweepDeg": 180.0,
"comment": "({})",
"header": "({FILENAME})\n(Tool: {TOOLNAME})\nG90 G20 G17 G94\nG54\nM3 S{RPM}\nG4 P2\n",
"toolChange": "",
"pathStart": "({PATHNAME})\n",
"pathEnd": "",
"footer": "M5\nG0 Z{SAFEZ}\nM30\n",
"rapid": "G0 {X} {Y} {Z}",
"linear": "G1 {X} {Y} {Z} {F}",
"arcCW": "G2 {X} {Y} {Z} {I} {J} {F}",
"arcCCW": "G3 {X} {Y} {Z} {I} {J} {F}",
"feedChange": "",
"plunge": "",
"retract": "",
"firstLinear": "",
"substitute": "",
"feedDecimals": 0,
"lineNumberStart": 10,
"lineNumberStep": 10,
"modalAxes": true,
"crlf": false
}
In the text blocks, \n starts a new line.
About the post
| Key | What it does |
|---|---|
id | Its own short name. GCarve adds user- in front, and if it's the same as a built-in's, uses the file name instead. |
name | What the list shows. |
controller, machines | Words for the search box. |
extension | File extension of the G-code, without the dot: nc, tap, gcode… |
inches | true = numbers in inches, false = millimetres. Use the matching G20 / G21 in your header. |
decimals | Digits after the point for coordinates. |
feedDecimals | Digits after the point for feed rates. |
crlf | true = Windows line endings, which some controllers need. |
Measurements you can set
These keys are optional: leave them out and the values come from the job. Numbers are in the post's units (inches or mm).
| Key | Sets |
|---|---|
safeZ | {SAFEZ}, instead of Job Setup's lift height. E.g. "safeZ": 25 in a mm post. |
homeX, homeY, homeZ | {XH}, {YH}, {ZH}: where the post sends the machine at the end, e.g. "footer": "M5\nG0 Z{ZH}\nG0 X{XH} Y{YH}\nM30\n". |
Every other number in a post is plain text in its blocks (dwell times, G53 Z0 lifts…), so change it there.
Blocks: where text goes in the file
| Key | Written |
|---|---|
header | Once, at the top of each file. |
toolChange | Before each bit. Empty = one file per bit (manual tool changes). Filled = one file with every bit, for tool changers: this block is written before each bit, with that bit's {TOOLNUM}, {TOOLNAME} and {RPM}. |
pathStart | Before each toolpath (profile, pocket…). |
pathEnd | After each toolpath. |
footer | Once, at the end of each file. |
comment | How a comment looks: {} is the text. ({}) for most controllers, [{}] for WinCNC, ;{} for others. Empty = no comments. |
Moves
| Key | Used for |
|---|---|
rapid | Fast moves in the air. |
linear | Straight cutting moves. |
arcCW, arcCCW | Clockwise and counter-clockwise arcs. |
arcs | false = no G2 / G3: arcs are written as short straight moves. |
maxArcSweepDeg | Longer arcs are split into pieces of at most this many degrees. |
plunge | Straight-down cutting moves. Empty = linear. |
retract | Straight-up rapid moves. Empty = rapid. |
firstLinear | The first cutting move after a rapid. Empty = linear. |
feedChange | A line of its own whenever the feed changes, for controllers like WinCNC (F{f}). When it's set, {F} is left out of the moves. |
modalAxes | true = an axis that didn't change is left out of the line. |
substitute | Pairs of characters swapped in names, e.g. ({)} turns ( into { and ) into }, so a toolpath name can't end a comment early. |
Placeholders
In the move lines
| Placeholder | Gives |
|---|---|
{X} {Y} {Z} | Letter and number, e.g. X1.2500, written only when there is a value (and, with modalAxes, only when it changed). |
{I} {J} | Arc centre, relative to the start, e.g. I0.5000. |
{F} | Feed rate with its letter, written only when the feed changes. |
{x} {y} {z} {i} {j} {f} | The bare number, every time. For dialects like ShopBot: M3,{x},{y},{z}. |
Anywhere
| Placeholder | Gives |
|---|---|
{RPM} | Spindle speed of the bit. |
{TOOLNUM} | Bit number (its slot in the Tool Library, or 1, 2, 3… in cutting order). |
{TOOLNAME} | Bit name. |
{PATHNAME} | Toolpath name (in pathStart / pathEnd). |
{FEEDXY}, {FEEDZ} | The toolpath's cutting and plunge feeds. |
{SAFEZ} | The lift height for moves from Job Setup (Lift for moves), measured from Z zero. |
{XH} {YH} {ZH} | Home position: the post's own homeX / homeY if it sets them, else Job Setup's "Park the bit at X / Y", else 0, 0. {ZH} is the lift height unless the post sets homeZ. |
{XLENGTH} {YLENGTH} {ZLENGTH} | Board width, height and thickness from Job Setup. |
{XMIN} {XMAX} {YMIN} {YMAX} {ZMIN} {ZMAX} | The toolpath's extents. |
{UNITS} | inches or mm. |
{ZZERO} | Material Surface or Table: where Z zero is. |
{FILENAME}, {MATERIAL}, {DATE}, {TIME} | File name, board material, date and time of export. |
{N} | Line number, counting from lineNumberStart by lineNumberStep: put N{N} at the start of a line. |
Safety: what GCarve always adds
- Every file ends with the spindle off. If your footer has no M5 (or your controller's equivalent), GCarve adds one before the program end.
- The spindle stops before every tool change, even if your
toolChangeblock doesn't say so. - The export checks still run with your post: rapids inside the board, cuts off the board or into the spoilboard, missing feeds or speeds.
Example: GRBL with a tool changer
Start from the GRBL post, then set a toolChange block and take the spindle start out of the header, so every bit goes into one file:
"name": "My GRBL ATC",
"header": "({FILENAME})\nG90 G20 G17 G94\nG54\n",
"toolChange": "(Tool: {TOOLNAME})\nM5\nG53 G0 Z0\nT{TOOLNUM} M6\nM3 S{RPM}\nG4 P2\n",
Save, upload, export, then air-cut it before the first real cut.