First, Mach does NOT do conditional gcode so the IF is not an option(;-(
I whipped up a quicky Subroutine for you. It is programable. First copy the SUB to the Mach subroutine directory
The variables are:
#100= Total depth
#101= Peck depth
#105= Pullback value
#106= Feedrate
To Use First position your tool where it needs to be to start and then Call it with M98 (Xpeck.txt) L1 #100=1.000 #101=.040 #105=0.050 #6=10
The Sub will then load and apply the variables and begin the cycle .It will dril the peck depth and then retract the pullback value then return then drill the peck depth ,etc,etc At the end it will retract to the start point.
I am sure you will be able to modify it as you need(;-)
(;-) TP