Motion has been tested but not used just yet. Just fill in #1-#11 with the required numbers.
Barrel fluting with a ball nose end mill. Touch off on top middle of barrel for your zero.
Code:
g17g20g90
#1 = 0.02 (depth per pass)
#2 = 0.04 (final depth)
#3 = 120 (degrees of rotation)
#4 = 0.1 (X start)
#5 = 10.1 (X end)
#6 = 0 (surface)
#8 = 1 (Number of flutes)
#9 = 90 (Starting degree of rotation)
#10 = 10 (Feed rate)
#11 = 0 (Spindle RPM)
;Calculations
#101 = [360/#8] (Angle between fluting)
#202 = [#3 * 101 + 9]
g0 Y0 X0 Z.1
o100 do
#6 = [#6 - #1] (Depth of Z for cut)
g0 A[#9] (Position rotary before cut)
(DEBUG, A = #9)
o110 do
M3 S#11
M8
g1 F10 z[#6]
g1 F10 x[#5] y0 a[#3+#9] (Cutting)
g0 z.1 (Raise before home move)
g0 x[#4] y0 a[0+#9] (Move to home position)
#6 = [#6 - #1] (Increase variable depth of Z for cut)
(DEBUG, cutting dept for next pass is #6)
o110 while [#6 GE -#2] (End loop when depth of cut is reached)
#9 = [#9+#101] (Set up next rotation angle)
(DEBUG, A= #9 Rotation angle)
#6 = 0 (Reset cutting depth to surface)
o100 while [#9 LT 360]
M2
Barrel fluting with slotter from the side. Touch off from middle side of the slotter. This one moves from the negative value to positive.
Code:
g17g20g90
#1 = 0.02 (depth per pass)
#2 = 0.04 (final depth)
#3 = 120 (Total rotation of cut)
#4 = 0.1 (X start)
#5 = 10.1 (X end)
#6 = 0 (touch off surface in Y)
#8 = 1 (Number of flutes)
#9 = 60 (starting degree of rotation)
#10 = 10 (Feed rate)
#11 = 0 (Spindle RPM)
;Calculations
#101 = [360/#8] (Angle between fluting)
#202 = [#8 * #101 + #9] (Stopping angle for machining)
g0 Y-.5 X0 Z0
o100 do
#6 = [#6 + #1] (Depth of Y for cut)
g0 A[#9] (Position rotary before cut)
(DEBUG, A = #9)
o110 do
M3 S[#11]
M8
g1 F[#10] Y[#6]
g1 F[#10] x[#5] a[#3+#9] (Cutting)
g0 Y-.1 (Move away from part before home move)
g0 x[#4] a[0+#9] (Move to home position)
#6 = [#6 + #1] (Increase variable depth of Y for cut)
(DEBUG, cutting dept for next pass is #6)
o110 while [#2 GE #6] (End loop when depth of cut is reached)
#9 = [#9+#101] (Set up next rotation angle)
(DEBUG, A= #9 Rotation angle)
#6 = 0 (Reset cutting depth to surface)
o100 while [#9 LT #202]
M9
M2