37 lines
747 B
Plaintext
37 lines
747 B
Plaintext
; drill - peck-drilling subroutine
|
|
; Requires globals: #<_z_top>, #<_z_bot>
|
|
; Optional global: #<_z_clearance>
|
|
o<drill> 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> = #<_z_clearance>
|
|
o2 else
|
|
#<z_clearance> = #<_z_top>
|
|
o2 endif
|
|
|
|
G0 Z#<z_clearance>
|
|
G0 X#1 Y#2
|
|
G0 Z#<_z_top>
|
|
|
|
o104 if [#3 NE 0] ; peck drilling
|
|
#<h> = [#<_z_top> - #3] ; first peck target (one peck below top)
|
|
o101 while [#<h> GT #<_z_bot>]
|
|
G1 Z#<h>
|
|
G0 Z#<_z_top> ; full retract
|
|
G0 Z[#<h>+.02] ; rapid back to just above previous depth
|
|
#<h> = [#<h>-#3]
|
|
o101 endwhile
|
|
o104 endif
|
|
|
|
G1 Z#<_z_bot>
|
|
G0 Z#<z_clearance>
|
|
|
|
o<drill> endsub
|
|
|
|
M2
|