; Peck drill subroutine - drills with retract cycles to clear chips ; Params: #1=x, #2=y, #3=zstart, #4=zend, #5=peck_depth o sub ; x1, y1, zstart, zend, peckdp ; #1 #2 #3 #4 #5 G90 ; absolute x,y,z M101 ; enable Z-axis (M102 disables) o1 if [EXISTS[#<_z_clearance>]] # = #<_z_clearance> o1 else # = #3 o1 endif ;;;;;;;;;; PROGRAM ;;;;;;;;; G0 Z# G0 X#1 Y#2 G0 Z#3 o104 if [#5 NE 0] ; peck drilling # = #3 o101 while [# GT #4] G1 Z# ; drill to current peck depth G0 Z#3 ; retract to clear chips G0 Z[#+.02] ; rapid back down, stopping just above previous depth # = [#-#5] o101 endwhile o104 endif G1 Z#4 G0 Z# o endsub M2