; drill - peck-drilling subroutine ; Requires globals: #<_z_top>, #<_z_bot> ; Optional global: #<_z_clearance> o sub ; x, y, peck ; #1 #2 #3 G90 ; absolute x,y,z M101 ; enable Z-axis (M102 disables) o2 if [EXISTS[#<_z_clearance>]] # = #<_z_clearance> o2 else # = #<_z_top> o2 endif G0 Z# G0 X#1 Y#2 G0 Z#<_z_top> o104 if [#3 NE 0] ; peck drilling # = [#<_z_top> - #3] ; first peck target (one peck below top) o101 while [# GT #<_z_bot>] G1 Z# G0 Z#<_z_top> ; full retract G0 Z[#+.02] ; rapid back to just above previous depth # = [#-#3] o101 endwhile o104 endif G1 Z#<_z_bot> G0 Z# o endsub M2