Boxford DUET
CNC Tutorials and Exercises
CNC Tutorials and Exercises
Boxford DUET
Tutorial 1 CNC Tutorials and Exercises
Tutorial 1:
X and Y Co-ordinate Calculation Absolute and Incremental Co-ordinates This tutorial gives examples of absolute co-ordinates and incremental co-ordinates. Absolute Co-ordinates The code G90 is used to select this type of programming. Before programming commences the points on the path to be machined are defined relative to the workpiece datum:
10
Y+
9
D C
8 7 6
B
5 4 3
A
2 1
X-
-10 -9 -8 -7 -6 -5 -4 -3 -2 -1-1 -2
X+ 1
2
3
4
-4 -5
F
6
7
8 9 10
H
-3
E
5
ORIGIN X0 Y0
G
-6 -7 -8 -9 -10
Y-
Examples of these co-ordinates are shown in the first table on the next page.
Tutorial 1 CNC Tutorials and Exercises
Boxford DUET
The Z axis is the vertical axis and the datum used is normally the surface of the work. Z is positive when moving away from the surface and negative when moving towards or into the surface. POINT
DATUM
A
B
C
D
E
F
G
H
X Y
0 0
5 4
10 5
-4 5
-9 7
-7 -3
-4 -6
7 -5
5 -2
Incremental Co-ordinates The code G91 is used to select this type of programming. The points on the path to be machined are defined relative to the previous position. The points for the example on the previous page are shown in the table below.
POINT
DATUM
A
B
C
D
E
F
G
H
X Y
0 0
5 4
5 1
-14 0
-5 2
2 -10
3 -3
11 1
-2 3
The Z axis is again the vertical axis, and the points are defined relative to the previous position; positive when moving away from the surface and negative when moving towards or into the surface.
Boxford DUET
Tutorial 1 CNC Tutorials and Exercises
Exercise 1 : Calculation of Co-ordinates
Tabulate the positions of the points A to H shown in the illustration below: a)
in absolute co-ordinates
b)
in incremental co-ordinates Y+ 6
D
5 4
C
A
3
B
2 1
X-8
-7 -6
-5
-4
F
-3
-2
X+ 1
-1 -1
2
4
5
G
-2 -3
H
-4
E
3
-5 -6
Y-
6
7
8
Tutorial 2 CNC Tutorials and Exercises
Boxford DUET
Linear Interpolation This tutorial illustrates the use of the G01 code; cutting takes place in a straight line at a controlled feed rate. Consider the component illustrated below; it is required to mill the two L shaped slots. 45
C
D
20
B
A
15
50
Tutorial 2:
15
F 20
Y
E 30
80 Material: Grooves: Tool change at: Tool used:
X
15mm thick Plastic 5 wide x 2 deep X 0, Y 0, Z 25 5mm Slot Drill
Absolute Co-ordinates The absolute co-ordinates of the points are shown in the table below: POINT
A
B
C
D
E
F
T.C.
X Y
15 15
15 35
45 35
65 35
65 15
35 15
0 0
The program can be written in tabulated format as shown on the following page. Note: G00 is a default value and need not be programmed. The first tool is selected when entering the program into the computer.
Boxford DUET
DRAWING NUMBER
NOTES
Tutorial 2 CNC Tutorials and Exercises
DUET PROGRAMMING SHEET-MILLING TUT 2/1
TITLE
G
ABSOLUTE PROGRAMMING
N10
90
METRIC UNITS
N20
71
TOOL CHANGE
N30
SPINDLE
N40
M
1 OF
CO-ORDINATES
X
Y
Z
0
0
25
I
J
FEED RATE
SPINDLE SPEED
F
S
03
1500
2mm ABOVE POINT A
N50
FEED TO 2 DEEP
N60
01
15
POINT B
N70
01
15
POINT C
N80
01
45
15
2 –2
2mm ABOVE WORK
N90
ABOVE POINT D
N100
FEED TO 5 DEEP
N110
01
POINT E
N120
01
POINT F
N130
01
2mm ABOVE WORK
N140
PARK POSITION
N150
05
END OF PROGRAM
N160
30
1
PROGRAMMED BY
SEQUENCE PREP MISC No. FUNCTION FUNCTION
N
SHEET No.
35
125 125 125
2 65 –2 15
125
35
125 2
0
125
0
25
Tutorial 2 CNC Tutorials and Exercises
Boxford DUET
Using compact format, the program for the component shown previously will be as follows: N10 N20 N30 N40 N50 N60 N70 N80 N90 N100 N110 N120 N130 N140 N150 N160
G90 G71 X0 M03 X15 G01 G01 G01 Z2 X65 G01 G01 G01 Z2 M05 M30
Y0 S1500 Y15 Z-2 X15 X45
Z25
Z-2 Y15 X35
F125 F125 F125
X0
Y0
Z2 F125 Y35 F125 F125
Z25
Incremental Co-ordinates The incremental co-ordinates for the component are shown in the table below. Using these co-ordinates the program can be written as shown as follows: POINT
TOOL CHANGE
A
B
C
D
E
F
X Y
0 0
35 35
0 20
30 0
20 0
0 -20
-30 0
T.C. FROM F -35 -15
Boxford DUET
Tutorial 2 CNC Tutorials and Exercises
Using these co-ordinates the program can be written as shown as follows:
DUET PROGRAMMING SHEET-MILLING
DRAWING NUMBER
TUT 2/2
TITLE
N
G
ABSOLUTE PROGRAMMING
N10
90
METRIC UNITS
N20
71
TOOL CHANGE
N30
INCREMENTAL PROGRAMMING
N40
SPINDLE START RAPID TO 2mm ABOVE A
N50
M
OF 1
PROGRAMMED BY
SEQUENCE PREP MISC No. FUNCTION FUNCTION
NOTES
SHEET No. 1
CO-ORDINATES
X
Y
Z
0
0
25
15
15
–23
I
J
FEED RATE
SPINDLE SPEED
F
S
91 03
–4
1500
FEED TO mm DEPTH
N60
01
FEED FROM A TO B
N70
01
0
20
125
125
FEED FROM B TO C
N80
01
30
0
125
RAPID TO CLEARANCE PLANE
N90
RAPID TO 2mm ABOVE D
N100
FEED TO 2mm DEPTH
N110
01
FEED FROM D TO E
N120
01
0
–20
125
FEED FROM E TO F
N130
01
–30
0
125
RAPID TO CLEARANCE PLANE
N140
STOP SPINDLE RAPID TO PARK POSITION
N150
05
END OF PROGRAM
N160
30
4 20
0 –4
125
4 –35
–15
23
1.
Examine the program listed
2.
Enter the program into the computer
3.
Simulate the machining process and compare the movement of the cutter with the program
Tutorial 2 CNC Tutorials and Exercises
Boxford DUET
Exercise 2: Linear Interpolation - Absolute Co-ordinates
1.
For the component shown below, use a programming sheet and write a program for the cutter to cut a groove along the path from A to H.
2.
Enter your program into the computer and give it a test run.
3.
Edit your program if necessary.
E
C
H
D
G
A
B
50
F
80
Y X
Material: Slots: Tool change at: Tool used:
15mm thick Plastic 5 wide x 2 deep X 0, Y 0, Z 25 5mm Slot Drill
Absolute Co-ordinates POINT
TOOL CHANGE
A
B
C
D
E
F
G
H
X Y
0 0
20 10
60 10
20 30
20 20
60 40
20 40
60 20
60 30
Boxford DUET
Canned Cycles Hole Drilling and Pocket Milling Canned cycles are used to shorten and simplify the CNC program. This tutorial gives examples of the G81 Hole Drilling and G88 Pocket Milling cycles. G81 Hole Drilling This code drills a hole at the current X and Y values to a depth of Z measured incrementally from the face of the workpiece and then withdraws to the previous Z value i.e. 2mm clear. Enter Z incremental distance from the face of the workpiece to the bottom of the hole) F (feed rate)
B
C
20
4 x Ø 5 holes 10 deep
D
A
15
50
Tutorial 3:
Tutorial 3 CNC Tutorials and Exercises
20
40 80
Tool change at: X -5, Y -5 Tool used: 5mm Slot Drill
POINT
A
B
C
D
X Y
20 15
20 35
60 35
60 15
Tutorial 3 CNC Tutorials and Exercises
Boxford DUET
The program for the component is as follows:
DRAWING NUMBER
DUET PROGRAMMING SHEET-MILLING
TUT3/1
NOTES
TITLE
SEQUENCE PREP MISC No. FUNCTION FUNCTION
N
G
N10
90
METRIC UNITS
N20
71
TOOL CHANGE
OF 1
PROGRAMMED BY
TUT 3/1
ABSOLUTE PROGRAMMING
SHEET No. 1
M
CO-ORDINATES
X
Y
Z
N30
–5
–5
25
RAPID TRAVERSE 2mm ABOVE HOLE A
N40
20
15
2
SPINDLE ON 1500 rev/min
N50
DRILL A 10mm DEEP
N60
RAPID TRAVERSE TO B
N70
DRILL B
N80
RAPID TRAVERSE TO C
N90
DRILL C
N100
RAPID TRAVERSE TO D
N110
DRILL D
N120
SPINDLE STOP TOOL CHANGE
N130
05
END OF PROGRAM
N140
30
I
J
FEED RATE
SPINDLE SPEED
F
S
03
1500
81 20 81 60
35
60
15
81
81 –5
– 10
125
– 10
125
– 10
125
– 10
125
35
–5
25
Boxford DUET
Tutorial 3 CNC Tutorials and Exercises
G88 Rectangular Milling This code mills a rectangular pocket. The tool should be positioned 2mm above the pocket centre on the previous line. Enter X
the side length of the rectangle
Y
the side width of the rectangle
Z
the distance from the workpiece face to the bottom of the pocket
J
the number of cuts
F
feed rate
2.5 Rad
15
50
The tool returns to its start point when the cycle is complete.
40 80
Material: Pocket: Tool change at: Tool used:
15mm thick Plastic 8 deep X -5, Y -5 5mm Slot Drill
The program for the above component is shown on the following page:
Tutorial 3 CNC Tutorials and Exercises
Boxford DUET
DUET PROGRAMMING SHEET-MILLING
DRAWING NUMBER
TUT3/2
TITLE
N
G
M
ABSOLUTE PROGRAMMING
N10
90
METRIC UNITS
N20
71
RAPID TO TOOL CHANGE
N30
SPINDLE ON 1500 rev/min
N40
2mm ABOVE CENTRE OF POCKET
N50
MILL POCKET
N60
SPINDLE STOP TOOL CHANGE
N70
05
END OF PROGRAM
N80
30
OF 1
PROGRAMMED BY
SEQUENCE PREP MISC No. FUNCTION FUNCTION
NOTES
SHEET No. 1
CO-ORDINATES
X
Y
Z
–5
–5
25
I
J
FEED RATE
SPINDLE SPEED
F
S
03
1500 40
88
25
2
40
15
8
–5
–5
25
4
125
1.
Examine the two programs.
2.
Enter each program into the computer.
3.
Simulate the machining process for each program and compare the movement of the cutter with the program.
Boxford DUET
Tutorial 3 CNC Tutorials and Exercises
Exercise 3:
Canned Cycles - Programming a Tool Change
For the component shown below: 1.
Tabulate the co-ordinates.
2.
Use a programming sheet and write a program to drill the holes mill the square pocket (For tool changing, refer to Section 9.9).
3.
Enter your program into the computer and give it a test run.
4.
Edit your program if necessary.
30
30
4 x Ø 3 through holes
10
50
30
20
60 80 15mm thick Plastic Material: Square Pocket: 5mm deep Tool change at: X 0, Y O
Tutorial 4 CNC Tutorials and Exercises
Boxford DUET
Tutorial 4:
Circular Interpolation Clockwise and Counter-clockwise This tutorial illustrates the use of the code G02 (clockwise circular interpolation) and G03 (counter clockwise circular interpolation). Circular Interpolation Clockwise This code moves the table in such a way that a clockwise circular arc is cut in the work within a single quadrant. The cutter is positioned at the start of the arc on the previous line of the program. The arc may be in the X Y, X Z or Y Z plane:
Y
X
Y
X
Z
X - Y Plane
X - Z Plane
Z Y - Z Plane
- and can be complete (90°) or partial (less than 90°), within a single quadrant:
After entering G02 the following extra information is needed: X value Y value Z value
two of these values specify the co-ordinates of where the curve finishes, the other value must be left blank.
Boxford DUET
Tutorial 4 CNC Tutorials and Exercises
I value the distance from the arc centre (incremental) to the tool position at the start of the cuts measured along: a)
the X axis when cutting in X-Y or X-Z plane
b)
the Y axis when cutting in the Y-Z plane J value the distance from the arc centre (incremental) to the tool position at the start of the cut measured along:
a)
the Y axis when cutting in the X-Y plane
b)
the Z axis when cutting in the X-Z or Y-Z plane Note that I and J are unsigned values. Alternatively the radius of the arc can be entered as the I value and J left blank. Clockwise Circular Interpolation (G02) Single quadrant 90° arc in the XY plane To mill from A to B arc of centre C clockwise interpolation (G02) CUTTER STARTS AT A
G = 02
X = 35
Y = 20
I=0
A
J = 10
10 R
Y C
30
a)
25
Datum
B X
Tutorial 4 CNC Tutorials and Exercises
Boxford DUET
Single quadrant partial arc in the XY plane To mill from A to B arc of centre C clockwise interpolation (G02) G = 02
X = (25 + 5) = 30 A 30 o
Y = (20 + 8.66) = 28.66
I=0
10 R
B
Y
C
30
b)
25
X
To calculate co-ordinates of B, construct triangle BCD CD =
10 x cos60
= 10 x 0.5
=5
BD =
10 x sin60
= 10 x 0.866
= 8.66
Note that I and J are unsigned values
A B
X
60 o
C
Y
D
J = 10
Boxford DUET
Tutorial 4 CNC Tutorials and Exercises
Circular Interpolation Counter-clockwise This code moves the table in such a way that a counter-clockwise circular arc is cut in the work within a single quadrant. The cutter is positioned at the start of the arc on the previous line of the program. As with the G02 code, the arc may be in the X-Y, X-Z or Y-Z planes
Y
X
Y
X
Z
X - Y Plane
X - Z Plane
Z Y - Z Plane
- and can be complete (90°) or partial (less than 90°), within a single quadrant:
After entering G03 the following extra information is needed: X value Y value Z value
two of these values specify the co-ordinates of where the curve finishes, the other value must be left blank.
I value the distance from the arc centre (incremental) to the tool position at the start of the cut measured along: a)
the X axis when cutting in X-Y or X-Z plane
b)
the Y axis when cutting in the Y-Z plane
Tutorial 4 CNC Tutorials and Exercises
Boxford DUET
J value the distance from the arc centre (incremental) to the tool position at the start of the cut measured along: a)
the Y axis when cutting in the X-Y plane
b)
the Z axis when cutting in the X-Z or Y-Z plane Note that I and J are unsigned values. Alternatively the radius of the arc can be entered as the I value and J left blank. Counter-Clockwise Circular Interpolation (GO3) Single quadrant 90° arc in the XY plane To mill from B to A arc of centre C counter-clockwise interpolation (G03) G = 03
X = 25
Y = 30
A
I = 10
J=0
10 R
Y C
30
a)
25
Datum
B X
Boxford DUET
Tutorial 4 CNC Tutorials and Exercises
Single quadrant partial arc in the X-Y plane To mill from B to A arc of centre C G = 03
X = 25
Y = 30
30 o
I=5
J = 8.66
10 R
A
B
Y
C
30
b)
25
X
To calculate co-ordinates of B, construct triangle BCD CD
= 10 x cos60
= 10 x 0.5
=5
BD
= 10 x sin60
= 10 x 0.866
= 8.66
Note that I and J are unsigned values
A B
X
60 o
C
Y
D
Tutorial 4 CNC Tutorials and Exercises
Boxford DUET
Example
D
50
C
E
B
F
A 10
G
10 80 Cutter: Arcs: Radius: Tool change at:
Ø5 2 deep 10 X -5, Y -5
POINT
A
B
C
D
E
F
G
X Y
10 10
20 20
30 30
40 40
50 30
60 20
70 10
The program for the above component is shown on the following page. Note: Blocks N70 to N90 define the arc in terms of its radius. Blocks N100 to N120 define the arc in terms of the co-ordinates of its centre
Boxford DUET
DRAWING NUMBER
NOTES
Tutorial 4 CNC Tutorials and Exercises
DUET PROGRAMMING SHEET-MILLING TUT4
TITLE
G
ABSOLUTE PROGRAMMING
N10
90
METRIC UNITS
N20
71
TOOL CHANGE
N30
SPINDLE START
N40
1 OF 1
PROGRAMMED BY
SEQUENCE PREP MISC No. FUNCTION FUNCTION
N
SHEET No.
M
CO-ORDINATES
X
Y
Z
–5
–5
25
J
I
FEED RATE
SPINDLE SPEED
F
S
03
1500
POINT A
N50
FEED TO DEPTH
N60
01
10
10
2
A TO B
N70
02
20
20
10
B TO C
N80
03
30
30
10
–2
125
C TO D
N90
02
40
40
10
D TO E
N100
02
50
30
0
10
E TO F
N110
03
60
20
10
0
F TO G
N120
02
70
10
0
10
RAPID OUT
N130
SPINDLE STOP TOOL CHANGE
N140
05
–5
–5
END OF PROGRAM
N150
30
2 25
1.
Examine the program.
2.
Enter the program into the computer.
3.
Simulate the machining process and compare the movement of the cutter with the program.
Boxford DUET
Tutorial 4 CNC Tutorials and Exercises
Exercise 4: Circular Interpolation
10 Rad
D 50
A
J
H
25
C
G
E
B
10 Rad
F
10 Rad
10 80 Material: 15mm deep Plastic Slot: 5 wide, 2 deep Tool change at: X 0, Y 0
For the cutter path shown above: 1.
Tabulate the co-ordinates A to J.
2.
Use a programming sheet to write a program for the path of the cutter centre line.
3.
Enter your program into the computer and give it a test run.
4.
Edit your program if necessary. Note: The curve must be programmed in a series of quadrants (90°).
Tutorial 5 CNC Tutorials and Exercises
Boxford DUET
Tutorial 5:
Combining Operations and Tool Changing This tutorial uses some cutters not supplied with the machine. It illustrates how tool changes can be made and a number of operation can be carried out on one component. Sequence of Operations 80
D
A
4 x Ø 5 holes
F
20
Ø30
D
15
50
E
B
C
40
15 13
20
G
Material: Plastic Tool change at: X 0, Y 0 5
1. 2. 3.
Mill the steps Drill the holes Mill the 30mm diameter pocket
5
(8mm diameter cutter) (5mm diameter drill) (10mm diameter cutter)
Note: Tool Changing The program for the above component illustrates the method of programming a tool change; block N120 moves the cutter to a tool change position and block N130 calls up a new tool. M06
denotes a tool change -
I
gives the tool type,
J
the tool diameter, and
Boxford DUET
Tutorial 5 CNC Tutorials and Exercises
The program is as follows: DRAWING NUMBER
NOTES
DUET PROGRAMMING SHEET-MILLING TUT 5
TITLE
G
ABSOLUTE PROGRAMMING
N10
90
METRIC UNITS
N20
71
TOOL CHANGE ø CUTTER
M
CO-ORDINATES
X
Y
Z
N30
–5
–5
25
RAPID TRAVERSE 2mm ABOVE A
N40
1
54
2
SPINDLE ON 1500 rev/min
N50
FEED TO DEPTH
N60
01
MILL FIRST STEP
N70
01
RAPID TRAVERSE 2mm ABOVE C
N80
FEED TO DEPTH
N90
01
MILL SECOND STEP
N100
01
TOOL CHANGE POSITION
N120
05
TOOL CHANGE (5mm DRILL)
N130
06
RAPID TRAVERSE OVER HOLE D
N140
SPINDLE ON
N150
DRILL D 17mm DEEP
N160
RAPID TRAVERSE OVER HOLE
N170
DRILL E
N180
RAPID TRAVERSE OVER HOLE F
N190
DRILL F
N200
N220
TOOL CHANGING POSITION
N230
I
J
SPINDLE SPEED
F
S
1500 –2
125
–5 79
–5
125 2 –2
125
55 –5
–5
125 25 2
20
15
6
2
03
1500
81 20
60
35
60
15
81
81 –5
– 17
125
– 17
125
– 17
125
– 17
125
35
81
05
2
FEED RATE
03
RAPID TRAVERSE OVER HOLE G N210 DRILL G
1 OF
PROGRAMMED BY
SEQUENCE PREP MISC No. FUNCTION FUNCTION
N
SHEET No.
–5
25
Tutorial 5 CNC Tutorials and Exercises
Boxford DUET
DUET PROGRAMMING SHEET-MILLING
DRAWING NUMBER
NOTES
TITLE
TUT 5
N
G
M
N240
RAPID TRAVERSE 2MM ABOVE CENTRE OF POCKET
N250
SPINDLE ON
N260
MILL POCKET
N270
SPINDLE OFF, RAPID FEED TO TOOL CHANGE POSITION
N280
05
END OF PROGRAM
N290
30
2
OF 2
PROGRAMMED BY
SEQUENCE PREP MISC No. FUNCTION FUNCTION
TOOL CHANGE 10mm DRILL
SHEET No.
CO-ORDINATES
X
Y
Z
06 40
25
I
J
2
10
FEED RATE
SPINDLE SPEED
F
S
2
03 89
1500 30
0
5
–5
–5
25
3
125
1.
Examine the program.
2.
Enter the program into the computer.
3.
Simulate the machining process and compare the movements of the cutters with the program.
Boxford DUET
Tutorial 5 CNC Tutorials and Exercises
Exercise 5: Combining Operations
5
80
O3
5
O2
5mm Groove
5
2
15
50
5
Material: 15mm thick Plastic Tool change at: X 0, Y 0
For the component shown above: 1.
Write down the sequence of operations required to produce the part.
2.
Tabulate the co-ordinates required.
3.
Use a programming sheet to write a program.
4.
Enter your program into the computer and give it a test run.
5.
Edit your program if necessary.
Tutorial 6 CNC Tutorials and Exercises
Boxford DUET
Subroutines A subroutine can be regarded as a personalised canned cycle for use in a program which has repetitive shapes. The illustration below shows such a component; the milled grooves can be programmed as a subroutine.
20
15
55
50
A
30
15
B
5
Tutorial 6:
20
5
Material: Grooves: Tool change at: A,B :
15mm thick Plastic 5 wide x 3 deep X 0, Y 0 start positions for subroutines
The codes used for subroutines are: M43 subroutine create On entering M43, a prompt is made for an identifying number to be given to the routine. The number is entered in the I column and may have a value from 1 to 99. The user should note this reference number and the purpose of the routine. The mode of programming is now changed: the line number automatically reverts to 10 and co-ordinate entry, if absolute, becomes incremental. There is no restriction on the range of G codes (except G25) and all the canned cycles are available.
Boxford DUET
Tutorial 6 CNC Tutorials and Exercises
M44 subroutine terminate On entry of the signal to end the subroutine the line numbers of the original program are restored and the current absolute position of the tool is shown in the X, Y and Z columns. If the program was previously being entered with absolute co-ordinates, it reverts to its former style. M45 subroutine call On entering M45 a prompt is made to input the reference number of the subroutine in the I column. A search is made in the subroutine file and the first file found with that reference number is executed. Note: Care is needed when allocating subroutine identification numbers. The program for the previous illustration shows subroutine blocks S10 onwards being typed into the system immediately after block N50. After this the cutter is repositioned before calling up the subroutine and completing the program. Editing of subroutines The program EDIT facility can be used. If this is brought into use the program is displayed for editing but a further option (SUB) is offered: SUB
HELP
MENU
If SUB is chosen, then the subroutine is displayed for editing. 1.
Examine the program.
2.
Enter the program into the computer.
3.
Simulate the machining process and compare the movements of the cutters with the program.
Tutorial 6 CNC Tutorials and Exercises
Boxford DUET
DRAWING NUMBER
NOTES
DUET PROGRAMMING SHEET-MILLING TITLE
G
N10
90
N20
71
N30 N40
POINT A
M
CO-ORDINATES
X
Y
0
0
Z
J
I
FEED RATE
SPINDLE SPEED
F
S
25
03
N50
SUBROUTINE FOR GROOVES
N60
POINT B
N70
SUBROUTINE FOR GROOVES
N80
45
N90
05
N100
30
ENTERED
S10
43
IMMEDIATELY AFTER BLOCK N50
S20
01
S30
01
S40
01
THE SUBROUTINE
S50
01
MACHINES THE GROOVES
S60
01
(INCREMENTALLY)
S70 S80
1 OF 1
PROGRAMMED BY
SEQUENCE PREP MISC No. FUNCTION FUNCTION
N
TOOL CHANGE
TUT 6
SHEET No.
1500 5
5
55
30
1
45
1
1 0
0
25
1 –3 15
125
20
125 – 15
125
– 20
125 3
44
125
Boxford DUET
Tutorial 6 CNC Tutorials and Exercises
Exercise 6: Subroutines
50
20
20
20
5
20
15
20
25
20
5
20 30 55 80
Material: Grooves:
15mm thick Plastic 5 wide x 2 deep
For the component shown above: 1.
Tabulate the co-ordinates required.
2.
Use a programming sheet to write a program; the L shaped grooves can be programmed using a subroutine.
3.
Enter your program into the computer and give it a test run.
4.
Edit your program if necessary.
Tutorial 7 CNC Tutorials and Exercises
Boxford DUET
Tutorial 7:
Mirror Images This tutorial demonstrates how a program written as a subroutine can be reflected about the X axis or about the Y axis or about both the X and the Y axes. It supports both linear and circular interpolation. Consider the shape shown in illustration A, which has been drawn in the sequence 12, 2-3, 3-4 and 4-1. 2
3
1
A
4
If the X co-ordinates are reflected with Y co-ordinates unchanged, the shape becomes: 2
1
B
3
4
with the 1-2, 2-3, 3-4 and 4-1 sequence maintained Alternatively, if the X co-ordinates are kept constant and the Y co-ordinates reflected, the outcome is: 4
3
2
C 1
Boxford DUET
Tutorial 7 CNC Tutorials and Exercises
If both the X and y co-ordinates are reflected the result becomes: 4
3
D 1
2
If a program which calls a subroutine containing the original shape is written, then any or all of the above variations may be implemented. The as programmed case is achieved by the usual method of calling the subroutine. The mirror facility is accomplished by inserting a line in the program after positioning the tool at the start of the cycle but prior to calling the subroutine. The entry is: G X Y
value 28 value 0 or 1 value either 0 or 1
For example To reflect the X co-ordinate with Y unchanged: Enter G28 with X = 1, Y = 0
B
To reflect the Y co-ordinate with X unchanged: Enter G28 with X = 0, Y = 1
C
To reflect both the X and the Y co-ordinates: Enter G28 with X = 1, Y = 1
D
To cancel the mirror facility: Enter G28 WITH X = 0, Y =0 Note: For mirror image programming incremental co-ordinates must be used.
Tutorial 7 CNC Tutorials and Exercises
Boxford DUET
Example
C
D
15
A
20
30
10
50
D' C' A' B'
B
10 30 50 80 Material: 15mm thick Plastic Slots: 5 wide x 3 deep Tool change at: X 0, Y 0
In the program for the above illustration, note that blocks S10 to S80 onwards are typed into the system immediately after block N40. 1.
Study the program.
2.
Enter the program into the computer.
3.
Simulate the machining process and compare the cutter movements with the program.
Boxford DUET
DRAWING NUMBER
NOTES
Tutorial 7 CNC Tutorials and Exercises
DUET PROGRAMMING SHEET-MILLING TITLE
TUT 7
N
G
N10
90
METRIC UNITS
N20
71
TOOL CHANGE
N30
M
SPINDLE ON POINT A
N40
03
CALL SUBROUTINE
N50
45
POINT B
N60
MIRROR IMAGE REFLECT X CO-ORDINATE Y UNCHANGED CALL SUBROUTINE
N70
91
N80
28
N90
CO-ORDINATES
X
Y
Z
0
0
25
30
20
1
J
I
50
20
1
0 7
S20 TI S80 REPEAT N100
28
ABSOLUTE PROGRAMMING
N110
90
START OF SHAPE C
N120
INCREMENTAL PROGRAMMING
N130
91
MIRROR IMAGE REFLECT Y CO-ORDINATE X UNCHANGED CALL SUBROUTINE
N140
28
N150
0
0
30
30
0
1
45
7 S20 TO S80 REPEATS
CANCEL MIRROR IMAGE
N160
28
ABSOLUTE PROGRAMMING
N170
90
START OF SHAPE D
N180
INCREMENTAL PROGRAMMING
N190
91
MIRROR IMAGE REFLECT BOTH X AND Y CO-ORDINATES
N200
28
2
0
0
50
30
1
1
FEED RATE
SPINDLE SPEED
F
S
2000 7
45
CANCEL MIRROR IMAGE
1 OF
PROGRAMMED BY
SEQUENCE PREP MISC No. FUNCTION FUNCTION
ABSOLUTE PROGRAMMING
SHEET No.
Tutorial 7 CNC Tutorials andTutorial Exercises 7
Boxford DUET
DRAWING NUMBER
NOTES
DUET PROGRAMMING SHEET-MILLING
G
N210
M
2 OF
CO-ORDINATES
X
Y
Z
45
J
I
FEED RATE
SPINDLE SPEED
F
S
7 S20 TO S80 REPEATS
CANCEL MIRROR IMAGE
N220
28
ABSOLUTE PROGRAMMING
N230
90
TOOL CHANGE
N240
05
END OF PROGRAM
N250
30
SUBROUTINE CREATE
S10
43
FEED TO DEPTH
S20
01
0
0
–3
100
SUBROUTINE SHAPE A INCREMENTAL
S30
01
– 10
0
0
100
S40
01
0
– 10
0
100
S50
01
10
–5
0
100
S60
01
0
15
0
100
0
0
3
S70 SUBROUTINE TERMINATE
S80
44
2
PROGRAMMED BY
SEQUENCE PREP MISC No. FUNCTION FUNCTION
N
CALL SUB ROUTINE
TUT 7
TITLE
SHEET No.
0
0
0
0
25
7
Boxford DUET
Tutorial 7 CNC Tutorials and Exercises
20
15
30
50
Exercise 7: Mirror Images
20 30 50 80 Material: 15mm thick Plastic Slots: 5 wide x 2 deep Tool change at: X 0, Y 0
For the component shown above: 1.
Write a program to machine the grooved triangles using the mirror image technique.
2.
Enter your program on the computer and simulate the cutting action.
3.
Edit your program if necessary. The manufacture of the component shown below uses the G86 and G87 canned cycles.
Tutorial 8 CNC Tutorials and Exercises
Boxford DUET
Further Canned Cycles Pitch Circle Drilling and Dish Milling The manufacture of the component shown below uses the G86 and G87 canned cycles.
80
6 x Ø 5 holes 5 deep on 40mm PCD 50
Tutorial 8:
Dished pocket Ø30, 5 deep Ø10 at bottom
Material: 15mm thick Plastic Tool change at: X 0, Y 0
G86 Canned Cycle Pitch Circle Diameter Drilling This code produces a series of holes on a circular pitch. The tool is positioned at a 2mm stand off point above the centre of a hole on the PCD on the previous line. Enter: X
number of holes to be drilled (must not be less than two)
Z
incremental distance from the face of the workpiece to the bottom of the hole the distance from the circle centre (incremental) to the first hole measured along the X axis
I J F
as the I value but measured along the Y axis Feed rate
Boxford DUET
Tutorial 8 CNC Tutorials and Exercises
G87 Canned Cycle Dish Milling This code will mill out a circular dish-shaped pocket. The dish is produced by cutting a series of concentric circular pockets starting at X diameter, with successive circles getting deeper as they reduce in diameter, until the last circle is at Y diameter and depth Z. The total number of circles is J. Increasing the number of cuts will produce a better dish but the time taken will be greater. Enter X Y Z I
the top diameter the bottom diameter of the dish The incremental distance from the face of the workpiece to the bottom of the dish
J
For a complete dish enter zero, or for hollow circles (an outline around the edge) enter a value is the number of cuts to produce the dish
F
the feed rate at which the dish is to be milled
The cycle is best used in two stages. For the first stage enter I = 0; this will rough out a pocket, leaving a stepped profile. On calling the code again for the second stage enter a value for I = 1; this will mill around the circumference of the circles, thus smoothing the profile. The program for the illustration shown earlier is shown on the following page. 1.
Study the program.
2.
Enter the program into the computer.
3.
Simulate the machining process and compare the cutter movement with the program.
4.
View the component in 3D.
Tutorial 8 CNC Tutorials and Exercises
Boxford DUET
DRAWING NUMBER
NOTES
DUET PROGRAMMING SHEET-MILLING TUT 8
TITLE
N
G
N10
90
METRIC UNITS
N20
71
X
03
N30
SPINDLE ON, Move to Centre of P.C.D. DRILL HOLES ON P.C.D.
N40
TOOL CHANGE
N60
05
TOOL CHANGE SPINDLE ON, Move to Centre of Pocket ROUGH MILL DISH
N70
06
N80
03
N90
FINISH MILL DISH
N100
PARK POSITION
N110
05
END OF PROGRAM
N120
30
N50
CO-ORDINATES
M
TOOL CHANGE ø5 DRILL
86
1 OF 1
PROGRAMMED BY
SEQUENCE PREP MISC No. FUNCTION FUNCTION
ABSOLUTE PROGRAMMING
SHEET No.
Y
Z
0
0
25
40
25
2
6
5
I
J
FEED RATE
SPINDLE SPEED
F
S
2000 0
20
2
5
80
0
0
25
40
25
2
87
30
10
5
0
5
80
87
30
10
5
1
5
80
0
0
25
2000
Boxford DUET
Tutorial 8 CNC Tutorials and Exercises
Exercise 8: Use of Canned Cycles Pitch Circle Drilling and Dish Milling
80
50
8 x Ø 5 holes 5 deep on 40mm PCD
25
Dished pocket Ø25, 5 deep Ø10 at bottom
Material: 15mm thick Plastic Tool change at: X 0, Y 0
For the component shown above: 1.
Write a program to machine
the holes on the P.C.D.
the dished pocket.
2.
Enter your program on the computer and simulate the cutting action.
3.
Edit your program if necessary.
Tutorial 9 CNC Tutorials and Exercises
Boxford DUET
Tutorial 9:
Subroutines, Mirror Images and Circular Interpolation
4
2
50 45
3
1 7
30
5 8
5
20
6
All grooves 15 radius 2 deep 5 wide
20 35 45 60 80 Tool change at: X 0, Y 0
The following program uses a subroutine which will mill a 90° arc of radius 15mm counter-clockwise and 2mm deep. It then uses the G28 Mirror Image routine to mill the other three arcs. The program is shown on the following page. 1.
Study the program.
2.
Key in the program and run the simulation.
3.
Compare the cutter movements with the program.
Boxford DUET
DRAWING NUMBER
NOTES
Tutorial 9 CNC Tutorials and Exercises
DUET PROGRAMMING SHEET-MILLING TUT 9
TITLE
G
M
ABSOLUTE PROGRAMMING
N10
90
METRIC UNITS
N20
71
TOOL CHANGE POSITION
N30
SPINDLE START
N40
OVER POINT 1
N50
SUBROUTINE CREATE
S10
FEED TO DEPTH
S20
01
MILL QUADRANT
S30
03
WITHDRAW TOOL
S40
SUBROUTINE TERMINATE
S50
44
SUBROUTINE CALL
N60
45
POINT 2
N70
ABOVE POINT 3
N80
CO-ORDINATES
X
0
Y
0
Z
J
I
SPINDLE SPEED
F
S
25 1500
60
30
1
43
9 -3 -15
15
125 15
3
90
9 45
45
20
30
1
0
N90
91
MIRROR IMAGE REFLECT X, Y UNCHANGED SUBROUTINE CALL
N100
28
CANCEL MIRROR IMAGE
N120
28
0
0
POINT 4
N130
90
35
45
ABOVE POINT 5
N140
20
20
INCREMENTAL PROGRAM
N150
91
MIRROR IMAGE REFLECT BOTH X AND Y SUBROUTINE CALL
N160
28
1
1
N110
1
45
45
2
FEED RATE
03
INCREMENTAL PROGRAM
N170
1 OF
PROGRAMMED BY
SEQUENCE PREP MISC No. FUNCTION FUNCTION
N
SHEET No.
9
1
9
125
Tutorial 9 CNC Tutorials and Exercises
Boxford DUET
DRAWING NUMBER
NOTES
DUET PROGRAMMING SHEET-MILLING TUT 9
TITLE
N N180
G 28
POINT 6
N190
90
ABOVE POINT 7
N200
INCREMENTAL PROGRAM
N210
91
MIRROR IMAGE REFLECT X, Y UNCHANGED SUBROUTINE CALL
N220
28
CANCEL MIRROR IMAGE
N240
POINT 8
N250
SPINDLE STOP. TOOL CHANGE
N260
END OF PROGRAM
N270
CO-ORDINATES
Y 0
Z
35
5
1
60
20
0
1
28
0
0
90
45
5
1
0
0
25
N230
M
X 0
45
05 30
2 OF
2
PROGRAMMED BY
SEQUENCE PREP MISC No. FUNCTION FUNCTION
CANCEL MIRROR IMAGE
SHEET No.
J
I
9
FEED RATE
SPINDLE SPEED
F
S
Boxford DUET
Tutorial 9 CNC Tutorials and Exercises
Exercise 9: Subroutines and Mirror Images
6
21
29
44
60
All grooves 15 radius 2 deep 5 wide
21 36 44 59 80 15mm thick Plastic Material: Tool change at: X 0, Y 0 5mm Slot Drill Tool used:
For the component shown above: 1.
Write a program to mill the curved slots using a subroutine and mirror images.
2.
Key in the program and run the simulation.
3.
Edit your program if necessary.
Tutorial 10 CNC Tutorials and Exercises
Boxford DUET
Tutorial 10:
Datum Shift and Jump to Line For programs with repetitive elements, and as an alternative to creating a subroutine (M43), a datum shift (G57) can be used in conjunction with Jump to Block (G25) and Return from Jump (G26). Details of the above codes are: G25 Jump to Block This code enables a section of a program to be executed again. There are two restrictions on the use of G25: (a)
a G25 loop must not be called from within a subroutine,
(b)
a subroutine must not be called from within a G25 loop.
Enter in the S column the line number to which the jump is to be made. G26 Return from Jump After using a G25 the program executes from the line specified in the S column until a G26 is encountered. The program then reverts to the line following that from where the G25 call was made. The G26 is only operative after a G25 loop has been called. At all other times it is transparent. G57 Datum Shift This code enables the X Y datum to be altered by an amount specified in the X and Y columns. Enter X value - new absolute X datum Enter Y value - new absolute Y datum Note: The Z datum cannot be altered with G57. G53 Cancel Datum Shift This code is used to cancel a G57 datum shift, i.e. it makes X and Y shift equal to zero. The above techniques are illustrated in the following example.
Tutorial 10 CNC Tutorials and Exercises
15
10
20
15
50
15
Boxford DUET
15 20 50 Material: Slots: Tool change at: Tool used:
80 15mm thick Plastic 5 wide x 2 deep X 0, Y 0 5mm Slot Drill
The program is shown on the following page. 1.
Study the program.
2.
Key in the program and run the simulation.
3.
Compare the cutter movements with the program.
Tutorial 10 CNC Tutorials and Exercises
Boxford DUET
DRAWING NUMBER
NOTES
DUET PROGRAMMING SHEET-MILLING TUT 10
TITLE
N
G
N10
90
METRIC UNITS
N20
71
TOOLPARK POSITION
N30
M
DATUM SHIFT TO X20 Y10
N40
SPINDLE START MOVE OVER NEW DATUM INCREMENTAL PROGRAMMING
N50
57
N60
91
FEED TO DEPTH
N70
01
CUT FIRST L SHAPE
N80
01
CUT FIRST L SHAPE
N90
01
RAPID TO CLEAR
N100
RAPID TO NEW POSITION
N110
ABSOLUTE PROGRAMMING
N120
90
RETURN FROM JUMP
N130
26
CANCEL DATUM SHIFT
N140
53
DATUM SHIFT TO X50 Y20
N150
57
JUMP TO BLOCK N60
N160
25
CANCEL DATUM SHIFT
N170
53
TOOL PARK
N180
STOP SPINDLE
N190
05
END OF PROGRAM
N200
30
03
1 OF 1
PROGRAMMED BY
SEQUENCE PREP MISC No. FUNCTION FUNCTION
ABSOLUTE PROGRAMMING
SHEET No.
CO-ORDINATES
X
Y
0
0
20
10
0
0
Z
I
J
FEED RATE
SPINDLE SPEED
F
S
25
2
-4 15
1500
125 125
15
125 4
-15
-15
-15
-15
50
20 60
0
0
25
Boxford DUET
Tutorial 10 CNC Tutorials and Exercises
25
50
25
Exercise 10: Datum Shift and Jump to Line
10
20
20 20 10 45 Material: Slots: Tool change at: Tool used:
80 15mm thick Plastic 5 wide x 2 deep X 0, Y 0 5mm Slot Drill
For the component shown above: 1.
Write a program to mill the L-shaped slots using the Datum Shift and Jump to Line codes.
2.
Key in the program and run the simulation.
3.
Edit your program if necessary.
OPERATIONS SHEET
DRAWING NUMBER OPERATIONS NUMBER
DUET OPERATIONS SHEET - MILLING TITLE OPERATION
SHEET No.
OF
MATERIAL SPINDLE FEED
TOOL FEED
TOOL REQUIRED
PROGRAMMING SHEET
DRAWING NUMBER
NOTES
DUET PROGRAMMING SHEET-MILLING
OF
PROGRAMMED BY
TITLE SEQUENCE PREP MISC No. FUNCTION FUNCTION
N
SHEET No.
G
M
CO-ORDINATES
X
Y
Z
I
J
FEED RATE
SPINDLE SPEED
F
S