Programming Gcode

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 6

-------------------------------------------------------------------------------Back to CNC Code Shooter Home Page

How to write a CNC Lathe Program


1. Most machines require
achine to start reading.
the machine file on send
sh drive you have to add

a % (percent ) sign on the first line. This tells the m


If you are uploading with a 232 connection you can set
and receive to add the % for you. If you upload via fla
it yourself.

2. Program number
the first character is the letter O followed by a 4 or 5 digit number ie( O0123
).
3. On the same line after the program number you can put the Program description
in parenthesis. When you look at the list of programs on most controls it will
display the whole line.
Example program list
O111 (A2299 OP1)
O112 (A2299 OP2)
O113 (TURN FLANGE OD)
O288 (2891 FLANGE REV 4 OP1)
4. After the program description the first machining description is usually next
.
ie (rough face)
(LEAVE .01 ON FACE) all comments are in parenthesis
5. Tool description
(R.H. CNMG 542)
Right Hand CNMG 542
5 is size of insert
2 is radius in 64ths
z-radius ie 1/32
6. Tool Change Position
G28 U0 W0 - Machine Home Position
U0 is x-home
W0 is z-home
Hass can use G28 = both axis home
7. Tool change T0101 = first 2 digits 01 = tool 1 and 2nd digits 01 = offset number
8. Spindle gear speed change clamp
G50 S300 M41
Spindle Clamp Preset Spindle Speed 1st gear (most machines)
9. MO3 S300 G96
Spindle On - Forward Surface Speed use surface speed
300 feet / second
10. Approach part
G00 X12.2 Z2.0
Rapid
G00 Z.5 MO8 = Coolant on
11. Canned Face Cycle (2 line)
G72 W.085 R.03

W = Z depth of cut
R = Retract amount
G72 P101 Q102 UOW .01 F .015
P = Pickup # (start block)
Q = Quit block #
U = X stock to leave
W = Z stock to leave
F = Feedrate, this feedrate overrides others on this cycle
12. N101 G00 Z 0
Rapid to Z 0 in increments of depth of cuts
N102 G01 X-.032 F.01
Face to X0 Go past by radius amount
13. G00 X15 Z5.0
Move tool away from part
14 (ROUGH TURN) Operation description
(TOOL 1) Tool Number
(R.H. CNMG 542) Tool desription
G28 U0 W0 Home
T0202 Index tool
G50S300M41 preset - spindle clamp - gear change
MO3 S300 G96 Spindle forward 300 surface speed constant surface speed
G00 X12.2 Z2.0 position tool
G00 Z.5 MO8 Bring Z closer coolant on
G71 U.125 R.03 Turn canned cycle .125 depth of cut per side Retract amount
G71 P201 Q202 U.1 W.01 F.015 Start block End Block Leave stock .1 X .01 Z Feedr
ate
N201 G01 X11.0 Z.001 F.01 Toolpath Feedrate for finish pass it will ignore this
feerate on the rough cycle
G03 X11.0 Z-.05 R.05 Radius at the face of part
G01 Z-1.5
X11.25 Z-1.625
N202 Z-6.03
G00 X15. Z5.0 M09 Clear tool coolant off
M00 Machine Stop
(DRILL) Operation description
(TOOL 4) Tool Number
(2 1/2 INSERT DRILL) Tool desription
G28 U0 W0 Home
T0404
G50S200M41
MO3 S200 G97
G00 X12.2 Z2.0
X0
G00 Z.5 MO8
G74 R.02
G74 Z-4.4 Q650 F.01
G00 X15. Z5.0 M09 Clear tool Coolant off
(FINISH TURN) Operation description
(TOOL 2) Tool Number
(R.H. CNMG 542) Tool desription
G28 U0 W0 Home
T0202
G50S300M41

MO3
G00
G00
G70
G00

S320 G96
X12.2 Z2.0
Z.5 MO8
P201 Q202 Finish canned cycle start and stop blocks
X15. Z5.0 M09 Clear tool Coolant off

(CUT THREAD)
(TOOL 8)
(R.H. 60 DEGREE)
G28 U0 W0
T0808
G50S120M41
MO3 S100 G97
G00 X11.01 Z1.0
G00 Z.5 MO8
G00 X11.002 Z0.4
G92 Z-1.48 F.125 X10.994
X10.988
X10.982
X10.976
X10.97
X10.964
X10.958
X10.952
X10.946
X10.94
X10.934
X10.928
X10.922
X10.916
X10.91
X10.904
X10.898
X10.892
X10.886
X10.88
X10.874
X10.868
X10.862
X10.856
X10.85
X10.8466
G00 X20 Z10.0 M09
M30
M30 reset Program
Program without comments
%
O0123
(ROUGH FACE)
(TOOL 1)
(LEAVE .01)
(R.H. CNMG 542)
G28 U0 W0
T0101
G50S300M41
MO3 S300 G96
G00 X12.2 Z2.0

G00 Z.5 MO8


G72 W.085 R.03
G72 P101 Q102 U0 W.01 F.015
N101 G00 Z0
N102 G01 X-.032 F.01
G00 X15. Z5.0 M09
M00
(ROUGH TURN)
(TOOL 1)
(R.H. CNMG 542
) G28 U0 W0
T0202
G50S300M41
MO3 S300 G96
G00 X12.2 Z2.0
G00 Z.5 MO8
G71 U.125 R.03
G71 P201 Q202 U0 W.01 F .015
N201 G01 X11.0 Z.001 F.01
G03 X11.1 Z-.05 R.05
G01 Z-1.5
X11.25 Z-1.625
N202 Z-6.03
G00 X15. Z5.0 M09
M00
(DRILL) Operation description
(TOOL 4) Tool Number
(DRILL DIAM = 2.5) Tool desription
G28 U0 W0 Home
T0404
G50S200M41
MO3 S200 G97
G00 X12.2 Z2.0
X0
G00 Z.5 MO8
G74 R.02
G74 Z-4.4 Q650 F.01
G00 X15. Z5.0 M09 Clear tool Coolant off
(ROUGH ID)
(TOOL 6)
(R.H. CNMG 542)
G28 U0 W0
T0606
G50S300M41
MO3 S300 G96
G00 X3.0 Z2.0
G00 Z.1 MO8
G71 U.1 R.03
G71 P301 Q302 U-.1 W.01 F .015
N301 G01 X4.0625 Z.001 F.01
G03 X4.25 Z-.05 R.05
G01 Z-1.75
X4.125 Z-1.8125
N302 Z-6.03
G00 X15. Z5.0 M09
M00

(FINISH ID)
(TOOL 6)
(R.H. CNMG 542)
G28 U0 W0
T0606
G50S300M41
MO3 S320 G96
G00 X4.01 Z1.0
G00 Z.1 MO8
G70 P301 Q302
G00 X15. Z5.0 M09
(FINISH TURN)
(TOOL 2)
(R.H. CNMG 542)
G28 U0 W0
T0202
G50S300M41
MO3 S320 G96
G00 X12.2 Z2.0
G00 Z.5 MO8
G70 P201 Q202
G00 X15. Z5.0 M09
(CUT THREAD)
(TOOL 8)
(R.H. 60 DEGREE)
G28 U0 W0
T0808
G50S120M41
MO3 S100 G97
G00 X11.01 Z1.0
G00 Z.5 MO8
G00 X11.002 Z0.4
G92 Z-1.48 F.125 X10.994
X10.988
X10.982
X10.976
X10.97
X10.964
X10.958
X10.952
X10.946
X10.94
X10.934
X10.928
X10.922
X10.916
X10.91
X10.904
X10.898
X10.892
X10.886
X10.88
X10.874
X10.868
X10.862
X10.856
X10.85

X10.8466
G00 X20 Z10.0 M09
M30
Please check back soon as we are still working on this page and will be updating
it soon. Back to CNC Code Shooter Home Page

You might also like