Professional Documents
Culture Documents
CNC Programming PDF
CNC Programming PDF
CNC Programming PDF
93
CNC Programming
¾ Manual
z Write code directly
¾ Computer
Computer--assisted
z Draw cutter path
¾ CAD/CAM
z Draw
Dra the part
z Cutter path is generated
1
CNC PROGRAMMING
¾ Offline programming linked to CAD programs.
¾ C
Conversational
ti l programming
i b th
by the operator.
t
¾ MDI ~ Manual Data Input.
¾ Manual Control using jog buttons or `electronic
handwheel'.
¾ Word--Address Coding using standard G-
Word G-codes
and M-
M-codes.
95
96
2
The position of the tool is described
b using
by i aC Cartesian
t i coordinate
di t
system. If (0,0,0) position can be
described by the operator, then it is
called floating zero.
zero.
97
98
3
1. Absolute positioning.
positioning. In this mode, the
desired target position of the tool for a
particular move is given relative to the origin
point of the program.
2. Incremental positioning.
positioning. In this mode, the
next target position for the tool is given
relative to the current tool position.
99
Block Format:
1. Fixed sequential format
2. Tab sequential format
3. Word address format
100
4
EXAMPLE:
Assume that a drilling operation is to be
programmed as:
101
102
5
Modal commands:
commands: Commands issued in the
NC program that will stay in effect until it is
changed by some other command, like, feed
rate selection
selection, coolant selection
selection, etc
etc.
Nonmodal commands:
commands: Commands that are
effective only when issued and whose
effects are lost for subsequent commands,
lik a d
like, dwellll commandd which
hi h iinstructs the
h
tool to remain in a given configuration for a
given amount of time.
103
INFORMATION NEEDED by a
CNC
1. Preparatory Information: units, incremental or absolute
positioning
2. Coordinates: X,Y,Z, RX,RY,RZ
3. Machining Parameters: Feed rate and spindle speed
4. Coolant Control: On/Off, Flood, Mist
5. Tool Control: Tool and tool parameters
6. Cycle Functions: Type of action required
7. Miscellaneous Control: Spindle on/off, direction of
rotation stops for part movement
rotation,
This information is conveyed to the machine through a set
of instructions arranged in a desired sequence – Program.
104
6
BLOCK FORMAT
Sample Block
N135 G01 X1.0 Y1.0 Z0.125 F5
¾ Restrictions on CNC blocks
¾ Each may contain only one tool move
¾ Each may contain any number of non-tool move G-
codes
¾ Each may contain only one feedrate
¾ Each may contain only one specified tool or spindle
speed
¾ Th block
The bl k numbersb should
h ld beb sequential
ti l
¾ Both the program start flag and the program number
must be independent of all other commands (on
separate lines)
¾ The data within a block should follow the sequence
shown in the above sample block
105
WORD--ADDRESS CODING
WORD
Example CNC Program
¾ N5 G90 G20 Each
E h iinstruction
t ti tto the th machine
hi
¾ N10 M06 T3 consists of a letter followed by a
¾ N15 M03 S1250 number.
¾ N20 G00 X1 Y1
¾ N25 Z0.1
Each letter is associated with a
¾ N30 G01 Z-
Z-0.125 F5
¾ N35 X3 Y2 F10 specific type of action or piece of
¾ N40 G00 Z1 information needed by the machine.
machine
¾ N45 X0 Y0 Letters used in Codes
¾ N50 M05
¾ N55 M30 N,G,X,Y,Z,A,B,C,I,J,K,F,S,T,R,M
106
7
G & M Codes
Example CNC Program
¾ N5 G90 G20 • G
G-codes:
d P
Preparatory
t Functions
F ti
¾ N10 M06 T3 involve actual tool moves.
¾ N15 M03 S1250
¾ N20 G00 X1 Y1 • M-codes: Miscellaneous
¾ N25 Z0.1
Functions – involve actions
¾ N30 G01 Z-
Z-0.125 F5
¾ N35 X3 Y2 F10 necessary for machining (i.e.
¾ N40 G00 Z1 spindle on/off,
on/off coolant on/off)
on/off).
¾ N45 X0 Y0
¾ N50 M05
¾ N55 M30
107
G Codes
¾ G00 Rapid traverse
¾ G01 Linear interpolation ¾ G40 Cutter compensation –
¾ G02 Circular interpolation,
interpolation cancel
CW ¾ G41 Cutter compensation –
¾ G03 Circular interpolation, left
CCW ¾ G42 Cutter compensation-
compensation-
¾ G04 Dwell right
¾ G08 Acceleration ¾ G70 Inch format
¾ G09 Deceleration ¾ G71 Metric format
¾ G17 X
X--Y Plane ¾ G74 Full-
Full-circle programming
¾ G18 Z-
Z-X Plane off
¾ G19 Y
Y--Z Plane
Pl ¾ G75 Full-
Full-circle programming
¾ G20 Inch Units (G70) on
¾ G21 Metric Units (G71) ¾ G80 Fixed
Fixed--cycle cancel
¾ G81--G89 Fixed cycles
G81
¾ G90 Absolute dimensions
¾ G91 Incremental dimensions
108
8
Modal G-
G-Codes
¾ Most G
G--codes set the machine in a “mode”
which stays in effect until it is changed or
cancelled by another GG--code. These
commands are called “modal”
modal .
109
Modal G-
G-Code List
¾ G00 Rapid Transverse ¾ G43 Tool length
¾ G01 Linear Interpolation compensation (plus)
¾ G02 Circular Interpolation,
p , CW
¾ G03 Circular Interpolation, ¾ G44 Tool length
CCW compensation (minus)
¾ G17 XY Plane
¾ G49 Tool length
¾ G18 XZ Plane
¾ G19 YZ Plane compensation cancel
¾ G20/G70 Inch units ¾ G80 Cancel canned cycles
¾ G21/G71 Metric Units ¾ G81 Drilling cycle
¾ G40 Cutter compensation
cancel ¾ G82 Counter boring cycle
¾ G41 Cutter compensation left ¾ G83 Deep hole drilling cycle
¾ G42 Cutter compensation right
¾ G43 Tool length compensation ¾ G90 Absolute positioning
(plus) ¾ G91 Incremental positioning
110
9
M Codes
¾ M00 Program stop
¾ M01 Optional program stop
¾ M02 Program
P endd
¾ M03 Spindle on clockwise
¾ M04 Spindle on counterclockwise
¾ M05 Spindle stop
¾ M06 Tool change
¾ M08 Coolant on
¾ M09 Coolant off
¾ M10 Clamps on
¾ M11 Clamps off
¾ M30 Program stop, reset to start
111
N Codes
¾ Gives an identifying number for each block
off information.
i f ti
112
10
X,Y, and Z Codes
¾ X,Y, and Z codes are used to specify the
coordinate
di t axis.
i
¾ Number following the code defines the
coordinate at the end of the move relative
to an incremental or absolute reference
point.
113
114
11
F,S, and T Codes
¾ F-code
code:: used to specify the feed rate
¾ S-code
code:: used to specify the spindle speed
¾ T-code
code:: used to specify the tool
identification number associated with the
tool to be used in subsequent operations.
115
116
12
Application of Some Codes
G01 Linear Interpolation
¾ . As an example, for the motion that occurs in x-
y plane with the same maximum speed for the xx--
and yy--axis, initial motion is at an angle of 45o to
the axes until motion in one of
117
25
B C
20
15
10
0 os t o g motion
Positioning ot o from
o A to C
A N10 G00 X30000 Y20000 F0
5
5 10 15 20 25 30
118
13
Application of Some Codes
G01 Linear Interpolation
119
Linear interpolation
p from A to C
25 N10 G01 X30000 Y20000 F2500
C
20
15
10
A
5
5 10 15 20 25 30
120
14
G01 Linear Interpolation
N10 G00 X1 Z1
X
N15 Z0.1
N20 G01 Z-
Z-0.125 F5
N25 X2 Z2 F10
Z
121
122
15
G02 Circular Interpolation (CW)
N_ G02 X2 Y1 I0 J
J--1 F10
or
N_ G02 X2 Y1 R1
123
15
J=15
10 B
C
5
5 10 15 20 25 30 124
16
Canned Cycles
The sequence of some machining operations is may
be the same for any part and for any machine. For
example, drilling a hole involves the following steps:
Position the tool above the point where the hole will be
drilled
125
17
G81 ILLUSTRATION
127
Part 1-
1- Program Petup
¾ N5 G90 G2
G211 (Absolute units, metric
metric))
128
18
Three Main parts of a CNC
program
Part 2-
2- Chip Removal
¾ N20 G00 X1 Y1 (Rapid to X1,Y1 from origin
point)
¾ N25 Z0.125 (Rapid down to Z0.125)
¾ N30 G01 Z-
Z-0.125 F100
F100 (Feed down to Z Z--0.125 at
100 mm/m
mm/min in))
¾ N35 G01 X2 Y2 (Feed diagonally to X2,Y2)
¾ N40 G00 Z1 (Rapid up to Z1)
¾ N45 X0 Y0 (Rapid to X0,Y0)
129
Part 3-
3- System Shutdown
¾ N55 M
M0
00 (Program
g stop
stop)
p)
130
19
EXAMPLE OPERATION on CNC
MILLING MACHINE
131
G-CODE PROGRAM
¾ First pass : conventional mill to
a depth of 0.125 around edge
profile Tool 1 is a ½ inch dia
profile. dia.
end mill.
%
:1002
N5 G90 G20
N10 M06 T1
N15 M03 S1200
N20 G00 X0.125 Y0.125
N30 Z0
Z0.125
125
N35 G01 Z-0.125 F5
N40 X3.875
N45 Y4.125
N50 X0.125
N55 Y0.125
132
20
¾ Second pass:
conventional mill to a
depth of 0.25 around
edge profile.
N35 Z-0.250
N40 X3.875
N45 Y4.125
N50 X0.125
N55 Y0.125
N60 Z0.125
133
¾ Third pass:
conventional mill to a
depth of 0.125 around
pocket profile.
134
21
¾ Fourth pass: climb
mill to a depth of
0.125 across
remaining material.
N100 Y2.125
N105 X2.625
N110 Z0.125
N115 G00 X-5
X5Y Y-5
5 Z5
N120 M05
N125 M30
135
Advanced features:
136
22
Program Loading:
¾ Through keyboard
¾ Through punched tape reader
¾ Through diskette drive
¾ Through RS 232 serial port
¾ Through network interface card
137
138
23
Direct Numerical Control (DNC):
139
140
24
Distributed Numerical Control (DNC):
141
142
25
Advantages of applying computer-
computer-aided part
programming include the following:
143
144
26
CAD/CAM Based Part Programming:
27