Back to GSM Code List

Fanuc macros: Fanuc variables and macro logic

Use of variables, conditionals and loops to automate CNC programs.

For reference only: syntax changes with the control, the post-processor and the machine parameters. Check the official manual and run a simulation before cutting. Legal notice.

Family
Macros
Machine
Milling, Turning, Mill-turn
Risk
High
Example
#100=10 / IF[#100GT5]GOTO20 / WHILE[...]DO1
E.g.:
#100=10 / IF[#100GT5]GOTO20 / WHILE[...]DO1

Machine: Milling, Turning, Mill-turnRisk: High

Fanuc

#100, #500, IF, WHILE, GOTO
  • Review limits, persistent variables and jumps to avoid loops or unexpected movements.

Haas

  • Syntax similar to Fanuc, with differences depending on macro option and version.

Other codes in Macros

See the full list of G and M codes

Frequently Asked Questions (FAQ)

What does Fanuc macros mean in a CNC program?

Use of variables, conditionals and loops to automate CNC programs. In the catalogue it appears as "Fanuc variables and macro logic", within the Macros family.

How is Fanuc macros written on each control?

Fanuc: #100, #500, IF, WHILE, GOTO. The exact syntax depends on the control version and the machine parameters: always confirm with the manufacturer's manual.

Can you give me an example of Fanuc macros?

#100=10 / IF[#100GT5]GOTO20 / WHILE[...]DO1 — Use of variables, conditionals and loops to automate CNC programs.

Which machines use Fanuc macros?

Fanuc macros is used in: Milling, Turning, Mill-turn.

What should you watch out for with Fanuc macros?

High risk: a mistake here can cause a crash, a broken tool or an out-of-tolerance part. Simulate the program and dry-run it before cutting.

Related tools