CAD/CAM Principles and
Applications
Ch 13 CNC Programming
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
Objectives
Understand the fundamentals of part programming in terms of the
various steps needed to be taken for completing a successful CNC part
program.
Comprehend the elements of manual part programming methods using
word address format and the ISO G-coding systems.
Learn the part programming fundamentals related to the use of various
word addresses.
Appreciate different preparatory (G codes) and miscellaneous functions
(M codes) as used in CNC part programs.
Write and prove sample part programs for CNC machining centres in
planar milling operations using the word address format.
Understand the concept of canned or fixed cycles for the hole making
operations
Learn the use of cutter diameter and length compensation while using
with multiple cutting tools.
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
13.1 Part Programming
Fundamentals
Process planning
Axes selection
Tool selection
Cutting process parameters planning
Job and tool setup planning
Machining path planning
Part program writing
Part program proving
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
Study part print
Fig. 13.1 The steps
involved in the
development of a
proven part program
in NC machining
Identify machine
tool
Capability
of cutting
tools
Identify operations
and tooling
Machine
tool
databace
Cutting
tool
database
Determine feeds,
speeds, depths,
power
Machinability
database
Prepare setup
sheet with work
setting and tooling
assembly
Develop part
program
Simulate tool
path
Dry run
Cut the first part
Inspect the part
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
Proven part
Fig. 13.2 A typical component for NC
machining
15
10
20
15
10
R5
40
20
10
40
15
100
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
Fig. 13.3 Part for NC machining shown with axes system at the
centre
Y
R5
20
20
10
30
50
35
40
50
Z
X
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
Fig. 13.4 Same part as in Fig. 13.3 but with axes
system at the bottom left corner
Y
70
100
100
R5
20
40
50
60
80
40
30
85
15
15
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
X
7
Fig. 13.5 Tool path of the part for proving the
NC part program
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
Fig. 13.6 Shaded 3D image of the tool cutting the part for providing
more realistic proving of the NC part program (Courtesy Virtual Gibbs Inc.)
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
Fig. 13.7 Setup sheet for a machining centre part
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
10
13.2 Manual Part
Programming Methods
ISO standards for coding
Co-ordinate function
Feed function
Speed function
Tool function
G Codes
M Codes
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
11
Fig. 13.8 Absolute (G90) and incremental (G91)
systems
15
10
5
O
B
A
C
5
25
35
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
X
12
Fig. 13.9 XY plane selection for vertical axis milling
Z
machines
G17
X
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
13
Fig. 13.10
XY plane selection for horizontal axis
milling machines
Y
X
Z
G17
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
14
Fig. 13.11 XZ plane selection for horizontal axis milling
Z
machines
G18
X
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
15
Fig. 13.12
YZ plane selection for horizontal axis
Z
milling machines
G19
X
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
16
Fig. 13.13 Setting the workpiece on the machine table
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
17
Fig. 13.14 Positioning, preparatory function G00
Y
45
30
A
20
B
X
150
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
18
Fig. 13.15 Positioning, preparatory function G00 in 3
dimensions
Z
A
70
Y
40
50
45
90
90
X
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
19
Fig. 13.16 Linear interpolation, preparatory function
G01
Y
100
E
30
X
20
110
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
20
Fig. 13.17 Circular interpolation, preparatory function
G02/G03
Y
20
G
F
30
X
50
65
5
R3
15
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
21
Fig. 13.18 Circular interpolation in XY plane using G17
plane selection
Z
X
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
22
Fig. 13.19 Circular interpolation in XZ plane using G18
plane selection
Z
Y
A
X
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
23
Fig. 13.20 Example
Y
125
R
C 10
5
R3
100
10
R
B
75
50
25
25
E
X
65
10
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
24
Fig. 13.21
Simulation of the above part program for
component shown in Fig. 13.20
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
25
Fig. 13.22 Component for example 13.2
Y
98
20
98
80
20
18.757
18.757
80
2
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
26
Fig. 13.23 Tool path for machining the component for
example 13.22
Y
Cutter centre path
Y1
Y2
Part contour
X1
X2
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
27
Fig. 13.24 Offset Tool path for machining contours
that are not parallel to the principal axes
Y
Cutter centre path
Y1
Y2
Part contour
X1
X2
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
28
Fig. 13.25
Simulation of the above part program for
component shown in Fig. 13.22
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
29
Fig. 13.26 Tool length compensation
4
L4
TOOL
2
3
L2
L3
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
30
Fig. 13.27 Typical motions embedded in G81 canned
cycle
R AP
ID
Breakthrough
distance
Hole
Depth
FEED
RAPID
Clearance plane
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
31
Fig. 13.28 Example for canned cycles.
Y
100
D
C
B
1
0
100
70
50
35
25
55
75
15
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
32
Fig. 13.29 Component for NC program in example
13.3
130
115
Y
95
80
100
84
84
60
40
34
16
X
20
40
60
20
8
10
Cutting tools:
1 End mill 40 mm
2 Centre drill
3 Twist drill 6 mm
4 Twist drill 8.5 mm
5 Tap M10
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
33
Fig. 13.30
Simulation of the above part program for
component shown in Fig. 13.29
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
34
Fig. 13.31 Cutter radius compensation
0
10
30
12
70
90
10
20
Programmed Path
40
Offset Path of Cutter
60
80
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
35
Fig. 13.32 Example showing the cutter radius
compensation using the G codes G42
Set point
A
Y
1
G42
G40
110
140
90
60
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
36
Fig. 13.33 Example showing the cutter radius
compensation using the G codes G41 and G42
A
100
41
60
B
K
42
2
0
L
200
0
12
E
J
200
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
37
Fig. 13.34 Example for contour programming using
the cutter radius compensation
R10
70.432
84.574
20
46.642
120
77.503
R15
39.571
25.607
91.645
R15
R10
22.5
15
33
10
4.393 53.713
124.853
134.799
10
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
38
Summary
Part programming is a systematic activity and following the
steps in proper sequence will help in developing efficient part
programs
Selection of the part coordinate axes system with respect to the
part geometry help in reducing the mathematical calculations
that are needed to write the part program
ISO standard for part programming utilises all the 26 characters
of English alphabet as word addresses in a part program.
Preparatory functions or G-codes control the geometrical nature
of the data input as well as operation of some of the data in a
program. A large number of these codes are standardised by
ISO.
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
39
Summary
Motion commands are the most important part of the G-codes
used to control the motion in rapid (G00), linear interpolation
(G01) and Circular interpolation (G02 and G03).
Miscellaneous functions or M-codes are used to specify the
machine tool functions in the program. Less number of codes
are standardised in view of these being machine specific.
For programs involving multiple tools, tool length compensation
can be activated by the use of tool offset registers.
Canned or fixed cycles offer the facility to reduce the bulk of
program by canning the often repeated command into a single
G-code. Examples are for the drilling of holes (G81).
In milling of contours large amount of complex calculations are
often required to take multiple cuts. This can be reduced by the
use of cutter diameter compensation (G41 and G42).
CAD/CAM Principles and
Applications by P N Rao, 2nd Ed
40