G-code
Macro programming
Order of execution
1min
the order of execution of items on a line is critical to safe and effective machine operation items are executed in the order shown in the table below if they occur on the same line comment (includes message) set feed rate mode ( g93, g94 inverse time or per minute ) set feed rate ( f ) set spindle speed ( s ) select tool ( t ) change tool ( m6 ) spindle on or off ( m3, m4, m5 ) coolant on or off ( m7, m8, m9 ) enable or disable overrides ( m48, m49 ) dwell ( g4 ) set active plane ( g17, g18, g19 ) set length units ( g20, g21 ) cutter radius compensation on or off ( g40, g41, g42 ) cutter length compensation on or off ( g43, g49 ) coordinate system selection ( g54, g55, g56, g57, g58, g59, g59 1, g59 2, g59 3 ) set path control mode ( g61, g61 1, g64 ) set distance mode ( g90, g91 ) set retract mode ( g98, g99 ) home ( g28, g30 ) or change coordinate system data ( g10 ) or set axis offsets ( g92, g92 1, g92 2, g94 ) perform motion ( g0 to g3, g80 to g89 ), as modified (possibly) by g53 stop ( m0,m1, m2,m30,m60 )