37 lines
843 B
Plaintext
37 lines
843 B
Plaintext
; bore - helical boring subroutine. Spirals down in full-circle passes,
|
|
; then a partial-arc cleanup and a spring pass at final depth.
|
|
; Requires globals: #<_z_top>, #<_z_bot>
|
|
; Requires tool loaded (uses #5410 for diameter)
|
|
o<bore> sub
|
|
; o<bore> call [x][y] [d] [stepdown]
|
|
; #1=x #2=y #3=d #4=stepdown
|
|
|
|
G90
|
|
G91.1
|
|
|
|
G0 X#1 Y#2
|
|
G0 Z#<_z_top>
|
|
G1 X[#1+#3/2-#5410/2] Y[#2]
|
|
G17
|
|
|
|
#<r> = [#3/2-#5410/2]
|
|
|
|
#<z> = [#<_z_top> - #4]
|
|
o101 while [#<z> GT #<_z_bot>]
|
|
G3 X[#1+#<r>] Y[#2] I[-#<r>] Z[#<z>] P1
|
|
#<z> = [#<z> - #4]
|
|
o101 endwhile
|
|
|
|
o102 if [#<_z_top> GT #<_z_bot>]
|
|
#<ang> = [[#<z>-#<_z_bot>]/#4*360]
|
|
G3 X[#1+COS[#<ang>]*#<r>] Y[#2+SIN[#<ang>]*#<r>] I[-#<r>] Z[#<_z_bot>]
|
|
G3 X[#1+COS[#<ang>]*#<r>] Y[#2+SIN[#<ang>]*#<r>] I[-COS[#<ang>]*#<r>] J[-SIN[#<ang>]*#<r>] Z[#<_z_bot>]
|
|
o102 endif
|
|
|
|
G0 X#1 Y#2
|
|
G0 Z0
|
|
|
|
o<bore> endsub
|
|
|
|
M2
|