Files
linuxcnc/nc_files/spquircle_boss.ngc
Thaddeus-Maximus f3953d66ae ?
2026-04-03 15:58:58 -05:00

89 lines
2.1 KiB
Plaintext
Executable File

o<spquircle_boss> sub
; o<spquircle_boss> call [x][y] [square_width] [boss_diamter] [ztop][zbot] [finishcut] [mode]
#<M_CONVENTIONAL> = [FIX[#8/1] MOD 2 EQ 1]
#<M_BOTHWAYS> = [FIX[#8/2] MOD 2 EQ 1]
#<M_PLUNGE> = [FIX[#8/4] MOD 2 EQ 1]
#<M_OUTSIDE> = [FIX[#8/8] MOD 2 EQ 1]
#<M_CLIMB> = [FIX[#8/1] MOD 2 EQ 0]
#<M_ONEWAY> = [FIX[#8/2] MOD 2 EQ 0]
#<M_HELIX> = [FIX[#8/4] MOD 2 EQ 0]
#<M_INSIDE> = [FIX[#8/8] MOD 2 EQ 0]
;G10 L0 ; re-read tool data
G90 ; absolute x,y,z
G90.1 ; absolute i,j,k
M101 ; enable Z-axis (M102 disables)
G17 ; select XY plane for arcs
#<td> = #<_td>
#<tr> = [#<td>/2]
o1 if [EXISTS[#<_z_clearance>]]
#<z_clearance> = #<_z_clearance>
o1 else
#<z_clearance> = #5
o1 endif
o3 if [EXISTS[#<_stepover>]]
#<stepover> = [#<_stepover>*0.8]
o3 else
#<stepover> = [#<td>*0.4*0.8]
o3 endif
G0 Z#<z_clearance>
#<dist> = [[#3-#4]/2-#7]
#<n_steps> = [FIX[#<dist>/#<stepover>]-1]
#<n_steps_total> = [#<n_steps>+1]
#<ys> = +1
o10 if [#<M_CONVENTIONAL>]
#<ys> = [-1]
o10 endif
G0 X[#1 + #4/2 + #<tr> + #7 + #<n_steps_total>*#<stepover>] Y[#2 + #4/2 + #<tr> + #7 + #<n_steps_total>*#<stepover>*#<ys>]
G0 Z#5
G1 Z#6
G1 Y#2
o30 while [#<n_steps> GE 0]
#<a> = 0
o20 while [#<a> LE 360]
#<pow> = [1-[#<n_steps>-#<a>/360+0.95]/#<n_steps_total>]
#<r> = [#4/2 + #<tr> + #7 + [1+#<n_steps>-#<a>/360]*#<stepover>]
o201 if [#<a> LT 90]
G1 X[#1+ABS[COS[#<a>]]**#<pow>*#<r>] Y[#2-ABS[SIN[#<a>]]**#<pow>*#<r>*#<ys>]
o201 elseif [#<a> LT 180]
G1 X[#1-ABS[COS[#<a>]]**#<pow>*#<r>] Y[#2-ABS[SIN[#<a>]]**#<pow>*#<r>*#<ys>]
o201 elseif [#<a> LT 270]
G1 X[#1-ABS[COS[#<a>]]**#<pow>*#<r>] Y[#2+ABS[SIN[#<a>]]**#<pow>*#<r>*#<ys>]
o201 else
G1 X[#1+ABS[COS[#<a>]]**#<pow>*#<r>] Y[#2+ABS[SIN[#<a>]]**#<pow>*#<r>*#<ys>]
o201 endif
#<a> = [#<a>+1]
o20 endwhile
#<n_steps> = [#<n_steps>-1]
o30 endwhile
G1 X[#1+#4/2+#<tr>] Y[#2]
o40 if [#<M_CONVENTIONAL>]
G3 X[#1+#4/2+#<tr>] Y[#2] I#1 J#2
o40 else
G2 X[#1+#4/2+#<tr>] Y[#2] I#1 J#2
o40 endif
G0 Z#<z_clearance>
o<spquircle_boss> endsub
M2