Lec.5 CNC
Lec.5 CNC
sinaiuniversity.net
Lec. 5
Computerized
Numerical control
CNC
Prof. Dr. Saber
2
Abdrabbo
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)
% N55 Y1
:1005 N60 X3
N5 G90 G20 N65 X4
N10 M06 T7
N70 Y2
N15 M03 S1000
N75 Y3
N20 G00 X1 Y1
N25 Z0.25 N80 X3
N30 G81 X1 Y1 Z-0.25 R0.25 F3 N85 Y2
N35 Y2 N90 G00 Z1
N40 Y3 N95 X0 Y0
N45 X2 N100 M05
N50 Y2 N105 M30
G43 Tool Length Compensation (Plus)
Format: N_ G43 H_
14
Circular interpolations( G03)
15
G2/G3 programming
Two basic methods
I. J. K. Method or Radius method
• IJK Method
The I, J, K addresses are used to specify the
distances from the start of the arc to the
arc center coordinates in XYZ directions.
I. J. K. Values can be found by using the
following equations
– I = xc-xs
– J = yc-ys
– K = zc-zs
– Format:
– G02/G03 X Y Z I J K
Where X Y Z represent the end point of the arc
16
• Radius Method
• Requires two entry
parameters in the
command the XYZ end
point of the arc and the
radius
• G02/G03 Xx Yy Zz Rr
– Positive radii are less then
180º
– Negative radii are greater
than180º
17
18
19
Exercise
20
G90 X Y G91 X Y
Absolute Increment
P0 X0 Y0 P0 X0 Y0
P0-P1 X-20 Y-20 P0-P1 X-20 Y-20
P0-P2 X12 Y-20 P1-P2 X32 Y0
P0-P3 X20 Y-12 P2-P3 X8 Y8
P0-P4 X20 Y14 P3-P4 X0 Y26
P0-P5 X12 Y20 P4-P5 X-8 Y6
P0-P6 X-20 Y20 P5-P6 X-32 Y0
21
•G04 Dwell
22
23
M Codes
• M00 Program stop
• M01 Optional program stop
• M02 Program end
• M03 Spindle on clockwise
• M04 Spindle on counterclockwise
• M05 Spindle stop
• M06 Tool change
• M08 Coolant on
• M09 Coolant off
• M10 Clamps on
• M11 Clamps off
• M30 Program stop, reset to start
25
Part program
%(Radius method) %(I,J,k Method)
:1000
N05 G90 G20 :1000
N10 M06 T1 N05 G90 G20
N15 M03 S1200 N10 M06 T1
N20 G00 X2.0 Y0.0 Z0.125 N15 M03 S1200
N25 G01 Z-0.125 F5 N20 G00 X2.0 Y0.0 Z0.125
N30 X0.5 Y0.5 N25 G01 Z-0.125 F5
N35 Y3.0 N30 X0.5 Y0.5
N40 G02 X2.0 Y3.0 R0.75 N35 Y3.0
N45 G01 X3.5 N40 G02 X2.0 Y3.0 I0.75 J0.0
N50 Y0.5 N45 G01 X3.5
N55 G02 X3.0 Y0.0 R0.5 N50 Y0.5
N60 G01 X2.0 N55 G02 X3.0 Y0.0 I-0.5 j0.0
N60 G01 X2.0
26
Manual Part Programming Example
5”
2.5”
p4
p2 p3 p5
1”
(4, 4)
p1 Motion of tool:
p0 p1 p2 p3 p4 p5 p1 p0
p0 (2, 2)
27
1. Set up the programming parameters
5”
2.5”
p4
p2 p3 p5
1”
Programming in inches
5”
Use absolute coordinates
Feed in ipm
45°
N010 G70 G90 G94 G97 M04
(4, 4)
p1
Spindle speed in rpm
p0 (2, 2)
Spindle CCW
28
2. Set up the machining conditions
5”
2.5”
p4
p2 p3 p5
1”
Machine moves in XY-plane
Spindle speed
45°
N020 G17 G75 F6.0 S300 T1001 M08
(4, 4)
p1
Tool no.
p0 (2, 2)
Flood coolant ON
29
3. Move tool from p0 to p1 in straight line
5”
2.5”
p4
p2 p3 p5
Linear interpolation
1”
target coordinates
45°
(4, 4)
p1
p0 (2, 2)
30
4. Cut profile from p1 to p2
5”
2.5”
p4
p2 p3 p5
1”
Linear interpolation
5” target coordinates
p0 (2, 2)
5”
2.5”
p4 Linear interpolation
p2 p3 p5
target coordinates
1”
5”
y = 9 + 0.125 = 9.125
(6.5 - x)2 + 0.1252 = (1 - 0.125)2
x = 5.634
45° p3
(x, y)
(4, 4)
p1 (6.5, 9)
.125
p0 (2, 2)
1” 32
6. Cut along circle from p3 to p4
5”
2.5”
p4
p2 p3 p5
1”
5”
target coordinates
p0 (2, 2)
33
7. Cut from p4 to p5
5”
2.5”
p4
p2 p3 p5
1”
5”
Linear interpolation
(4, 4)
N070 G01 X9.302
p1
p0 (2, 2)
34
8. Cut from p5 to p1
5”
2.5”
p4
p2 p3 p5
1”
5”
Linear interpolation
p0 (2, 2)
35
9. Return to home position, stop program
5”
2.5”
p4
p2 p3 p5
1”
Linear interpolation
45°
end of data
(4, 4)
p1
N100 M00
Professor of Automatic
Control & Mechatronics