ME 473
Simulating CNC Milling
Lecture 5
Mr. F NYARKO
[email protected] // 0261807208
Jan 2015
5- MILLING PROGRAMMING
EXAMPLES
5-1 Example 1:
This program introduces you to the Cartesian coordinate system and absolute
coordinates. Only single-axis, linear-feed moves show the travel directions of the X, Y,
and Z axes.
Workpiece Size: X5, Y4, Z1
Tool: Tool #3, 3/8" End Mill
Tool Start Position: X0, Y0, Z1 (Relative to workpiece)
% N35 X4 F20
:1001 N40 Y3
N5 G90 G20 N45 X1
N10 M06 T3 N50 Y1
N15 M03 S1200 N55 G00 Z1
N20 G00 X1 Y1 N60 X0 Y0
N25 Z0.125 N65 M05
N30 G01 Z-0.125 F5 N70 M30
5-2 Example 2: I-part2.mil
5-2 Example 2: I-part2.mil
This next program introduces you to diagonal linear feed moves, where both the X axis and the Y axis are
traversed
Workpiece Size: X5, Y4, Z1
Tool: Tool #2, 1/4" End Mill
Tool Start Position: X0, Y0, Z1 (Relative to workpiece)
% N40 Y3
:1002 N45 X1 Y1
N5 G90 G20
N50 Y3
N10 M06 T2
N55 X4 Y1
N15 M03 S1200
N20 G00 X1 Y1
N60 G00 Z1
N25 Z0.125
N65 X0 Y0
N30 G01 Z-0.125 F5 N70 M05
N35 X4 F10 N75 M30
5-3 Example 2: I-part2.mil
5-3 Example 3:
This program introduces arcs: G02 (clockwise) and G03 (counterclockwise). These are all simple
quarter quadrant arcs with a 1-in. radius
Workpiece Size: X5, Y4, Z1
Tool: Tool #2, 0.25" Slot Mill Tool Start Position: X0, Y0, Z1 (Relative to workpiece)
%
:1003
N5 G90 G20
N10 M06 T2
N15 M03 S1200
N20 G00 X0.5 Y0.5
N25 Z0.25
N30 G01 Z-0.25 F5
N35 G02 X1.5 Y1.5 I1 J0 F10
N40 X2.5 Y2.5 R1
N45 X3.5 Y1.5 I0 J-1
N50 X4.5 Y0.5 R1
Example 3 (continued..)
N55 G01 Y1.5
N60 G03 X3.5 Y2.5 R1
N65 X2.5 Y3.5 I-1 J0
N70 X1.5 Y2.5 R1
N75 X0.5 Y1.5 I0 J-1
N80 G01 Y0.5
N85 G00 Z1
N90 X0 Y0
N95 M05
N100 M30
5-5 Example 5:
3-4.5 Example 5:
This program involves a simple drilling cycle with a defined retract plane. Once the G-code for the drill cycle
has been executed, only the X and/or Y location of the remaining holes need to be defined
Workpiece Size: X5, Y4, Z1
Tool: Tool #7, 3/8" HSS Drill
Tool Start Position: X0, Y0, Z1 (Relative to workpiece)
% N50 Y2
:1005 N55 Y1
N5 G90 G20 N60 X3
N10 M06 T7 N65 X4
N15 M03 S1000 N70 Y2
N20 G00 X1 Y1 N75 Y3
N25 Z0.25
N80 X3
N85 Y2
N30 G98 G81 X1 Y1 Z-0.25 R0.25 F3
N90 G00 Z1
N35 Y2 N95 X0 Y0
N40 Y3 N100 M05
N45 X2 N105 M30
5-6 Example 6: I-part6.mil
This program involves a drilling cycle with a dwell and incremental coordinates
Workpiece Size: X5, Y4, Z1
Tool: Tool #8, 3/4" HSS Drill
Tool Start Position: X0, Y0, Z1 (Relative to workpiece)
%
N50 Y1
:1006
N5 G90 G20 N10 M06 T8
N55 X-2
N15 M03 S500 N60 X-1
N20 G00 X1 Y1 N65 Y-1
N25 Z0.25 N70 X1
N30 G91 G98 G82 Z-0.5 R0.25 P1 N75 G80 G90 G00 Z1
N35 X1 N80 X0 Y0
N40 X2 N85 M05
N45 Y1 N90 M30
Y
5-7 MILLING PROGRAMMING EXAMPLE 7
Sample Program M98EX9:
Workpiece Size: X5, Y5, Z1
Tool: Tool #1, 3/32" Spot Drill
Tool #2, 1/4” HSS Drill
2
Tool #3, 1/2” HSS Drill
Tool Start Position: X0, Y0, Z1
1
%
:1010
1 2 3 4 X
N5 G90 G20
N10 M06 T1
N15 M03 S1500
N20 M08 (Coolant on)
N25 G00 X1 Y1
N30 G82 X1 Y1 Z-.1 R.1 P0.5 F5 (Start of cycle)
N35 M98 P1005 (Call subprogram to do rest)
N40 G80
• N50 M09
• N55 M06 T02
• N60 G29 X1 Y1
• N65 M03 S1200
• N70 M08
• N75 G83 X1 Y1 Z-1 R0.1 Q0.1 F5.0 (Start of cycle)
• N80 M98 P1005 (Call subprogram to do rest)
• N85 G80
• N90 G28 X1 Y1
• N95 M09
• N100 M06 T03
• N105 G29 X1 Y1
• N110 M03 S1000
• N115 M08
N120 G83 X1 Y1 Z-1 R0.1 Q0.1 F5.0 (Start of cycle)
N125 M98 P1005 (Call subprogram to do rest)
N130 G80
N135 G00 Z1
N140 X0 Y0
N145 M09
N150 M05
N155 M30
O1005 (Subprogram)
N5 X2
N10 X3
N15 X4
N20 Y2
N25 X3
N30 X2
N35 X1
N40 M99 (Return from sub-program)
G/M- X Y Z Comments
Codes
1 G00 1 1 1
2 G82 1 1 - 0.1 R.1 P0.5 F5
3 M98 SUBROUTING
P1005 CALL P1005
4 2 1 -0.1 2
5 3 1 -0.1 1
6 4 1 -0.1
7 4 2 -0.1
8 3 2 -0.1 1 2 3 4
9 2 2 -0.1
10 1 2 -0.1
11 G80 Co-ordinate Data
12 G28 1 1 Sheet
13 M09
14 M06 T02
15 G29 1 1
16 G83 1 1 -1
17 M98
P1005
18
Learning Track Activities
Unit Summary
1. Detail description of CNC Milling codes: G-codes
2. Detail description of CNC Milling codes: M-codes
3. CNC Milling Programming Examples
Unit Assignment 5
Figure 1
Assignment 5:
Figure 1 shows a part to be machined on a CNC milling Centre. The rectangular ,
circular and semi-circular slots are to be milled using an End Mill cutter (0.5
inches dia. - T01) in two linear feed steps each to a depth of 0.25 inches
respectively at a cutter speed of 1500 rpm.
The counter-bored holes are to be drilled in three steps; first a centre drill (0.0625
inches dia. – T02 @ 1400 rpm) is used to locate the centres of these counter-
bored holes followed by an HSS drill (0.25 inches dia. –T03 @ 1200 rpm) to drill
through in ten canned cycles. Finally an HSS drill (.5 in dia. - T04 @ 1000 rpm)
is used to counter-bore to a depth of 0.5 inches in five canned cycles.
The retract plane for all canned cycles is (Z 0.1). Using the Standard G & M-
codes and without the use of compensations, write a CNC program to machine
this part.