UNIT 7 - CNC - Lecture 3 - Programming
UNIT 7 - CNC - Lecture 3 - Programming
CNC Programming
Proving a Part Program
Study the part
Identify the machine
tool(s)
Identify operations and
tooling
Determine process
parameters
Develop part program
Simulate tool path
Dry run
Cut single part
CNC Programming
CNC Programming
Motion Statements
G00 Linear Movement (rapid)
G01 Linear Movement (feed)
G02 Circular Movement (cw feed)
G03 Circular Movement (ccw feed)
CNC Programming
G00 Linear Movement (rapid)
Y
55
60
10
(0, 0)
24
CNC Programming
+Z
+
X
Tool at (25, 35)
G00 X0 Z35
G00 X0 Z0
CNC Programming
Initial Diameter = 10
mm
Final Diameter = 6 mm
Depth of cut = 1 mm
Width of cut = 8 mm
G00 X4 Z1
G01 Z-8
G00 X5 Z1
G00 X 3
G01 Z-8
G00 X4 Z1
CNC Programming
(0, 55)
Y
30
35
18
X
G01
G01
G01
G01
G01
G01
G01
X30 Y55
X30 Y20
X48 Y20
X48 Y0
X106 Y0
X106 Y28
X72 Y28
34
28
20
58
G01
G01
G01
G01
G01
G01
G01
X30
Y20
X48
Y0
X106
Y28
X72
G91
G01
G01
G01
G01
G01
G01
G01
X30
Y-35
X18
Y-20
X58
Y28
X-34
CNC Programming
Preparatory NC Codes
G00
G01
G02
G03
G70
G71
G94
G95
G96
G97
G90
G91
G17 XY Plane
G18 ZX Plane
G19 YZ Plane
CNC Programming
G02 Circular Movement (Clockwise)
Y
G02
X34 Y0 I0 J-24
G02 X34 Y0 R24
10
24
(0, 0)
CNC Programming
G02 Circular Movement (Clockwise)
CNC Programming
Miscellaneous NC Codes
M02
M03
M04
M05
M06
M07
M09
End of program
Clockwise rotation of spindle
Counter-clockwise rotation of spindle
Stop rotation of main spindle
Tool change
Coolant on
Coolant of
CNC Programming
N0010
N0011
N0012
N0013
N0014
N0015
G90
G01
G01
G91
G01
G01
X1 Y2
X2 Y2
X1
X1 Y1
(4,3)
(1,2
)
(0,0)
(2,2
)
(3,2)
CNC Programming
(400, 500,
50)
Linear Movement
(rapid)
All dimensions in mm
Depth of hole = 4 mm
Hole Diameter = 5 mm
60
10
0
80
50
20
30
40
15
80
G00
G01
Linear Movement (feed)
G02
Circular Movement (cw)
G03
Circular Movement
(ccw)
G70
Inch units
G71
Metric units
G94
Feed in mm/min
G95
Feed in mm/rev
G96
Speed in mm/min
G97
Speed in RPM
G90
Absolute dimensions
G91
incremental dimensions
G17 XY Plane
G18 ZX Plane
G19 YZ Plane
M02
End of program
M03
Clockwise rotation of
spindle
M04
Counter-clockwise
rotation of spindle
M05 Stop rotation of main
spindle
M06 Tool change
CNC Programming
N10 G71 G90 G94 G97 M03 M07 S500
N20 G01 X90 Y10 F200
N30 G02 X90 Y10 R20
N40 G00 X100 Y10
N50 G00 X80 Y0
Why N10, N20, N30 & not N11,
N60 G91
N12, N13 etc?
N70 G01 X90 Y120
N80 G03 X40 Y0 R15
N90 G00 X20 Y20
N100 M05 M09
N110 M02
CNC Programming
Depth of cut = 3 mm
50
31
40
60
50
60
CNC Programming
Part
profile
Tool Path
CNC Programming
Cutter Radius Compensation
CNC Programming
Cutter Radius Compensation
CNC Programming
Cutter Radius Compensation
G40 Cutter Radius compensation CANCEL
CNC Programming
CNC Programming
CNC Programming
MODAL
Modal code is efective until
cancelled by another
command
NON MODAL
Examples:
G40
G41
G91
G71
G01
G02
G00
G03
CNC Programming
Mirror Images
Fanuc Controller
MAHO Controller
CNC Programming
Mirror Images
M21 Mirror image on X axisY
(20,10
)
(-20,5)
(5,10)
(5,5)
(5,10
)
(5,5
)
(20,1
0)
(20,
5)
X
CNC Programming
Mirror Images
M22 Mirror image on Y axisY
(5,10
)
(20,1
0)
(5,5
)
(5,-5)
(20,
X
5)
(20,5)
20,10)
CNC Programming
Repetitions
G25 N-G25 N-- L--
CNC Programming
Subroutines
A SET OF CODES WITH A DIFFERENT NAME WRITTEN AT THE END OF
THE MAIN CODE
P0001
N5 G90 G71 G17
N10 G0 X20 Y20
N15 Z5
N20 PPP20
N 25 G0 X60 Y20
N30 PPP 20
N35 G0 X60 Y60
N40 PPP20
N45 G0 X20 Y60
N50 PPP20
N55 G0 Z100
N60 M02
PPP20
N5 G91
N10 G1 Z-2 F200
N15 X20
N20 Y20
N25 X-20
N30 Y-20
N35 Z5
N40 G90
CNC Programming
Mirror Images
CNC Programming
Canned Cycles
Motion repeated a number of times
Common motions irrespective of the position of the
tool
Example: Drilling
Position the drill bit at the center of the hole and a
little above the surface Rapid movement
Move to the required depth in feed motion
Return to the starting position
CNC Programming
Canned Cycles
G81 Drilling
G82 Counter sinking
G82 Deep Hole drilling
G84 Tapping
G85,86,87,88,89 Boring
L95 Rough Turning
L97 Thread Cutting
CNC Programming
Canned Cycles
CNC Programming
G81 - Drilling
Cycles
50
N20 X 50 Y 80
80
80
35
40