Machsupport Forum
GCode, CAD, and CAM => GCode, CAD, and CAM discussions => Topic started by: TT350 on August 06, 2010, 11:39:51 AM

Hi guys it's been some time since I've post here.
The code for cutting a part that I've done many times
for my customer. It has 2 tools and I've been cutting them 1 at a time
for a few years now.
My customer placed a order for 200 parts and now I'm building
a fixture to do 8 at a time.
The code that I'm post is for tool 1 and here's and example
of how I have done other code in the past.
A lot of copy and pasting.
Is there a simpler way?
The parts are 2" apart in the X.
M6 T1 CODE FOR 1 PART
G43 H1
M03 S2500
M8
G00 Z 1.00
Y .6875
X 0.003
Z.130
G01 Y.6875 F5.0
Z.130
X0.003
Y.6875
G00 Z.100
Y3.0
Z  1.0
M9
M5
M30
Code below is for 8 parts
M6 T1 PART #1
G43 H1
M03 S2500
M8
G00 Z 1.00
Y .6875
X 0.003
Z.130
G01 Y.6875 F5.0
Z.130
X0.003
Y.6875
G00 Z.100
X 2.0
G92 X0.0
G00 Z 1.00 PART#2
Y .6875
X 0.003
Z.130
G01 Y.6875 F5.0
Z.130
X0.003
Y.6875
G00 Z.100
X 4.0
G92 X0.0
G00 Z 1.00 PART#3
Y .6875
X 0.003
Z.130
G01 Y.6875 F5.0
Z.130
X0.003
Y.6875
G00 Z.100
X 6.0
G92 X0.0
G00 Z 1.00 PART#4
Y .6875
X 0.003
Z.130
G01 Y.6875 F5.0
Z.130
X0.003
Y.6875
G00 Z.100
X 8.0
G92 X0.0
G00 Z 1.00 PART#5
Y .6875
X 0.003
Z.130
G01 Y.6875 F5.0
Z.130
X0.003
Y.6875
G00 Z.100
X 10.0
G92 X0.0
G00 Z 1.00 PART#6
Y .6875
X 0.003
Z.130
G01 Y.6875 F5.0
Z.130
X0.003
Y.6875
G00 Z.100
X 12.0
G92 X0.0
G00 Z 1.00 PART# 7
Y .6875
X 0.003
Z.130
G01 Y.6875 F5.0
Z.130
X0.003
Y.6875
G00 Z.100
X 14.0
G92 X0.0
G00 Z 1.00 PART# 8
Y .6875
X 0.003
Z.130
G01 Y.6875 F5.0
Z.130
X0.003
Y.6875
G00 Z.100
X 0.0
G92 X0.0
MOVES PART OUT OF THE WAY
AND BRING TOOL DOWN SO WIFE
CAN REACH IT TO CHANGE IT!
Y3.0
Z  1.0
M9
M5
M30

I would do it this way.
%
M6 T1
G43 H1
M03 S2500
M8
G52 X0
M98 P2
G52 X2.
M98 P2
G52 X4.
M98 P2
G52 X6.
M98 P2
G52 X8.
M98 P2
G52 X10.
M98 P2
G52 X12.
M98 P2
G52 X14.
M98 P2
M9
M5
M30
O0002
G00 Z 1.00
Y .6875
X 0.003
Z.130
G01 Y.6875 F5.0
Z.130
X0.003
Y.6875
G00 Z.100
Y3.0
Z  1.0
G00 Z.1
G52 X0
M99
%
Graham

Thanks Graham
What is the % for?

The % denotes the start and end of a program file when using subs its better to have them in so you know you have a return on the end of the sub program.
Graham

Thanks for your time!!

Graham could have a little more of your time?
I’ll be cutting my parts next week and I have a few more
questions.
I done a test run and the code repeats perfectly
but I need to split it up.
The code is setup to cut one part and move the part out of the way
and bring the tool down so my wife can reach the draw bar to change
the tool.
It’s moving the part out of the way and bring the tool down 8 times,
can we make it only do that after the last part is cut?
Take a look at the code, I’ll point out the part that needs to be run
after the last parts is cut.
Also there will be 2 tools for this job, how would the code look for
tool # 2?
If you would like you can use the code for tool #1
and repost it for tool#2 as an example.
I would like you to explain the code so I can do this for myself
next time.
I have a Tormach mill and I didn’t see a G52 or a P2 in the G/M code table.
What does the G52 /P2 mean or stand for?
%
M6 T1
G43 H1
M03 S2500
M8
G52 X0
M98 P2
G52 X2.
M98 P2
G52 X4.
M98 P2
G52 X6.
M98 P2
G52 X8.
M98 P2
G52 X10.
M98 P2
G52 X12.
M98 P2
G52 X14.
M98 P2
M9
M5
M30
O0002 What is this O0002 for?
G00 Z 1.00
Y .6875
X 0.003
Z.130
G01 Y.6875 F5.0
Z.130
X0.003
Y.6875
G00 Z.100 this code moves the part and
Y3.0 and brings the tool down
Z  1.0 for the wife
G00 Z.1
G52 X0
M99
%

Try it like this :
%
(tool 1)
M6 T1
G43 H1
M03 S2500
M8
G52 X0 (cancel any current datum shifts)
M98 P2
G52 X2. (do a local datum shift of 2 in the x axis)
M98 P2 (call sub program O0002)
G52 X4.
M98 P2
G52 X6.
M98 P2
G52 X8.
M98 P2
G52 X10.
M98 P2
G52 X12.
M98 P2
G52 X14.
M98 P2
G00 Z.100 (this code moves the part and)
Y3.0 (and brings the tool down)
Z  1.0 (for the wife)
M9
M5
(tool 2)
M6 T2
G43 H2
M03 S2500
M8
G52 X0
M98 P3 (call sub program O0003)
G52 X2.
M98 P3
G52 X4.
M98 P3
G52 X6.
M98 P3
G52 X8.
M98 P3
G52 X10.
M98 P3
G52 X12.
M98 P3
G52 X14.
M98 P3
G00 Z.100 (this code moves the part and)
Y3.0 (and brings the tool down)
Z  1.0 (for the wife)
M9
M5
M30
O0002 (this is a sub program called by M98 P2)
G00 Z 1.00
Y .6875
X 0.003
Z.130
G01 Y.6875 F5.0
Z.130
X0.003
Y.6875
G00 Z.1
G52 X0
M99
O0003(SUB PROGRAM CALLED BY M98 P3)
(PLACE YOUR CODE HERE)
G00 Z1.
G52 X0
M99
%
Graham

Thank you for breaking it down for me.