CNC Post Processors

How a CNC Post Processor Converts CAM Toolpaths into NC Code

Between clicking "Post" and getting a G-code file, a lot happens. Here is what a post processor actually does with your CAM toolpaths, step by step.

1. The input: CL data and events

CAM systems produce cutter location (CL) data: tool tip positions, tool axis vectors, feedrates and a stream of events such as "tool change", "start of operation", "coolant on" or "drilling cycle". This data is machine-independent; it describes what to cut, not how a particular machine should move.

TOOL   T1  D10  FLAT
SPINDL 9000 CLW
RAPID  X-12.0 Y5.0 Z50.0   I0 J0 K1
FEDRAT 1200
GOTO   X-12.0 Y5.0 Z-2.0
CIRCLE CENTER X0 Y5 RADIUS 12 CCW ...
CYCLE  DRILL DEPTH 20 RETRACT 3 ...

2. Event handling

The post is event-driven. Each CAM event calls a handler in the post: start of program, start of section/operation, tool change, rapid move, linear move, circular move, cycle point, end of section, end of program. The handler decides what code to output.

3. Inverse kinematics (multi-axis)

For 4- and 5-axis work, CL data contains tool axis vectors. The post (or the CAM machine configuration) converts each vector into rotary axis angles for the specific machine, chooses between multiple possible solutions, and, unless TCP is used, calculates the linear axis positions that account for pivot offsets.

4. Formatting

RuleExample
Decimal places and trailing zerosX12.5 vs X12.500 vs X12.5000
Decimal point requiredX10. (on FANUC, X10 without a decimal point is read as 0.010 mm unless calculator-type input is enabled)
Units and scalingmm / inch, degrees, feed per minute or per revolution
Line numbersN10, increment, maximum
Comments( ) for FANUC, ; for Siemens

Most G-codes and axis words are modal: they stay active until changed. The post only outputs what has changed, keeping programs short and readable, while forcing output where the machine requires it (for example after a tool change).

6. Cycles and machine features

Drilling events become canned cycles (G81, G83, G84 or controller equivalents) if supported, or are expanded into linear moves if not. The post also inserts machine features: high-speed machining modes, TCP, tilted planes, probing macros and clamping codes.

7. The output

N10 T1 M06
N20 G00 G90 G54 X-12. Y5. S9000 M03
N30 G43 H01 Z50. M08
N40 G01 Z-2. F1200.
N50 G03 X0. Y17. I12. J0.
N60 G81 X20. Y20. Z-20. R3. F300.
N70 G80
The toolpath defines the part. The post processor defines how safely and efficiently the machine makes it.

Need a post that gets this right?

See our CNC post processor development service and why machines need specific posts.

EM
ENGIMANDI CNC Team

We develop, customise and commission CNC post processors for Fusion, NX CAM, Mastercam, SolidCAM and other CAM systems.