What's new
What's new

Increasing depth of cut while in REPEAT - I lack knowledge

Jr machinist

Plastic
Joined
Apr 25, 2022
I need help with a bit of programming. Using a brand new milling machine running Siemens Sinumerik 828D.

Short summary: I have 12 Cylindrical pieces of material lined up next to eachother in a mould (hence the ATRANS of X66), in each of these 12 products I need to run the program shape below. This needs to happen 8 times at an increasing Z (each step is 4.625 depth of cut deeper). So 8 layers per product.

There are a few 'demands' to the piece of program:
1) I want the program to be in the main program, so not programmed with a subprogram.
2) The 8 cuts (with the increasing Z) cannot be done once in the same product. So one layer at a time for the 12 products before proceeding to a deeper cut (for heat disposal)

I am aware that some of the code needs change in order to prevent collision, this can be done. For now i've only succeeded in programming this when I have 8 different 'clubshapes' with different Z values. But this takes up alot of space, hence I would like to have it all in one piece of program. Any solution works for me as long as the demands are met. So for example an increasing work offset is fine, as long as the code runs.

Thanks in advance, program posted below.

%
Program header: G17 G40 G54 G90

N10001 CLUBSHAPE:
N10002
N10003 ATRANS X66
N10004 G00 X1.436 Y-5.309 Z40
N10005 G00 Z-13
N10006 G01 Z-17.625
N10007
N10008 G03 X-3.88 Y3.898 I=AC(-11.258) J=AC(-6.5)
N10009 G02 X-1.436 Y5.309 I=AC(0) J=AC(0)
N10010 G03 X3.88 Y-3.898 I=AC(11.258) J=AC(6.5)
N10011 G02 X1.436 Y-5.309 I=AC(0) J=AC(0)
N10012 G01 X-4.171 Y-9.636
N10013 G03 X-3.508 Y-6.5 I=AC(-11.258) J=AC(-6.5)
N10014 G03 X-10.431 Y1.206 I=AC(-11.258) J=AC(-6.5)
N10015 G02 X4.171 Y9.636 I=AC(0) J=AC(0)
N10016 G03 X3.508 Y6.5 I=AC(11.258) J=AC(6.5)
N10017 G03 X10.431 Y-1.206 I=AC(11.258) J=AC(6.5)
N10018 G02 X0 Y-10.5 I=AC(0) J=AC(0)
N10019 G02 X-4.171 Y-9.636 I=AC(0) J=AC(0)
N10020 G00 Z20
N10021
N10022 END_CLUBSHAPE:
N10023
N10024 REPEAT CLUBSHAPE END_CLUBSHAPE P=11
N10024 TRANS X0 Y0
%
 
There are many ways to skin the chicken here, and i guess my example wont be the simpliest nor prettiest one, nor the right one if i even understood you correctly.

Variable for depth, and safecheck for it that wont go to deep, and another variable for the repeat amount so it does enough repeats before going to next depth?

If your not sure using R-variables, just use def your own ones at beginning of main program. (def real depth, repeatcount .. for example)

R1=0 ; Variable for repeat amounts
R2=-4.625 ; Variable for depth, first depth here

Clubshape:

STOPRE
R1=R1+1 ; +1 add for repeats
IF (R1 > 12)
R2=R2-4.625 ; Add next depth if repeats add up to 13
R1=0 ; Reset repeats
ATRANS X-792 ; Very very crude way to reset added up atrans from inside repeat
ENDIF

STOPRE
IF (R2 < -37) GOTOF Finished ; Check for depth
ENDIF

G00 X1.436 Y-5.309 Z40
G00 Z=R2
G03 X-3.88 Y3.898 I=AC(-11.258) J=AC(-6.5)
G02 X-1.436 Y5.309 I=AC(0) J=AC(0)
G03 X3.88 Y-3.898 I=AC(11.258) J=AC(6.5)
G02 X1.436 Y-5.309 I=AC(0) J=AC(0)
G01 X-4.171 Y-9.636
G03 X-3.508 Y-6.5 I=AC(-11.258) J=AC(-6.5)
G03 X-10.431 Y1.206 I=AC(-11.258) J=AC(-6.5)
G02 X4.171 Y9.636 I=AC(0) J=AC(0)
G03 X3.508 Y6.5 I=AC(11.258) J=AC(6.5)
G03 X10.431 Y-1.206 I=AC(11.258) J=AC(6.5)
G02 X0 Y-10.5 I=AC(0) J=AC(0)
G02 X-4.171 Y-9.636 I=AC(0) J=AC(0)
G00 Z20

ATRANS X66

End_clubshape:

Repeat Clubshape End_clubshape p=11
Finished:

And almost forget, take the code with grain of salt and tread carefully, typing while (quote Kimi Raikkonen here) might add up same quality code, vacation officially started couple hours ago so i'll grant myself leeway, can't doublecheck @ machine.
 
Last edited:
There are many ways to skin the chicken here, and i guess my example wont be the simpliest nor prettiest one, nor the right one if i even understood you correctly.

Variable for depth, and safecheck for it that wont go to deep, and another variable for the repeat amount so it does enough repeats before going to next depth?

If your not sure using R-variables, just use def your own ones at beginning of main program. (def real depth, repeatcount .. for example)

R1=0 ; Variable for repeat amounts
R2=-4.625 ; Variable for depth, first depth here

Clubshape:

STOPRE
R1=R1+1 ; +1 add for repeats
IF (R1 > 12)
R2=R2-4.625 ; Add next depth if repeats add up to 13
R1=0 ; Reset repeats
ATRANS X-792 ; Very very crude way to reset added up atrans from inside repeat
ENDIF

STOPRE
IF (R2 < -37) GOTOF Finished ; Check for depth
ENDIF

G00 X1.436 Y-5.309 Z40
G00 Z=R2
G03 X-3.88 Y3.898 I=AC(-11.258) J=AC(-6.5)
G02 X-1.436 Y5.309 I=AC(0) J=AC(0)
G03 X3.88 Y-3.898 I=AC(11.258) J=AC(6.5)
G02 X1.436 Y-5.309 I=AC(0) J=AC(0)
G01 X-4.171 Y-9.636
G03 X-3.508 Y-6.5 I=AC(-11.258) J=AC(-6.5)
G03 X-10.431 Y1.206 I=AC(-11.258) J=AC(-6.5)
G02 X4.171 Y9.636 I=AC(0) J=AC(0)
G03 X3.508 Y6.5 I=AC(11.258) J=AC(6.5)
G03 X10.431 Y-1.206 I=AC(11.258) J=AC(6.5)
G02 X0 Y-10.5 I=AC(0) J=AC(0)
G02 X-4.171 Y-9.636 I=AC(0) J=AC(0)
G00 Z20

ATRANS X66

End_clubshape:

Repeat Clubshape End_clubshape p=11
Finished:

And almost forget, take the code with grain of salt and tread carefully, typing while (quote Kimi Raikkonen here) might add up same quality code, vacation officially started couple hours ago so i'll grant myself leeway, can't doublecheck @ machine.

Thanks JJM,
Couldn't reply in the weekend. So I am a little late. Tried your code on the machine as is. Think it needs minor adjustments but I'm going to play with it.

You understood me correctly, except for the safecheck, not neccessary:

Variable for depth, and safecheck for it that wont go to deep, and another variable for the repeat amount so it does enough repeats before going to next depth?

Enjoy your vacation!
 








 
Back
Top