CNC Programming
Exercise 1
Exercise 2
Peck Drilling and High speed drilling
G83 X_ Y_ Z_ R_ Q_ F_ K_ ;
G73 X_ Y_ Z_ R_ Q _F_ K_;
X Y Hole position data
Z Z-depth (feed to Z-depth starting from R plane)
R Position of the R plane
Q Depth of cut for each cutting feed (depth of each peck)
F Cutting feed rate
K Number of repeats (if required)
Exercise 3
G70 Bolt Hole Circle Format
G70 I J L
I = Radius of the bolt hole circle
(+CCW / CW).
J = Starting angle of first hole (
0 to 360 CCW from horizontal
at the 3 oclock position).
L = Number of evenly spaced
holes around bolt hole circle.
O0009
N1 T1 M06
N2 G90 G54 G00 X2. Y-1.5 (Center
position of bolt hole circle)
N3 S1451 M03
N4 G43 H01 Z1. M08
N5 G81 G99 Z-0.45 R0.1 F8. L0
N6 G70 I1. J0. L8
N7 G80 G00 Z1. M09
N8 G53 G49 Z0. M05
N9 M30
G71 Bolt Hole Arc Format
G71 I J K L
I Radius of the bolt hole arc
J Starting angle of first hole ( 0 to
360 CCW from horizontal at the 3
oclock position).
K Angular spacing between holes
(+ or -)
L Number of evenly spaced holes
around bolt hole arc.
O005
N10 T2 M06
N20 G90 G54 G00 X2. Y-1.5
N30 S1451 M03
N40 G43 H02 Z1. M08
N50 G81 G99 Z-0.45 R0.1 F8. L0
N60 G71 I1.0 J15. K30. L7
N70 G80 G00 Z1. M09
N80 G53 G49 Z0. M05
N90 M30
Exercise 4
Exercise 5
Exercise 6
Exercise 7
Fanuc G84 Tapping Cycle
G84 X... Y... Z... R... P... F... K...
Parameter
Description
Hole position in x-axis.
Hole position in y-axis.
Depth, tapping from R-plane to Zdepth.
Position of the R plane.
Dwell time.
Number of cycle repetitions (if
required)
Feed rate.
Working
Tap tool
Fanuc G85 Boring Cycle
G85 X... Y... Z... R... F... K...
Parameter
Description
Hole position in x-axis.
Hole position in y-axis.
Depth, tapping from R-plane to Zdepth.
Position of the R plane.
Number of cycle repetitions (if
required)
Feed rate.
Working
Fanuc G76 Fine Boring Cycle CNC Mill
G76 X Y Z R Q P F K
Parameter
Description
XY
Hole position data
Absolute hole depth position
Position of the R plane
Shift amount at the bottom of a hole
Dwell time at the bottom of a hole
Cutting feedrate
Number of repeats (if required)
Working
Fanuc G72.1 Rotational Copy
G72.1 P... L... X... Y... R...
Parameter
Description
Subprogram number
Number of times the operation is
repeated
Center of rotation on the X axis
Center of rotation on Y axis
Angular displacement (a positive
value indicates a counter clockwise
angular displacement. Specify an
incremental value.)
Commands that must not be specified
Within a program that performs a rotational copy, the following must
not be specified:
Command for changing the selected plane (G17 to G19)
Command for specifying polar coordinates (G16)
Reference position return command(G28)
Axis switching
Coordinate system rotation (G68)
scaling (G51)
programmable mirror image (G51.1)/M70-81
Exercise 1
Main program
O1000
N10 G90 G00 X80. Y100
N20 Y50
N30 G01 G17 G42 X43.301 Y25. D01 F100
N40 G72.1 P1100 L3 X0 Y0 R120
N50 G90 G40 G01 X80 Y50
N60 G00 X80 Y100
N70 M30
Sub program
O1100 G91 G03 X-18.301 Y18.301 R50
N100 G01 X-5 Y50
N200 G03 X-40 I-20
N300 G01 X-5 Y-50
N400 G03 X-18.301 Y-18.301 R50
N500 M99
Exercise 2
Fanuc G72.2 Linear Copy
G72.2 P... L... I... J...
Parameter
Description
Subprogram number
Number of times the operation is
repeated
Shift along X-axis
Shift along Y-axis
Exercise 1
O3000 ;
N10 G90 G00 X-30 Y0
N20 X0
N30 G01 G17 G41 X30. D01 F100
N40 Y20
N50 X40
N60 G72.2 P3100 L3 I 90.0 J0
N70 G90 X310 Y0
N80 X0
N90 G40 G00 X-30.0
N100 M30
O3100
G91 G01 X20
N100 Y30
N200 G02 X40 I 20
N300 G01 Y-30
N400 X30
N500 M99
Turning (Canned Cycles single cut)
A single cut canned cycle executes a sequence of motions required to
perform a cut rapid approach to the start position, cutting motion,
and rapid departure.
A single block replaces 4 motions - 1 cutting and 3 rapid.
Operations normally involve the removal of material in multiple cuts,
so these cycles are seldom used.
Straight turning/ Plain turning
Format
G90 X_ Z_ F_
X = X coordinate of end point of cut, absolute
Z = Z coordinate of end point of cut, absolute
F = Feed rate
----G00 X82.0 Z2.0 (RAPID TO INITIAL POSITION)
G90 X75.0 Z-50.0 F0.2 (CUT TO DIAMETER 75)
X70.0 (CUT TO DIAMETER 70)
G00 Z2
---------
Taper turning
Format
G90 X_ Z_ R_ F_
X = X coordinate of end point of cut, absolute
Z = Z coordinate of end point of cut, absolute
R = Taper amount, radial.
F = Feed rate
The cut starts at point P1, ends at point P2.
R = (Diameter at start of cut Diameter at end of cut) / 2
R must be specified with the proper sign.
Raw material is a cylinder of 80 diameter.
--------G00 X67 Z1
G90 X65 Z-50 R-2.5 F0.25
--------Note that the R value has a small approximation here
since the cut is starting at Z1 instead of Z0.
Straight facing
Format
G94 X_ Z_ F_
X = X coordinate of end point of cut
Z = Z coordinate of end point of cut
F = Feed rate
Example
--------G00 X122.0 Z1.0 (RAPID TO INITIAL POSITION)
G94 X70.0 Z-3.0 F0.25(FACE TO Z-3)
Z-6.0 (FACE TO Z-6)
---------
Taper facing
Format
G94 X_ Z_ R_ F_
X = X coordinate of end point of cut
Z = Z coordinate of end point of cut
R = Taper amount
F = Feed rate
The cut starts at point P1, ends at point P2.
R = Z coordinate of start point Z coordinate of end point.
R must be specified with the proper sign.
Example
--------G00 X122.0 Z1.0
G94 X70.0 Z-6.0 R-2.0 F0.2
---------
G02 / G03 - Circular interpolation
Motion along a circular arc at a programmed linear speed, the feed
rate.
G02 moves along a Clockwise (CW) arc, G03 moves along a
Counterclockwise (CCW) arc.
An arc can be programmed using its radius or the coordinates of its
center point.
Format (Using arc radius):
G02/03 X__ Z__ R__ F__
X, Z are the destination
coordinates
R is the radius
F is the feed rate
Using arc center coordinates:
G02/03 X__ Z__ I__ K__ F__
X, Z are the destination coordinates
I and K are the relative distance
from the arc start point to the arc
center
I = X coord. of start point - X coord.
of center
K = Z coord. of start point - Z coord.
of center
I and K must be written with their
signs
Arc radius programming:
Motion from P2 to P3, then to P4
G02 X25 Z-10 R5 F0.25
G03 X39 Z-17 R7
Arc center programming:
Motion from P2 to P3, then to P4
G02 X25 Z-10 I 5 K0 F0.15
G03 X39 I 0 K-7
G32 Threading motion
Format
G32 X__ Z__ F__
X, Z are the destination coordinates
F is the lead of the thread.
G00 X19.6 Z2
G32 Z-8 F2.0
G00 X22
Z2
G00 X19.2 Z2.0
G32 Z-8 F2.0
G00 X22
Z2
G00 X18.8 Z2
G32 Z-8 F2.0
G00 X22
Z2
TNRC (Tool radius compensation)
--------G00 G42 X20 Z2
G01 Z0
Z-10
X40 Z-15
Z-30
G00 G40 X60
---------
Axial drilling / grooving cycle - G74
G74 R_
G74 Z_ Q_ F_
R = Retract amount at each peck
Z = Z coordinate of hole bottom
Q = Peck depth, in microns
F = Feed rate
To drill the hole in a single pass (without pecking), set Q equal
to the depth of the hole.
--------G00 X0 Z2
G74 R0.5
G74 Z-30 Q6000 F0.15
G00 X50
---------
Radial drilling / grooving cycle - G75
G75 R_
G75 X_ P_ F_
R = Retract amount after each
peck, radial distance
X = X coordinate of groove bottom
P = Peck depth, radial distance in
microns
F = Feed rate
Example
--------G00 X54.0 Z-20.0
G75 R0.5
G75 X30.0 P3000 F0.1
G00 X100.0 Z50.0
---------
Turning Cycle - G71
Format
G71 U (d) R (e)
G71 P (n) Q(n) U(u) W(w) F(f) S(s) T(t)
N (n) _ _ _ _
_______
_______
N (n)_ _ _ _
d = Depth of cut
e = Retract amount
n = Number of the first block of the shape
n = Number of the last block of the shape
u = Finishing allowance in X
w =Finishing allowance in Z
f = Feed rate
s = Spindle speed
t = Tool number
Facing Cycle - G72
Format
G72 W (d) R (e)
G72 P (n) Q(n) U(u) W(w) F(f) S(s) T(t)
N (n) _ _ _ _
_______
_______
N (n) _ _ _ _
d = Depth of cut
e = Retract amount
n = Number of the first block of the shape
n = Number of the last block of the shape
u = Finishing allowance in X
w =Finishing allowance in Z
f = Feed rate
s = Spindle speed
t = Tool number
Multipass Turning Cycle - G73
Format
G73 U (i) W (k) R (d)
G73 P (n) Q (n) U (u) W (w) F (f) S(s) T (t)
N (n)_ _ _ _ _
________
________
N (n)_ _ _ _ _
i = Relief in the X axes direction
k = Relief in the Z axis direction
d = Number of cuts
n = Number of first block of the shape
n = Number of the last block of the shape
u = Finishing allowance in X
w = Finishing allowance in Z
f = Feed rate
s = Spindle speed
t = Tool number
Axial Drilling Cycle -G74
Format
G74 R (e)
G74 X (U)_ Z (W)_ P(i) Q (k) R(d) F(f)
e = Retract amount
X = X component of point B
U = Incremental amount from A to B
Z = Z component of point C
W = Increment amount from A to C
i = Movement amount in X direction
k = Depth of cut in Z direction
d = Relief Amount of the tool at the cutting bottom
f = Feed rate
Thread Cutting Cycle - G76
Format
G76 p (m) (r) (a) (d min) R (d)
G76 X (u) Z (W)_ R(i) P (k) Q(d) F(L)
m = No. of idle passes
r = Chamfering amount
a = Angle of tool tip
d min = Minimum thread depth
d = Finishing Allowance
i = Taper value
k = Height of thread
d = Depth of cut in first cut
L = Lead of thread