G-code reference

G66 G-Code: Modal Macro Call

Modal Macro Call — Calls a macro after every following positioning move until G67 cancels it. This is useful for custom drilling or engraving at many points.

By cnccode · Updated
PropertyValue
CodeG66
FunctionModal Macro Call
Modal group12
TypeModal — stays active until replaced by another code of the same group
Used onMills and lathes
SyntaxG66 P_ args

What does G66 do?

Calls a macro after every following positioning move until G67 cancels it. This is useful for custom drilling or engraving at many points.

G66 is modal: once programmed it remains in effect for the following blocks until another code from modal group 12 replaces it or the control is reset.

Syntax and parameters

Format
G66 P_ args
AddressMeaning
PMacro number

G66 example program

Example
G66 P9100 Z-5.0 R2.0
X10.0 Y10.0
X20.0
G67

▶ Open this example in the G-code viewer

Tips and common mistakes

  • Every move triggers the macro — keep only position moves inside the G66 block.

Controller compatibility

G66 follows the ISO/Fanuc dialect used by Fanuc, Haas, Brother, Doosan, Hurco (ISO mode), Mazak (EIA/ISO mode), Okuma (G-code mode) and Siemens in ISO dialect mode. Parameters, option packages and builder-specific behaviour can differ, so confirm the details in your machine's programming manual before running a new program.

Frequently asked questions

Is G66 modal?
Yes. G66 belongs to modal group 12 and stays active until another code of that group is programmed.
What does G66 mean in CNC?
G66 means Modal Macro Call. Calls a macro after every following positioning move until G67 cancels it. This is useful for custom drilling or engraving at many points.
What is the difference between G66 and G67?
G66 is Modal Macro Call, while G67 is Modal Macro Call Cancel. See the G67 page for its syntax and examples.
Can I use G66 on a lathe?
Yes, G66 is used on both mills and lathes, although some parameters differ between them.