4th Axis Wrapped contour

More
9 years 10 months ago #84443 by Duc
4th Axis Wrapped contour was created by Duc
Looking for insight on writing some G-code to flute a barrel. I could drop this into a CAM program but would rather learn a new skill.

Here is a example video of what Im looking to do. Would also like to build a cam cylinder later on.


I'm not seeing a Gcode to wrap a xy move to the A -axis, I know Haas and others may have a code or macro for this function.

Parameters
First cut starts at A0.0
2 full rotations in 20 inches
Start at X-.1 Y0
End at X20.1 Y0
DOC .020 each pass Final depth .10

Please Log in or Create an account to join the conversation.

More
9 years 10 months ago - 9 years 10 months ago #84445 by Todd Zuercher
Replied by Todd Zuercher on topic 4th Axis Wrapped contour
Seems like a simple enough job to program.
for one flute cutting .02 deep in both directions, something like this:
(untested code)
Code:
g17g20g90 #1 = 0.02 (depth per pass) #2 = 0.1 (final depth) #3 = 720 (degrees of rotation) #4 = 0.1 (X start) #5 = 20.1 (X end) #6 = 0 (surface) #7 = [#6 - #2] g0 x[#4] y0 z[#6+0.1] a0 #6 = [#6 - #1] o100 do g1 z[#6] g1 x[#5] a[#3] #6 = [#6 - #1] o110 if [#6 LT #7] o100 break o110 endif g1 z[#6] g1 x[#4] y0 z0.1 a0 #6 = [#6 - #1] o100 while [#6 GE #7]
The code will need modified a little if your machine is configured for a wrapped rotary.
If you want it to do multiple flutes like in the video, you'll need to wrap this in another while loop and add a couple more parameters to index the angle for each flute.
Last edit: 9 years 10 months ago by Todd Zuercher.

Please Log in or Create an account to join the conversation.

More
9 years 10 months ago #84480 by Duc
Replied by Duc on topic 4th Axis Wrapped contour
Modified the code in a way I believe will allow flutes to place all the way around a barrel based on defined variables. Will try it out tomorrow.

Is there anyway to watch the variables that are used in the o-codes during machining?
Code:
g17g20g90 #1 = 0.02 (depth per pass) #2 = 0.1 (final depth) #3 = 720 (degrees of rotation) #4 = 0.1 (X start) #5 = 20.1 (X end) #6 = 0 (surface) #8 = 4 (Number of flutes) #9 = 0 (degree of rotation) #10 = 10 (Feed rate) ;Calculations #71 = [#6 - #2] (current depth) #101 = [360/#8] (Angle between fluting) g0 Y0 X0 Z.1 o100 g0 A[#9] (Position rotary before cut) o110 do M3 S150 #6 = [#6 - #1] (Depth of Z for cut) g1 F10 x[#4] y0 z[#6] 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) o110 while [#6 GT #71] (End loop when depth of cut is reached) #9 = [#9+#101] (Set up next rotation angle) o100 while [#9 GE 360] M2

Please Log in or Create an account to join the conversation.

More
9 years 10 months ago #84481 by Todd Zuercher
Replied by Todd Zuercher on topic 4th Axis Wrapped contour
Yes, you can use the (DEBUG,...) command in your code to print the value of the parameters during the run.
Like this
Code:
g17g20g90 #1 = 0.02 (depth per pass) #2 = 0.1 (final depth) #3 = 720 (degrees of rotation) #4 = 0.1 (X start) #5 = 20.1 (X end) #6 = 0 (surface) #8 = 4 (Number of flutes) #9 = 0 (degree of rotation) #10 = 10 (Feed rate) ;Calculations #71 = [#6 - #2] (current depth) #101 = [360/#8] (Angle between fluting) g0 Y0 X0 Z.1 o100 g0 A[#9] (Position rotary before cut) (DEBUG, A = #9) o110 do M3 S150 #6 = [#6 - #1] (Depth of Z for cut) (DEBUG, cutting dept for next pass is #6) g1 F10 x[#4] y0 z[#6] 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) o110 while [#6 GT #71] (End loop when depth of cut is reached) #9 = [#9+#101] (Set up next rotation angle) o100 while [#9 GE 360] M2
Just insert the debug line where ever you want to, and it can print what ever message and parameter values you like.
Here is a link to a tutorial.
gnipsel.com/linuxcnc/g-code/gen02.html

Please Log in or Create an account to join the conversation.

More
9 years 10 months ago - 9 years 10 months ago #84652 by Duc
Replied by Duc on topic 4th Axis Wrapped contour
Ok final version of the code for anyone that needs it. Had to work a few bugs out of it.

Coolant will need to be added and feeds adjusted for your machine.

Thank you for the help

[Fixing code, will have it up tomorrow]
Last edit: 9 years 10 months ago by Duc.

Please Log in or Create an account to join the conversation.

More
9 years 10 months ago - 9 years 10 months ago #84686 by Duc
Replied by Duc on topic 4th Axis Wrapped contour
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
Last edit: 9 years 10 months ago by Duc.

Please Log in or Create an account to join the conversation.

Time to create page: 0.644 seconds
Powered by Kunena Forum