CNC Programming & Machining 2
CNC Programming & Machining 2
www.manpower.gov.om -7-
Turning Cycles
Part A
CNC PROGRAMMING & MACHINING II
PART A : TURNING CYCLES
1- Reminder:
One block
N G XY F S T M ;
Sequence Preparation Dimension Feed Spindle Tool Function end-
Auxiliary function word function Speed function auxiliary of-
No. function block
(EOB)
2- G00(Positioning):
Or
3- G01(Linear interpolation):
Each axes moves straightly as much as commanded data in commanded rate.
Or
G02 X … (U …) Z … (W …) R … F … ;
G01 X30.0 Z60.0 F0.3 ;
Z35.0 ;
G02 X40.0 Z30.0 I5.0 ;
(G02 U10.0 W-5.0 I5.0)
G01 X50.0 ;
Z0 ;
G03 X … (U …) Z … (W …) R … F … ;
N10 G90 ;
N20 G50 S2000 T0300 ;
N30 G96 S200 M03 ;
N40 G00 X0 Z3.0 T0303 M08 ;
N50 G42 G01 Z0 F0.2 ;
N60 G03 X20.0 Z-10.0 R10.0 ;
N70 G01 Z-50.0 ;
N80 G02 X100.0 Z-74.385 I40.0 K20.615 ; (G02 X100.0 Z-74.385 R45.0)
N90 G01 Z-125.0 ;
N100 G40 U2.0 W1.0 ;
N110 G00 X200.0 Z200.0 M09 T0300 ;
N120 M30 ;
N10 G90 ;
N20 G50 S2000 T0300 ;
N30 G96 S200 M03 ;
N40 G42 G00 X35.0 Z5.0 T0303 M08 ;
N50 G01 Z-20.0 F0.2 ;
N60 G02 X67.0 Z-36.0 R16.0 ; (G02 X67.0 Z-36.0 I16.0 K0)
N60 G01 X68.0 ;
N70 G03 X100.0 Z-52.0 R16.0 ; (G02 X100.0 Z-52.0 I0 K-16.0)
N80 G01 Z-82.0 ;
N100 G40 G00 X200.0 Z200.0 M09 T0300 ;
N110 M30 ;
O0000 ;
N10 (ø30 DRILL)
N20 G50 T0200 ;
N30 G97 S250 M03 ;
N40 G00 X0 Z5.0 T0202 M08 ;
N50 G01 Z-5.0 F0.07 ;
N60 W1.0 ;
N70 Z-40.0 F0.25 ;
N80 G00 Z5.0 ;
N90 Z-39.0 ;
N100 G01 Z-60.0 ;
N110 G00 Z10.0 ;
N120 X200.0 Z200.0 T0200 ;
N130 M01 ;
N140 (Outside diameter stock removal)
N150 G50 S1500 T0100 ;
N160 G96 S180 M03 ;
N170 G00 X94.0 Z5.0 T0101 M08 ;
N180 G01 Z-14.8 F0.27 ;
N190 G00 U2.0 Z0.5 ;
N200 G01 X28.0 F0.23 ;
N210 G00 X87.0 W1.0 ;
N220 G01 Z-14.8 F0.27 ;
N230 G00 U2.0 Z1.0 ;
N240 X80.5 ;
N250 G01 Z-14.1 ;
N260 G02 X81.9 Z-14.8 R0.7 ;
N270 G00 X100.5 W1.0
N280 G01 Z-29.8
N290 G00 U2.0 Z-1.0 ;
N300 G01 X60.5 F0.23 ;
N310 G00 X82.0 W1.0 ;
N320 Z-2.4 ;
N330 G01 X60.5 ;
N340 X72.9 ;
N350 G03 X80.5 Z-6.2 R3.8 ;
N360 G00 U2.0 Z5.0 ;
N370 X200.0 Z200.0 T0100 ;
N380 M01 ;
N390 (Inside diameter stock removal)
N400 G50 S1500 T0400 ;
N410 G96 S180 M03 ;
N420 G00 X34.5 Z3.0 T0404 M08 ;
N430 G01 Z-41.8 F0.27 ;
N440 G00 U-0.5 Z1.0 ;
N450 X39.5 ;
N460 G01 Z-15.0 ;
N470X34.5 Z-24.3 ;
N480 G00 Z10.0 ;
N490 X200.0 Z200.0 T0400 ;
N500 M01 ;
N510 (Out diameter finishing)
N520 G50 S1800 T0500 ;
N530 G96 S200 M03 ;
N540 G00 X63.0 Z5.0 T0505 M08 ;
N550 Z0 ;
N560 G01 X38.0 F0.2 ;
N570 G00 X60.0 Z3.0 ;
N580 G42 Z1.0 ;
N590 G01 Z-2.5 F0.2 ;
N600 X74.0 ;
N610 G03 X80.0 Z-5.5 R3.0 ;
N620 G01 Z-13.5 ;
N630 G02 X83.0 Z-15.0 R1.5 ;
N640 G01 X100.0 ;
N650 Z-30.0 ;
N660 X103.0 ;
N670 G40 G00 U2.0 W1.0 ;
N680 G00 Z10.0 ;
N690 X200.0 Z200.0 T0500 ;
N700 M01 ;
N710 (Inside diameter finishing)
N720 G50 S1800 T0600 ;
N730 G96 S200 M03 ;
N740 G00 X40.0 Z5.0 T0606 M08 ;
N750 G41 Z1.0 ;
N760 G01 Z-15.0 F0.2 ;
N770 X35.0 Z-24.33 ;
N780 Z-42.0 ;
N790 X29.0 ;
N800 G40 G00 Z10.0 ;
N810 X200.0 Z200.0 T0600 M09 ;
N820 M30 ;
Example 1:
When not using tool diameter compensation (R compensation a and b should be
calculated)?
Example 2:
When using tool diameter compensation?
You do not have to calculate R compensation a and b.
If a position and b position are given on the program, the tool performs
automatically R compensation and moves to the next progressing
direction.
Direction of imaginary seen from the center of radius is decided by the cutting
direction of tool during the cutting. Therefore, it should be set as much as compensation
volume.
Direction and number of imaginary are decided among the following eight types.
Example 1:
(G70, G71)
N10 G50 S1500 T0101 ;
N20 G96 S180 M03 ;
N30 G00 X85.0 Z5.0 M08 ;
N40 Z0 ;
N50 G01 X-1.6 F0.25 ;
N60 G00 X83.0 Z2.0 ;
N70 NG71 U3.0 R1.0 ;
N80 G71 P20 Q30 U0.5 W0.1 F0.27 ;
N90 G42 G00 X30.0 ; G71 CYCLE CUTTING FEED
N100 G01 Z-20.0 F0.17 ;
G70 CYCLE CUTTING FEED
N110 X40.0 Z-40.0 ;
N120 Z-60.0 ;
N130 X50.0 Z-70.0 ;
N140 150 Z-90.0 ;
N150 X60.0 Z-110.0 ;
N160 Z-140.0 ;
N170 X80.0 ;
N180 G40 ;
N190 G70 P20 Q30 ; (When using the same bite)
N200 G00 X200.0 Z200.0 T0100 ;
N210 M30 ;
Example 2:
Stock Removal in Turning(G71) (Type I)
G72 W ( ¡ d) R(e) ;
G72 P_ Q_ U( ¡ u) W( ¡ w) F ;
Example 1:
Example 2:
Stock Removal in Pacing(G72)
Example 2:
Pattern Repeating(G73)
Example :
While it has the same function with G74, X and Z are exchanged. If there is one
groove, values of Z and P can be omitted at the same time.
Example 1:
Example 2:
Example 3:
Example 1:
G30 U0 W0 ;
G50 S2000 T0100 ;
G96 S200 M03 ;
G00 X61.0 Z2.0 T0101 M8 ;
G90 X55.0 W–42.0 F0.25 ;
X50.0 ;
X45.0 ;
X40.0 ;
Z-12.0 R-1.75 ;
Z-26.0 R-3.5 ;
Z-40 R-5.25 ;
G30 U0 W0 ;
M30 ;
Example 2:
G30 U0 W0 ;
G50 S2000 T0100 ;
G96 S200 M03 ;
G00 X56.0 Z2.0 T0101 M08
;
G90 X51.0 W-32.0 F0.25 ;
X46.0 ;
X41.0 ;
X36.0 ;
X31.0 ;
X30.0 ;
G30 U0 W0 ;
M30 ;
Example 3:
Examples 1:
G30 U0 W0 ;
G50 S1000 T0100 ;
G97 S1000 M03 ;
G00 X70.0 Z5.0
T0101 M08 ;
G92 X49.4 Z–32.0 R–
6.166 F1.5 ;
X49.0 ;
X48.7 ;
X48.5 ;
-
G30 U0 W0 ;
M30 ;
Example 2:
G30 U0 W0 ;
G50 S1000 T0100 ;
G97 S1000 M03 ;
G00 X60.0 Z5.0 T0101
M08 ;
G92 X49.5 Z–30.0 F1.5 ;
X49.2 ;
X48.9 ;
X48.7 ;
-
-
G30 U0 W0 ;
M30 ;
Example 3:
N10 G97 S1500 M03 ;
T0300 ;
G00 X30.0 Z5.0 T0303 ;
G92 X19.5 Z-15.0 F2.0 ;
X19.2 ;
X18.9 ;
X18.6 ;
X18.4 ;
G00 X50.0 ;
Z-25.0 S1000 ;
G92 X39.5 Z-50.0 F2.0 ;
X39.2 ;
X38.9 ;
X38.6 ;
X38.4 ;
G00 X200.0 Z200.0 T0300 ;
M30 ;
Example 4:
Example 1:
G30 U0 W0 ;
G50 S2000 T0100 ;
G96 S200 M03 ;
G00 X85.0 Z2.0 T0101
M08 ;
G94 X40.0 Z–2.0 F0.2
Z–4.0 ;
Z–6.0 ;
Z–8.0 ;
Z–10.0 ;
Z–12.0 ;
Z–14.0 ;
Z–16.0 ;
Z–18.0 ;
Z-19.7 ;
Z–20.0 ;
G30 U0 W0 ;
M30 ;
Example 2:
N10 G50 S2500 ;
G96 S180 M03 ;
T0100 ;
G00 X55.0 Z2.0 T0101 ;
G94 X15.0 Z-2.0 F0.2 ;
Z-4.0 ;
Z-6.0 ;
Z-8.0 ;
G00 X200.0 Z200.0 T0100 ;
M30 ;
Example 3:
Example:
G96 S100 ;
Cutting speed is 100m/min
G97 S100 ;
Rotating time of main spindle is 100rpm
Example:
G98 G01 Z100.0 F50.0 ;
Feed rate of tool is 50mm per minute.
G97 G01 Z10.0 F0.3 ;
Feed rate of tool is 0.3mm per rotation of main spindle.
Example 1:
Example 2:
ACTIVITY
www.manpower.gov.om
Chapter 1
-53-
CNC Programming & Machining II
CNC Programming & Machining II
Example 3:
www.manpower.gov.om
Chapter 1
ACTIVITY
-54-
CNC Programming & Machining II
CNC Programming & Machining II
Example 4:
ACTIVITY
www.manpower.gov.om
Chapter 1
-55-
CNC Programming & Machining II
CNC Programming & Machining II
Example 5:
www.manpower.gov.om
Chapter 1
ACTIVITY
-56-
CNC Programming & Machining II
CNC Programming & Machining II
Example 6:
ACTIVITY
www.manpower.gov.om
Chapter 1
-57-
CNC Programming & Machining II
CNC Programming & Machining II
Example 7:
www.manpower.gov.om
Chapter 1
ACTIVITY
-58-
CNC Programming & Machining II
CNC Programming & Machining II
Example 8:
ACTIVITY
www.manpower.gov.om
Chapter 1
-59-
CNC Programming & Machining II
CNC Programming & Machining II
Example 9:
www.manpower.gov.om
Chapter 1
ACTIVITY
-60-
CNC Programming & Machining II
CNC Programming & Machining II
Example 10:
ACTIVITY
www.manpower.gov.om
Chapter 1
-61-
CNC Programming & Machining II
CNC Programming & Machining II
Example 11:
www.manpower.gov.om
Chapter 1
ACTIVITY
-62-
CNC Programming & Machining II
CNC Programming & Machining II
Example 12:
ACTIVITY
www.manpower.gov.om
Chapter 1
-63-
CNC Programming & Machining II
CNC Programming & Machining II
Example 13:
www.manpower.gov.om
Chapter 1
ACTIVITY
-64-
CNC Programming & Machining II
CNC Programming & Machining II
Example 14:
ACTIVITY
www.manpower.gov.om
Chapter 1
-65-
CNC Programming & Machining II
CNC Programming & Machining II
www.manpower.gov.om
Chapter 1
Technical Guide
ACTIVITY
-66-
CNC Programming & Machining II
CNC Programming & Machining II
Cutting Conditions:
ACTIVITY
www.manpower.gov.om
Chapter 1
-67-
CNC Programming & Machining II
CNC Programming & Machining II
ACTIVITY
Cutting time of thread process (For thread processing with the S 45 C):
Part B
CNC PROGRAMMING & MACHINING II
PART B : MILLING CYCLES
1- Reminder:
1-1- G-Code list:
STANDARD G CODE FUNCTION
G00 Rapid Linear Positioning
G01 Linear Feed Interpolation
G02 CW Circular Interpolation
G03 CCW Circular Interpolation
G04 Dwell
G12 CW Circular Pock Milling (Yasnac)
G13 CCW Circular Pock Milling (Yasnac)
G17 XY Plane Selection
G18 ZX Plane Selection
G19 YZ plane Selection
G20 Input In Inches
G21 Input In Millimeters
G22 Stored Stroke Limit ON
G23 Stored Stroke Limit OFF
G27 Reference Point Return Check
G28 Return To Reference Point
G29 Return From Reference Point
G30 Return To 2nd, 3rd and 4th Ref. Point
G31 Skip Cutting
G33 Thread Cutting
G40 Cutter Compensation Cancel
G41 Cutter Compensation Left
G42 Cutter Compensation Right
G43 Tool Length Compensation + Direction
G44 Tool Length Compensation - Direction
G45 Tool Offset Increase
G46 Tool Offset Double
G47 Tool Offset Double Increase
G48 Tool Offset Double Decrease
G49 Tool Length Compensation Cancel
Absolute Dimensioning:
In the absolute system all
dimensions refer to the origin (zero
point) of the coordinate system, which
is also called the dimensioning
reference point.
Example:
N085 G90 ;
N090 G00 X+30. Y+30. Z+2. ;
N095 G01 Z-6. ;
N100 G01 X+110. Y+75. ;
Incremental Dimensioning:
Contrary to the absolute system,
the incremental dimensioning system
is based on specifying the distance
between a current point and its
preceding point on an axis. Because in
this system a sequence of additive
dimensions is produced, it is called
incremental.
Example:
Rapid traverse:
Examples:
Examples:
N085 G90 ;
N090 G00 X+30. Y+30. Z+2. ;
N095 G01 Z-6. ;
N100 G01 X+110. Y+75. ;
For a 3-axis milling machine with vertical spindle position the standard
machining plane is the XY-plane. In the below table the G-commands are listed with
their corresponding machining planes and down feed axes.
Examples:
N085 G90 ;
N090 G00 X+55. Y+35. Z+2. ;
N095 G01 Z-5. ;
N100 G02 X+95. Y+75. I+30. J+10. ;
Examples:
N085 G90 ;
N090 G00 X+55. Y+25. Z+2.;
N095 G01 Z-5.;
N100 G03 X+100. Y+70. I+15. J+30.;
Format
G81 X_ Y_ Z_ R_ L_ F_
F: Feed rate in inches (or mm) per minute
L: Number of holes to drill if G91 (Incremental Mode) is used
R: Position of the R plane (position above the part)
X: X-axis motion command
Y: Y-axis motion command
Z: Position of the Z-axis at the bottom of hole
Example:
(T1 is a drill) ;
G81 Z-1.5 F15. R.1 (Begin G81 & drill 1st hole) ;
G53 Y0 (Y home) ;
Format
G81 X_ Y_ Z_ R_ P_ L_ F_
F: Feed rate in inches (or mm) per minute
L: Number of holes if G91 (Incremental Mode) is used
P: The dwell time at the bottom of the hole
R: Position of the R plane (position above the part)
X: X-axis location of hole
Y: Y-axis location of hole
Z: Position of bottom of hole
Example:
Program Example Description
%
O1234 (Sample program)
T1 M06; (Tool #1 is a 0.5” x 90-degree spot drill)
G90 G54 G00 X.565 Y-1.875 S1275 M03;
G43 H01 Z0.1 M08;
G82 Z-0.175 P.3 R0.1 F10. ; (90-degree spot drill; the depth is)
X1.115 Y-2.750 ; (half of the chamfer diameter)
X3.365 Y-2.875 ;
X4.188 Y-3.313 ;
X5.0 Y-4.0 ;
G80 G00 Z1.0 M09 ;
Format
G83 X_ Y_ Z_ R_ P_ Q_ L _ I_ J_ K_ F_
F: Feed rate in inches (or mm) per minute
I: Size of first cutting depth
J: Amount to reduce cutting depth each pass
K: Minimum depth of cut
L: Number of holes if G91 (Incremental Mode) is used
P: Pause at end of last peck, in seconds (Dwell)
Q: Cut depth, always incremental
R: Position of the R plane (position above the part)
X: X-axis location of hole
Y: Y-axis location of hole
Z: Position of the Z-axis at the bottom of hole
Example:
Program Example Description
T2 M06 ; (Tool #2 is a 0.3125” stub drill)
G90 G54 G00 X0.565 Y-1.875 S2500 M03 ;
G43 H02 Z0.1 M08 ;
G83 Z-0.720 Q0.175 R0.1 F15. ; (Drill point is 1/3 of the drill diameter)
X1.115 Y-2.750 ;
X3.365 Y-2.875 ;
X4.188 Y-3.313 ;
X5.0 Y-4.0 ;
G80 G00 Z1.0 M09 ;
Format
G84 X_ Y_ Z_ R_ L _ J_ F_
F: Feed rate in inches (or mm) per minute
J: Retract Multiple (Example: J2 will retract twice as fast as the cutting speed)
L: Number of holes if G91 (Incremental Mode) is used
R: Position of the R plane (Position above the part)
X: X-axis location of hole
Y: Y-axis location of hole
Z: Position of the Z-axis at the bottom of hole
Example:
Program Example
T3 M06 ; (Tool #3 is a 3/8-16 tap)
G90 G54 G00 X0.565 Y-1.875 S900 M03 ;
G43 H03 Z0.2 M08 ;
G84 Z-0.600 R0.2 F56.25 ; (900 rpm divided by 16 tpi = 56.25 ipm)
X1.115 Y-2.750 ;
X3.365 Y-2.875 ;
X4.188 Y-3.313 ;
X5.0 Y-4.0 ;
G80 G00 Z1.0 M09 ;
G28 G91 Y0 Z0 ;
M30 ;
%
Format
G85 X_ Y_ Z_ R_ L _ F_
F : Feed rate in inches (or mm) per minute
L : Number of holes if G91 (Incremental Mode) is used
R : Position of the R plane (position above the part)
X : X-axis location of holes
Y : Y-axis location of holes
Z : Position of the Z-axis at the bottom of hole
Format
G12/G13 I_ K_ Q_ F_ Z_ D_
D: Tool radius or diameter selection
I: Radius of first circle (or finish if no K). I value must be greater than Tool Radius,
but less than K value.
K: Radius of finished circle (if specified)
L: Loop count for repeating deeper cuts
Q: Radius increment, or step over (must be used with K)
F: Feed rate in inches (mm) per minute
Z: Depth of cut or increment
Example 1:
Example 2: (multiple-pass)
Description
O4000 (0.500 entered in the Radius/Diameter offset column)
T1 M06 ; (Tool #1 is a 0.500” diameter end mill)
G00 G90 G54 X0 Y0 S4000 M03 ;
G43 H01 Z.1 M08 ;
G01 Z0 F30.;
G13 G91 Z-.5 I.400 K2.0 Q.400 L4 ;
D01 F20. ;
G00 G90 Z1.0 M09 ;
G28 G91 Y0 Z0 ;
M30 ;
Example 1:
Example 2:
Example 3:
Example 4:
CNC PROGRAMMING & MACHINING II
Example 5:
www.manpower.gov.om
Chapter 3
ACTIVITY
-90-
CNC PROGRAMMING & MACHINING II
CNC PROGRAMMING & MACHINING II
Example 6:
ACTIVITY
www.manpower.gov.om
Chapter 3
-91-
CNC PROGRAMMING & MACHINING II
CNC PROGRAMMING & MACHINING II
Example 7:
www.manpower.gov.om
Chapter 3
ACTIVITY
-92-
CNC PROGRAMMING & MACHINING II
CNC PROGRAMMING & MACHINING II
Example 8:
ACTIVITY
www.manpower.gov.om
Chapter 3
-93-
CNC PROGRAMMING & MACHINING II
CNC PROGRAMMING & MACHINING II
ACTIVITY
Example 9:
Example 10:
ANSWER KEY
Example 1:
POINT A B C D
X 20 20 60 60
Y 15 35 35 15
O100
N10 G90 ;
N20 G71 ;
N140 M30 ;
O200
N10 G90 ;
N20 G71 ;
N40 X1 Y54 Z2 ;
N120 M06 I2 J 6 ;
N280 M30 ;
CNC PROGRAMMING & MACHINING II
O400
N10 G90 ;
N20 G71 ;
N30 X0 Y0 Z25 ;
N70 M06 I2 J5 ;
N120 M30 ;
Example 5:
……
N10 T10 D10 ;
N20 G00 G90 G43 Z25 S1000 M03 M08 M41 ;
N30 G81 G98 X15 Y15 Z2 I-20 F200 ;
N40 X85 ;
N50 Y85 ;
N60 X15 ;
N70 X50 Y75 ;
N80 G93 I50 J50 ;
N90 G91 Q-45 N3 ;
N100 G80 ;
N110 G00 G90 G44 Z30 ;
N120 M30 ;
Example 6:
……
N10 T06 D06 ;
N20 G00 G90 G43 Z25 S1800 M03 M08 M41 ;
CNC PROGRAMMING & MACHINING II
Example 8:
……
N10 T12 D12 ;
N20 G00 G90 G43 Z25 S300 M03 M08 M41 ;
N30 G93 I0 J0 ;
N40 G84 G99 R30 Q180 Z10 I-20 K150 F450 ;
N50 G91 Q120 N2 ;