Post Processor Engineering

Subprogram and Macro Generation Using Custom Post Processors

Repeated features, multi-part fixtures and probing routines don't need to be written out in full. A custom post can generate subprograms and macro calls automatically.

Why use subprograms

  • Much shorter programs for repeated features or parts.
  • Edits at the machine happen in one place.
  • Less controller memory and faster transfer on older machines.

Syntax by controller

ControllerCallReturn
FANUC / HaasM98 P1001 (or M98 P1001 L4 for repeats)M99
FANUC macroG65 P9810 X.. Y.. Z..M99
SINUMERIKSubprogram name (e.g. POCKET1) from .SPFM17 / RET
HeidenhainCALL LBL 1LBL 0
Okuma OSPCALL O1001RTS

Example: same pocket on four fixtures

O1000 (MAIN)
T3 M06
G54 G00 X0. Y0. S9000 M03
G43 H03 Z25. M08
M98 P1001
G55 M98 P1001
G56 M98 P1001
G57 M98 P1001
M30

O1001 (POCKET - WORKS IN ANY OFFSET)
G00 X10. Y10.
G01 Z-3. F300.
(... pocket moves ...)
G00 Z25.
M99

Macro calls

Posts can call probing macros (for example Renishaw routines on many machines), tool breakage checks and custom shop macros with parameters taken from CAM, instead of expanding everything into plain G-code.

Things to watch

  • Subprogram numbers must not clash with existing programs on the machine.
  • Subprograms should be incremental- or offset-independent as intended.
  • Some controllers need subprograms in separate files; others allow them in the same file.
Subprograms make NC code shorter; good posts make them automatic.

Subprogram and macro output

See our CNC post processor development service and canned cycle handling.

EM
ENGIMANDI CNC Team

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