Hello Guest it is June 15, 2025, 07:21:49 PM

Author Topic: Writing Lathe Custom Canned Cycles?  (Read 2772 times)

0 Members and 1 Guest are viewing this topic.

Writing Lathe Custom Canned Cycles?
« on: March 21, 2022, 09:43:04 AM »
I find myself wishing there was a simple way to put a 0.100" (along the flat) 45 degree chamfer on parts, as an edge break. I wish I could just give the machine the X, Z coordinate of the corner to break and it would do it.

After some musing, I came up with this:

G69 X Z P Q U W F

Where:

X: X coord of the corner
Z: Z coord of the corner
P: 0 cut to right, 1 cut to left
Q: 0 cut outside-in, 1 cut inside-out
U: number of passes/subdivisions
W: lead in/out (default 0.010)
F: feed rate

So this:

G69 X1.0 Z0 P0 Q0 U2 W0.010 F0.005

Does this:

G0 X1.010 Z-0.0305
G1 X1.000 F0.005
X0.9695 Z0.000
Z0.010
G0 X1.010
G0 Z-0.071
G1 X1.00
X0.929 Z0.000
Z0.010

Is there a way to do this?
Re: Writing Lathe Custom Canned Cycles?
« Reply #1 on: March 21, 2022, 04:09:01 PM »
My approach would be like the code below.  It uses a sub program that utilizes relative moves rather than absolute.  I didn't fully check this code but you should be able to modify for your use.  If you were to write a macro where you passed the variables you could create the gcode on the fly and forego using relative positioning.

HTH

Code: [Select]
(Lathe Chamfer Corner)
#1=1.0      ( X coord of the corner)
#2=-0.305   ( Z coord of the corner)
#3=1         ( -1 cut to right, 1 cut to left)
#4=1         ( -1 cut outside-in, 1 cut inside-out)
#5=4         ( number of passes/subdivisions)
#6=0.010  ( lead in/out)
#7=1.5  ( feed rate)
#8=600     ( Spindle Speed)
#9=0.008    (depth of Cut)
#10=0.080      (length of cut)

t0202             (Select tool)
g0 z[#2+[#6*#3]]    (Move to z + offset)
g0 x[#1+[#6*#4]]    (Move to x + offset)

m7
m8
m3 s#8                 
m98 p1234 L#5     (do sub 1234 - 5 times)
m5

m30


o1234
g1  f#7 u[#9*#4] w[#9*#3]      (Feed from offset to beginning of cut)
g1 u[#10*#4]                   (Do length of cut)
g0 u[-1*#9*#4] w[-1*#2*#3]     (back out offset)
g1 u[-1*#10*#4]                (Back up length of cut)
g0 u[#9*#4]                    (Advance for next cut)
m99