1st - T - Lect No.11 - CAM - Multiple Machining - Subprogram
1st - T - Lect No.11 - CAM - Multiple Machining - Subprogram
Multiple Machining
2
Standard Fixed Cycles
Y
Loop Command Cycles
N10 G90 G20 X
G91 X1 L9
G90 Y-2
G91 X-1 L9
Y
G90 Y-3
X
G91 X1 L9
G90 Y-4
G91 X-1 L9
……………
G90 Y-10
G91 X-1 L9
M30
Y
Loop Command Cycles
X
Student
activity
Y
Loop Command Cycles
N10 G90 G20 X
G91 X1 L9
G91 X 1 L8
G90 X9 Y-3
G91 Y -1 L6
……………
G70 I J L
L: Number of Holes
Y
Example X
N10 G90 G20 G00 X6 Y5 Z1 T01 M06
hole circle)
Note : L0 will cause machine
N50 G99 G81 Z-0.5 R0.1 F0.4 L0
to not do this command until
N60 G70 I1.25 J10 L8 the control reads the next
G71 I J K L
L: Number of Holes
Example Y
N10 G90 G20 G00 X6 Y5 Z1 T01 M06 X
N80 M30
G72: Bolt Hole along an angle
G72 I J L
L: Number of Holes
Y
Example X
N40 G00 X0.65 Y-1.5 (Start position of bolt holes along an angle)
N80 M30
Example No.1 Y
N10 G90 G20
N40 G00 X1 Y1
N170 M30
Subprogram
Subprogram call M97
instead of repeating them many times, they can be “called up” when
needed.
The most common use of subroutines is in the definition of a series of
holes which may need to be center drilled, peck drilled, tapped, and/or
chamfered.
holes, the main program can define the canned cycles, and the hole
operations.
Thus, the X-Y positions can be entered only once and used several
with the subroutine call it is repeated that number of times before the
M99 which sends it back to the next line after the subroutine call in
Main Program
N3G99 G81 Z-1.5 R1.1 F0.4
N4 M97 O100 L1
N5 M05 G80
N6 G00 X6 Y4 Z2 T02 M06
N7G00 X0.5 Y0.5 S300 M03 M08
N8G99 G84 Z-0.5 R1.1 F0.1
N9 M97 O100 L1
N10 G80 G00 X6 Y4 Z2 M05
N11 M30 (End of main program)
O100 (Subprogram)
X2.5
X4.5
X3.5 Y1.5
…………Listing all the hole locations
M99 (ends a sub-program and returns back to
the next line in the main program)
Write a G code program for milling the shown 4 rectangular pocket,
use subroutine
Y call.
20
25
20
30
X
N1 G90 G21 G00 X200 Y80 Z50 T01 M06
Main Program
N2 G00 X20 Y20 Z5 S1000 M03 M08
N4 M97 O100 L1
N6 G00 X70 O100 (Subprogram)
N7 M97 P100 L1 G92 X0 Y0 (set current
N8 G00 X120 position to X=0,Y=0)
N9 M97 O100 L1 G01 Z-10 F4
N10 G00 X200 Y 50 Z20 M05 M09 Y25
N11 M30 (End of main program) X30
Y0
X0
Z2
M99
24
24