Start and end blocks of a CNC program for GRBL, Fanuc, Haas and LinuxCNC
Pick a controller and set the spindle, coolant and work offset, and the tool writes the start and end block of the CNC program. The result is read back and checked against what you asked for.
Part of Pro, 15 EUR a month.
- 5 controllersfive dialects, one click away
- 9 settingsfrom units to coolant
- 5 checksthe block is read back
- Start and endwith what the controller lacks listed
What a post processor is and what this one writes
The CNC post processor from EduFacturing is an online tool, part of Pro, that builds the start and end block of a CNC program for the chosen controller. There are five: Fanuc and compatible, Haas, LinuxCNC, GRBL and Marlin in CNC mode.
A CAM program calculates the toolpath but does not know which machine it will run on. The post processor adds what depends on the controller: units, work offset, tool change, spindle, coolant, retract and the end of the program. Commands the dialect (the quirks of G-code for that controller) does not have are listed, not dropped silently.
Between the two blocks sits a short sample body that exists only so there is something to check. The calculations run in the browser.
G-code start and end blocks: what you get
Writes the start and end block for five controllers
The dialect decides whether there is a % sign, an O number, G43, work offsets G54 to G59, automatic tool change and a retract, and how a comment is written.
Takes nine settings
Program name and number, units (G21 or G20), work offset, tool number, speed, safe Z, coolant (none, M7 or M8) and the dwell after M3.
Reads the block back and checks it
Five checks: the units, the positioning and the work offset in the final state are the requested ones, the spindle runs before the first cut, and the program ends with M30. On Marlin the offset row is marked as not applicable.
Says what the controller lacks
A separate panel lists what was left out and why, for example G43 on GRBL.
When you need a start and end block for your controller
A start block copied from another machine often carries commands this machine does not understand.
A start block for your own machine
A programmer builds a block for their controller instead of copying someone else's: units and work offset are declared before the first move, and the spindle runs before the first cut.
Comparing controllers
Switching the controller swaps the whole block, and the differences show when you compare: retract, tool change, comments.
A CNC programming lesson
A student sees why units, positioning and the work offset are written before motion.
Start and end for a CAM program
Copy the block and replace the sample body with the body of your program.
How the start and end of a program are put in order
The block is written in a fixed order, then read back and checked against what was asked for.
Start order
Units and G90 come before any motion, then the work offset, tool change, spindle, dwell, coolant and the safe Z.
Controller
Depending on the controller, lines are added, replaced or left out, and what is left out is recorded.
End
Safe Z, coolant and spindle off, a retract by dialect, and M30.
Read back
The whole text goes through the G-code module shared with the G-code checker, and five things are checked.
| Applies to | Formula | Meaning |
|---|---|---|
| Fanuc and compatible | G91 G28 Z0 | retract through machine zero; has %, an O number, G43, G54 to G59 and automatic tool change |
| Haas | G53 G0 Z0 | retract straight in machine coordinates; otherwise like Fanuc |
| LinuxCNC | G53 G0 Z0 | has %, G43, G54 to G59 and automatic tool change, but needs no O number |
| GRBL | no retract | no % or O number, no G43, no automatic tool change |
| Marlin (CNC mode) | no G54 to G59 | zero is set with G92; no G43, retract or tool change; comments use a semicolon |
A block read back, and gaps you can see
The block is checked by other code
The block is read back through the G-code module shared with the G-code checker, not by the generator's own expectations.
Gaps are visible
Commands the controller lacks are in a panel and are not lost silently: on GRBL you see that there is no automatic tool change and no G43.
The order is enforced
The generator always writes units and positioning before motion, so they do not depend on what a previous program left behind.
Five controllers, one click away
Switching the controller changes only the lines that depend on it, and your settings stay.
It does not translate a real program: it writes a start and an end block plus a sample body. The copy button takes the whole text, including the sample body, which you replace. It does not check whether the speed suits the material.
The dialect is chosen by the controller, not by the machine brand, and if in doubt the controller manual rules. The time the spindle needs to reach speed is an input: at 0 the check is on the list of unchecked ones. It does not check whether the zero was measured correctly or the workpiece is clamped.
Questions about the post processor
What is a post processor for CNC?
The part of CAM that adds what depends on the controller: units, work offset, tool change, spindle, coolant, retract and the end of the program. This tool writes the start and end block, it does not translate a whole program.
How to make a CNC post processor?
This tool does not make a post processor for a CAM program: it writes the start and end block. You pick the controller and the settings, and the block is read back. GRBL has no % sign, no O number, no G43 and no automatic tool change.
Why does Haas retract differently from Fanuc if it is compatible?
Compatibility does not cover the retract. Fanuc goes through machine zero with G91 G28 Z0, and Haas goes straight to machine coordinates with G53 G0 Z0.
What happens on GRBL with a tool change?
GRBL has no tool magazine and no automatic change. The block adds a comment for a manual change and an M6; according to a note in the code, M6 on GRBL only stops and waits for a hand (not checked against the GRBL manual). G43 is missing too.
Why are units and positioning written before motion?
A controller that does not see G21 or G90 carries on with whatever the previous program left. The difference between inches and millimetres is a factor of 25.4.
How much does it cost, and how do I get access?
The tool is part of Pro at 15 EUR a month. Pro also opens the other Pro tools in the catalog.
The post processor blocks is part of Pro
Pro costs 15 EUR a month and opens all 45 Pro tools.
Related tools
CAM program for CNC millingCAM program for CNC mills online: a rectangle or circle contour and a pocket become a toolpath and G-code for 5 controllers. Part of Pro, 15 EUR a month.
G-code checkerG-code checker for milling: follows the machine state line by line, finds 13 kinds of findings and checks speed and feed. Free, 3 times a day with no account.
CNC G-code viewerCNC G-code viewer online: paste a milling program and see the cutter path from above, with lengths and a time estimate. Part of Pro, 15 EUR a month.
Build a block for your controller
Part of Pro, 15 EUR a month.