You are on page 1of 47

G83 Peck Drilling Cycle Example

CNC programming example code for the G83 Peck Drilling Cycle. G83 deep hole peck drilling cycle makes
the drilling of deep holes a breeze.
As with G81 drilling cycle you can do simple drilling in a fast and easy way.

But G83 peck drilling due to its specialty of pecking throws away the chips after every cut or peck and this
way also the coolant reaches to the bottom of the hole in a free way, so keeps the drill and component cool and
clean.

The following G83 peck drilling cycle example code illustrates the use of peck drilling cycle in an easy to
understand way, even the beginner level cnc programmers/cnc machinists will understand the working with
ease.

For a complete working of G83 Peck Drilling Cycle read

o G83 Peck Drilling Cycle (Deep Hole) for Fanuc


o G83 Peck Drilling Cycle (Deep Hole) for Haas CNC

G83 Peck Drilling Cycle Example Program

G83 Peck Drilling Cycle Example

N1 T1 M06
N2 G90 G54 G00 X.3 Y.3
N3 S1200 M03
N4 G43 H01 Z1. M08
N5 G83 Z-1.5 Q.5 R.1 F10.
N6 X1.2 Y1.2
N7 G80 G00 Z1. M09
N8 G91 G28 Z0. M05
N9 M30
G83 Peck Drilling Cycle with G70 Bolt Hole Circle Sample
Program
Following cnc sample program illustrates the use of G83 Peck Drilling Cycle with G70 Bolt Hole Circle G-
code to machine evenly spaced deep drills in a circle.

Although G70 Bolt Hole Circle cycle works with G73, G74, G76, G77 and G81 G89.
Related:

o G70 Bolt Hole Circle CNC Mill Programming


o G83 Peck Drilling Cycle (Deep Hole) for Fanuc
o G83 Peck Drilling Cycle (Deep Hole) for Haas CNC

CNC Program Sample Code

G83 Peck Drilling Cycle with G70 Bolt Hole Circle

O001
N10 T5 M06
N20 G90 G54 G00 X70. Y80.
N30 S1451 M03
N40 G43 H05 Z50. M08
N50 G83 R2. Z-25. Q2. F80. L0
N60 G70 I55. J0. L6
N70 G80 G00 Z50. M09
CNC Milling G70 Bolt Hole Circle Program Example
G70 Bolt Hole Circle command makes it easy to drill/tap/bore in a circle at even distances.
There is no need to know or calculate each hole position.
You just are required to know is the Radius of the circle, Starting angle of the first hole and Total number of
holes.

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.

CNC Milling G70 Bolt Hole Circle Program Example

Following cnc program example uses G81 Drilling Cycle in combination with G70 Bolt Hole Circle G-code to
drill 8 holes evenly spaced in a circle of 1 (inch) radius.

G70 Bolt Hole Circle Program Example

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
G72 Bolt Hole Along an Angle CNC Sample Program
Following cnc programming code shows the use of G72 bolt hole along an angle.

As the names states G72 G-code makes it very easy to drill/bore/tap evenly spaced hole along a specified
angle.

Canned cycles G73, G74, G76, G77, or G81-G89 can be used with G72 bolt hole along an angle command.

Contents
G72 Bolt Holes Along an Angle Format
CNC Program Example G72 Bolt Hole Along an Angle

G72 Bolt Holes Along an Angle Format


G72 I J L

I Distance between bolt holes along an angle


J Angle of holes from three oclock, 0 to 360.0 degrees CCW.
L Number of evenly spaced holes along an angle

More info G72 Bolt Holes Along an Angle CNC Milling Programming
CNC Program Example G72 Bolt Hole Along an Angle

G72 Bolt Hole Along an Angle

O0009
N10 T3 M06
N20 G90 G54 G00 X0.65 Y-1.5 (Start position of bolt holes along an angle)
N30 S1451 M03
N40 G43 H03 Z1. M08
N50 G81 G99 Z-0.45 R0.1 G72 I0.5 J20. L7 F8.
N60 G80 G00 Z1. M09
N70 G53 G49 Z0. M05
N80 M30
Fanuc G84 Rigid Peck Tapping Cycle
Tapping a deep hole in rigid tapping mode may be difficult due to chips sticking to the tool (tap) or increased
cutting resistance.

Peck Rigid Tapping

To make such deep hole tapping operations easy for CNC machinists there is a cycle on Fanuc cnc controls
G84 Peck Rigid Tapping Cycle.

For CNC machinists who work on Haas cnc controls you are also lucky read Deep Hole Tapping with
Chipbreaking or Peck Tapping on Haas CNC

In Fanuc G84 Rigid Peck Tapping Cycle, cutting is performed several times (Pecks) until the bottom of the
hole is reached.

Fanuc G84 Peck Rigid Tapping Cycle Format

G84 X_ Y_ Z_ R_ P_ Q_ F_ K_ ;
X Y Hole position.
Z Z-depth (feed to Z-depth starting from R plane).

R Position of the R plane.


P Dwell time at the bottom of the hole and at point R when a return is made.
Q Depth of cut for each cutting feed (Peck depth).
F The cutting feedrate.
K Number of repeats (if required).
G84 Rigid Peck Tapping Cycle
For complete details about G84 Tapping Cycle and use of G98 G99 with G84 tapping cycle read G84 Tapping
Cycle CNC Mill Programming

Fanuc G84 Tapping Cycle


G84 tapping cycle performs tapping operation, tapping is performed by rotating the spindle clockwise, when
bottom of the hole has been reached, the spindle is rotated in the reverse direction for retraction. This whole
operation creates threads.

Contents
Syntax
o Notes
Usage
Working
G98 G99 Modes
Repeat Drilling
Working Example

Syntax
G84 X... Y... Z... R... P... F... K...

Parameter Description
X Hole position in x-axis.
Y Hole position in y-axis.
Z Depth, tapping from R-plane to Z-depth.
R Position of the R plane.
P Dwell time.
Number of cycle repetitions (if required)
K .
F Feedrate.

Once given in program G84 tapping cycle is repeated at every axis movement until G80 is given in program to
end tapping cycle.

Notes

Feedrate override is ignored during tapping.


Feed-hold does not stop the machine until the return operation is completed.

Usage
N150 M6 T2
N160 G90 G00 X60 Y28 Z12 S100 M03
N170 G99 G84 X60 Y28 Z-17 P300 R2 F120
N180 G98 Y12
N190 G91 G80 G28 X0 Y0 Z0 M05
N200 M30

Working

Brief description of how G84 tapping cycle works,

G84 tapping cycle working


0- CW Spindle rotation command (M03) must be given in part-program.
1- Rapid traverse to X, Y position (pre-drill hole position).
2- Rapid traverse to R-plane.
3- Tapping operation is done till Z-depth (with tapping feed given with G84).
4-1- Dwell for time specified with P
4-2- Spindle is rotated CCW
5- Tap is Retracted with the specified feed.
At R-plane spindle is rotated CW.
If G99 is specified then tapping for this hole ends here,
6- if G98 is given in program then tap is moved to Initial-level.

G98 G99 Modes

After completing tapping the return height can be controlled by using G98 or G99.

G98 Tap will return to the Initial level


G99 Tap will return to R-plane.

G98, G99 can be used multiple times during G84 tapping cycle.

Repeat Drilling

G84 tapping cycle can be repeated multiple times if K value is given.

For working example see G81 drilling cycle.

Working Example
G84 tapping cycle example

N10 T1 M06
N20 G90 G54 G00 X30 Y25
N30 S100 M03
N40 G43 H01 Z5 M08
N50 G84 Z-20 R2 F1.25
N60 X80 Y50
N70 G80 G00 Z100 M09
N80 M30
G84 Tapping Cycle Example CNC Program
G84 tap cycle is one of the mostly used function of CNC machining centers.

This G84 tapping cycle example program illustrates the use of tapping in an easy to understand way.

G84 tapping cycle is a modal G-code, so is cancelled with G80 otherwise it will execute tap operation on every
X and/or Y move.

Contents
G84 Tapping Cycle Format
G84 Tapping Cycle Sample CNC Program

G84 Tapping Cycle Format


G84 X_ Y_ Z_ R_ F_

X Y Hole position data


Z Z-depth (feed to Z-depth starting from R plane)
R Position of the R plane
F Cutting feedrate

A complete article about G84 read G84 Tapping Cycle CNC Mill Programming
Another related article Deep Hole Tapping with Chipbreaking or Peck Tapping with G84
G84 Tapping Cycle Sample CNC Program

G84 Tapping Cycle Example

O100 (G84 R.H. Tapping Cycle)


N1 T18 M06
N2 G90 G54 G00 X0.625 Y0.625
N3 S500 M03
N4 G43 H18 Z1. M08
N5 G84 G99 Z-0.65 R0.1 F35.7143
N6 X-0.625 Y-0.625
N7 G80 G00 Z1. M09
N8 G53 G49 Z0. M05
N9 M30
Fanuc G85 Boring Cycle
G85 boring cycle is used to bore a hole.

Contents
Syntax
Usage
Working
G98 G99 Modes
Repeat Drilling

Syntax
G85 X... Y... Z... R... F... K...

Parameter Description
X Hole position in x-axis.
Y Hole position in y-axis.
Z Depth, tapping from R-plane to Z-depth.
R Position of the R plane.
Number of cycle repetitions (if required)
K .
F Feedrate.

Once given in program G85 boring cycle is repeated at every axis movement until G80 is given in program to
end this cycle.

Usage
N150 M6 T2
N160 G90 G00 X60 Y28 Z12 S100 M03
N170 G99 G85 X60 Y28 Z-15 R2 F120
N180 G98 Y12
N190 G91 G80 G28 X0 Y0 Z0 M05
N200 M30

Working

Brief description of how G85 boring cycle works,


G85 boring cycle working

1- Rapid traverse to X, Y position.


2- Rapid traverse to R-plane.
3- Boring with feed from R-plane to Z-depth.
4- Retraction with feed from Z-depth to R-plane.
If G99 is given then boring of this hole ends.
5- Rapid traverse to Initial-level only if G98 is given in part-program with G85.

G98 G99 Modes

How G85 boring cycle behaves upon G98 or G99 mode,

G98 Boring tool will return to the Initial level


G99 Boring tool will return to R-plane.

For a working example see G81 drilling cycle.

Repeat Drilling

If K parameter value is given with G85 boring cycle, then boring will repeat the number of times given with K.
See G81 drilling cycle example.
Fanuc G86 Boring Cycle
G86 boring cycle is used to bore a hole.

Contents
Syntax
Usage
Working
G98 G99 Modes
Repeat Drilling

Syntax
G86 X... Y... Z... R... F... K...

Parameter Description
X Hole position in x-axis.
Y Hole position in y-axis.
Z Depth, tapping from R-plane to Z-depth.
R Position of the R plane.
Number of cycle repetitions (if required)
K .
F Feedrate.

Once given in program G86 boring cycle is repeated at every axis movement until G80 is given in program to
end this cycle.

Usage
N150 M6 T2
N160 G90 G00 X60 Y28 Z12 S100 M03
N170 G99 G86 X60 Y28 Z-15 R2 F120
N180 G98 Y12
N190 G91 G80 G28 X0 Y0 Z0 M05
N200 M30
Working

Brief description of how G86 boring cycle works,


G86 boring cycle working

1- Rapid traverse to X, Y position.


2- Rapid traverse to R-plane.
3- Boring with feed from R-plane to Z-depth.
4- Spindle stop at bottom of the hole.
5-1- Rapid traverse to R-plane (G99) or Initial-level (G98)
5-2- Spindle start CW

G98 G99 Modes

How G86 boring cycle behaves upon G98 or G99 mode,

G98 Boring tool will return to the Initial level


G99 Boring tool will return to R-plane.

For a working example see G81 drilling cycle.

Repeat Drilling

If K parameter value is given with G86 boring cycle, then boring will repeat the number of times given with K.
See G81 drilling cycle example.
Complete CNC G Code List
Contents
Complete G Code List
o List of G-codes commonly found on Fanuc and similarly designed CNC controls
G00 Positioning (Rapid traverse)
G01 Linear interpolation (Cutting feed)
G02 Circular interpolation CW or helical interpolation CW
G03 Circular interpolation CCW or helical interpolation CCW
G04 Dwell
G10 Programmable data input
G20 Input in inch
G21 Input in mm
G32 Thread cutting
o G32 Taper Threading
G33 Thread Cutting
G70 Finishing cycle
G71 Stock removal in turning
G72 Stock removal in facing
G73 Pattern repeating
G74 End face peck drilling
o G74 Peck Drilling Cycle
o G74 Face Grooving
G75 Outer diameter/internal diameter drilling
G76 Multiple threading cycle
o G76 Threading Cycle One Line Format
o G76 Taper Threading
o G76 Multi Start Threading
o G76 Thread Infeed
G92 Thread cutting cycle
o G92 Taper Threading Cycle
G94 Facing Cycle (Endface turning cycle)
G94 Feed Per Minute / G98 Feed Per Minute
G95 Feed Per Revolution / G99 Feed Per Revolution

Complete G Code List


List of G-codes commonly found on Fanuc and similarly designed CNC controls

G Code

A B C Group Function

G00 G00 G00 Positioning (Rapid traverse)

G01 G01 G01 Linear interpolation (Cutting feed)

G02 G02 G02 Circular interpolation CW or helical interpolation CW

G03 G03 G03 01 Circular interpolation CCW or helical interpolation CCW

G04 G04 G04 Dwell

G07.1(G107) G07.1(G107) G07.1(G107) Cylindrical interpolation

G08 G08 G08 Advanced preview control

G10 G10 G10 Programmable data input

G11 G11 G11 00 Programmable data input cancel

G12.1(G112) G12.1(G112) G12.1(G112) Polar coordinate interpolation mode

G13.1(G113) G13.1(G113) G13.1(G113) 21 Polar coordinate interpolation cancel mode

G17 G17 G17 X Y plane selection

G18 G18 G18 Z X plane selection

G19 G19 G19 16 Y Z plane selection

G20 G20 G70 Input in inch

G21 G21 G71 06 Input in mm

G22 G22 G22 Stored stroke check function on

G23 G23 G23 09 Stored stroke check function off

G25 G25 G25 08 Spindle speed fluctuation detection off


G26 G26 G26 Spindle speed fluctuation detection on

G27 G27 G27 Reference position return check

G28 G28 G28 Return to reference position

G30 G30 G30 2nd, 3rd and 4th reference position return

G31 G31 G31 00 Skip function

G32 G33 G33 Thread cutting

G34 G34 G34 01 Variablelead thread cutting

G36 G36 G36 Automatic tool compensation X

G37 G37 G37 00 Automatic tool compensation Z

G40 G40 G40 Tool nose radius compensation cancel

G41 G41 G41 Tool nose radius compensation left

G42 G42 G42 07 Tool nose radius compensation right

G50 G92 G92 Coordinate system setting or max. spindle speed setting

G50.3 G92.1 G92.1 00 Workpiece coordinate system preset

G50.2(G250) G50.2(G250) G50.2(G250) Polygonal turning cancel

G51.2(G251) G51.2(G251) G51.2(G251) 20 Polygonal turning

G52 G52 G52 Local coordinate system setting

G53 G53 G53 00 Machine coordinate system setting

G54 G54 G54 Workpiece coordinate system 1 selection

G55 G55 G55 Workpiece coordinate system 2 selection

G56 G56 G56 Workpiece coordinate system 3 selection

G57 G57 G57 Workpiece coordinate system 4 selection

G58 G58 G58 Workpiece coordinate system 5 selection

G59 G59 G59 14 Workpiece coordinate system 6 selection

G65 G65 G65 00 Macro calling

G66 G66 G66 12 Macro modal call


G67 G67 G67 Macro modal call cancel

G68 G68 G68 Mirror image for double turrets ON

G69 G69 G69 04 Mirror image for double turrets OFF

G70 G70 G72 Finishing cycle

G71 G71 G73 Stock removal in turning

G72 G72 G74 Stock removal in facing

G73 G73 G75 Pattern repeating

G74 G74 G76 End face peck drilling

G75 G75 G77 Outer diameter/internal diameter drilling

G76 G76 G78 00 Multiple threading cycle

G80 G80 G80 Canned cycle for drilling cancel

G83 G83 G83 Cycle for face drilling

G84 G84 G84 Cycle for face tapping

G86 G86 G86 Cycle for face boring

G87 G87 G87 Cycle for side drilling

G88 G88 G88 Cycle for side tapping

G89 G89 G89 10 Cycle for side boring

G90 G77 G20 Outer diameter/internal diameter cutting cycle

G92 G78 G21 Thread cutting cycle

G94 G79 G24 01 Endface turning cycle

G96 G96 G96 Constant surface speed control

G97 G97 G97 02 Constant surface speed control cancel

G98 G94 G94 Per minute feed

G99 G95 G95 05 Per revolution feed

- G90 G90 Absolute programming

- G91 G91 03 Incremental programming


- G98 G98 Return to initial level

- G99 G99 11 Return to R point level

G00 Positioning (Rapid traverse)


1. CNC G-Code G00 Rapid Traverse
2. CNC G Code Introduction for CNC Programmers
G01 Linear interpolation (Cutting feed)
1. CNC G Code Introduction for CNC Programmers
2. CNC Programming for Beginners a Simple CNC Programming Example
3. Lathe CNC Programming Example
G02 Circular interpolation CW or helical interpolation CW
1. CNC Programming for Beginners a CNC Programming Example
2. CNC Lathe Programming Example
3. CNC Circular Interpolation Tutorial G02 G03
G03 Circular interpolation CCW or helical interpolation CCW
1. CNC Arc Programming Exercise
2. CNC Circular Interpolation Tutorial G02 G03
G04 Dwell
1. G04 Dwell Time Calculation Made Easy
G10 Programmable data input
1. Fanuc G10 G-Code for CNC Machine Programmable Offset Setting
G20 Input in inch
1. Fanuc G20 Measuring in Inches with CNC Program Example
G21 Input in mm
1. Fanuc G21 Measuring in Millimeter with CNC Lathe Programming Example
G32 Thread cutting
1. CNC Fanuc G33 G32 Threading G Code
G32 Taper Threading
1. Taper Threading with G32 a CNC Programming Example
G33 Thread Cutting
1. CNC Fanuc G33 G32 Threading G Code
G70 Finishing cycle
1. CNC Programming Example with Fanuc G71 Rough Turning Cycle and G70
2. Fanuc G70 G71 Rough and Finish Turning Cycle Program Example
G71 Stock removal in turning
1. CNC Fanuc G71 Turning Cycle or Stock Removal Canned Cycle
2. G71 Rough Turning Cycle One-line Format
3. CNC Programming Example with Fanuc G71 Rough Turning Cycle and G70
4. Fanuc G70 G71 Rough and Finish Turning Cycle Program Example
G72 Stock removal in facing
1. CNC Fanuc G72 Canned Cycle Facing
G73 Pattern repeating
1. CNC Fanuc G73 Pattern Repeating Cycle
2. CNC Fanuc G73 Pattern Repeating Cycle CNC Program Example
G74 End face peck drilling

Peck drilling in Z axis.

G74 Peck Drilling Cycle


1. Simple CNC Lathe Drilling with Fanuc G74 Peck Drilling Cycle
G74 Face Grooving
1. Face Grooving with G74 G Code a CNC Programming Tutorial
G75 Outer diameter/internal diameter drilling

Grooving in X axis.

1. CNC Fanuc G75 Grooving Cycle


2. Fanuc G75 Grooving Cycle CNC Program Example
3. G75 Canned Cycle Grooving CNC Programming Example
G76 Multiple threading cycle

Thread cutting cycle, G76 threading cycle, Fanuc G76 threading cycle, G76 thread cycle.

1. Fanuc G76 Threading Cycle


2. G76 Thread Cycle a CNC Programming Example
G76 Threading Cycle One Line Format
1. G76 Threading Cycle One Line Format for Fanuc 10/11/15T
G76 Taper Threading
1. Tapered Threading with Fanuc G76
G76 Multi Start Threading
1. Multi-Start Threading with Fanuc G76
G76 Thread Infeed
1. Controlling Thread Infeed with Fanuc G76
G92 Thread cutting cycle

CNC Fanuc G92 Threading Cycle, G92 thread cutting cycle.

1. CNC Fanuc G92 Threading Cycle


G92 Taper Threading Cycle
1. Taper Threading with G92 Threading Cycle
2. CNC Programming Example G92 Taper Threading Cycle
G94 Facing Cycle (Endface turning cycle)
1. Fanuc G94 Facing Cycle CNC Example Program
G94 Feed Per Minute / G98 Feed Per Minute
1. G-Code G94 Feed Per Minute
G95 Feed Per Revolution / G99 Feed Per Revolution
1. G-Code G95 Feed Per Revolution

G03 Circular interpolation CCW or helical interpolation CCW


1. CNC Arc Programming Exercise
2. CNC Circular Interpolation Tutorial G02 G03

Circular Interpolation Programming Example 1


This Circular Interpolation programming example will show you what is circular interpolation and how to
program it.

Before going through this exercise you must fist read Circular Interpolation Concepts &
Programming articles (listed below). After reading articles you will be comfortable to understand this
example as a very simple and basic work.
Circular Interpolation Concepts & Programming articles
o Circular Interpolation Concepts & Programming Part 1 (Concepts)
o Circular Interpolation Concepts & Programming Part 2 (Use of R)
o Circular Interpolation Concepts & Programming Part 3 (Use of I J K)
o Circular Interpolation Concepts & Programming Part 4 (Unknown R)
o Circular Interpolation Concepts & Programming Part 5 (Examples)
o Circular Interpolation Concepts & Programming Part 6 (Uses & Exercises)
Contents
Circular Interpolation Programming Example 1 (Use of R)
o Explanation of CNC Program
o Incremental Dimensioning System Program
o Explanation of CNC G-Code/M-Code/S, F, D
Circular Interpolation Programming Example 1 (Use of R)

Circular Interpolation Programming Example

N5 G00 G54 G64 G90 G17 X-20 Y-20 Z50


N10 S450 M03 F250 D01 (12.5 MM DIA)
N15 C0
N20 Z5
N25 G01 Z0
N30 Z-5
N35 G42 X0 Y0 M08 (Liner motion)
N40 X60 Y0 (Liner motion)
N45 X85 Y30 (Liner motion)
N50 X85 Y50 (Liner motion)
N55 G03 X70 Y65 U15 (Circular motion G03 for Counter Clockwise motion and U for arc radius)
N60 G01 X45 Y65 (Liner motion)
N65 G02 X30 Y50 U15 (Circular motion G02 for Clockwise motion and U for arc radius)
N70 G01 X10 Y50 (Liner motion)
N75 X0 Y0 (Liner motion)
N80 G40 X-20 Y-20
N85 G00 Z50 M09
N90 Y100
N95 M30

Finished Part
After completing the machining process, your job will look like this.

Machined component
Explanation of CNC Program

In this cnc program block no. N35 to N50 (points 2-3, 3-4, 4-5) are in straight movement (Linear Interpolation)
and for that propose we have the CNC G-Code G01 (linear interpolation),

Point 5-6 is not possible with G01 code because tool is not going straight, tool is traveling in a circular way,
for this purpose cnc machinists have circular interpolation codes G02/G03.
Before using G02/G03 G code cnc machinists must know the exact values of
(1) End-point
(2) Radius between start to end points.
So the required values at point 6 are
(1) X=70, Y=65 (as End-point)
(2) R=15 (as Radius).
After getting this information we are now in the position to write the CNC program block code for point 5
through 6.
First circular motion G02-G03, Second is End-point X, Y values and the Third is R (Radius), in this way we
can achive our required results.

Point 6-7 is again linear and point 7-8 is circular motion, so do the same as stated above but before writing the
code, check the motion direction whether it is clockwise or counter clockwise, and this motion is clockwise, so
use the code G02.

After that the other points are linear movements.

Every linear motion is cancelled by the circular motion (G01 is cancelled by G02/G03) and every circular
motion is cancelled by the linear motion (G02/G03 is cancelled by G01)

Incremental Dimensioning System Program


Here is the same cnc program but with G91 Incremental Dimensioning System.

N35 G42 X0 Y0 M08 (Liner motion)


N40 G91 X60 Y0 (Liner motion)
N45 X25 Y30 (Liner motion)
N50 X0 Y20 (Liner motion)
N55 G03 X-15 Y15 U15 (Circular motion G03 for Counter Clockwise motion and U for arc radius)
N60 G01 X-25 Y0 (Liner motion)
N65 G02 X-15 Y-15 U15 (Circular motion G02 for Clockwise motion and U for arc radius)
N70 G01 X-20 Y0 (Liner motion)
N75 X-10 Y-50 (Liner motion)

Explanation of CNC G-Code/M-Code/S, F, D

G00 : Rapid traverse.


G54 : Zero Offset no. 1.
G64 : Continuous-path mode.
G90 : Absolute dimensioning system.
G17 : X-Y plan selection.
G42 : Cutter radius compensation activation (right hand side movement)
G40 : Cutter radius compensation de-active
G02 : Circular Interpolation clockwise
G03 : Circular Interpolation anti-clockwise (counter clockwise)
S : Spindle speed
F : Axis motion feed
M : Cutter motion (3=clockwise, 4=anti-clockwise)
D : Tool no
M08 : Coolant on
M09 : Coolant off
M30 : End of main program

Circular Interpolation Programming Example 2


Although this example drawing looks a bit complex, but it is very easy to program. Before going through this
exercise you must fist read circular interpolation articles

Circular Interpolation Concepts & Programming articles


o Circular Interpolation Concepts & Programming Part 1 (Concepts)
o Circular Interpolation Concepts & Programming Part 2 (Use of R)
o Circular Interpolation Concepts & Programming Part 3 (Use of I J K)
o Circular Interpolation Concepts & Programming Part 4 (Unknown R)
o Circular Interpolation Concepts & Programming Part 5 (Examples)
o Circular Interpolation Concepts & Programming Part 6 (Uses & Exercises)

and exercise no. 1

o Circular Interpolation Programming Example 1

After reading that you will be comfortable to understand this program example. it is very simple and basic
work.

Contents
Circular Interpolation Programming Example 2
o Explanation of CNC G-Code

Circular Interpolation Programming Example 2

Circular Interpolation Programming Example 2

N5 G00 G54 G64 G90 G17 X-20 Y-20 Z50


N10 S450 M03 F250 D01 (12.5 MM DIA)
N15 C0
N20 Z5
N25 G01 Z0
N30 Z-5
N35 G42 X0 Y0 M08
N40 X80 Y0
N45 X60 Y30 U10
N50 X80 Y50
N55 X50 Y50
N60 G02 X30 Y30 U20
N65 G01 X10 Y30 U8
N70 X0 Y0
N75 G40 X-20 Y-20
N80 G00 Z50 M09
N85 Y100
N90 M30

Finished Part
After completing the machining process, your job will look like this.

Completed Part
Explanation of CNC G-Code

G00 : Rapid traverse.


G54 : Zero Offset no. 1.
G64 : Continuous-path mode.
G90 : Absolute dimensioning system.
G17 : X-Y plan selection.
G42 : Cutter radius compensation activation (right hand side movement)
G40 : Cutter radius compensation de-active
G02 : Circular Interpolation clockwise
G03 : Circular Interpolation anti-clockwise (counter clockwise)
S : Spindle speed
F : Axis motion feed
M : Cutter motion (3=clockwise, 4=anti-clockwise)
D : Tool no
M08 : Coolant on
M09 : Coolant off
M30 : End of main program

Circular Interpolation Concepts & Programming Part 5


(Examples)
5nd part of Circular Interpolation Concepts & Programming series, this article explains Use of

o G90 Absolute Programming


o G91 Incremental Programming

with cnc program examples code explaining both G90/G91

Read Other Parts of this Article


o Circular Interpolation Concepts & Programming Part 1 (Concepts)
o Circular Interpolation Concepts & Programming Part 2 (Use of R)
o Circular Interpolation Concepts & Programming Part 3 (Use of I J K)
o Circular Interpolation Concepts & Programming Part 4 (Unknown R)
o Circular Interpolation Concepts & Programming Part 5 (Examples)
o Circular Interpolation Concepts & Programming Part 6 (Uses & Exercises)

Circular Interpolation using G90 and G91

o G90 X ____ Y____ defines the arc end point in the work co-ordinate system.
o G91 X_____ Y____ defines the signed distance of the arc end point from the arc start point
o I____ J____ defines the signed distance of the arc start point from the center point of the arc

For example: see the following picture.


Circular Interpolation using G90 and G91

Example CNC Programs

CNC Program with G90 CNC Program with G91

G41 G90 G01 X0 Y20 G41 G91 G01 X0 Y20


G02 X10 Y30 I10 J0 G02 X10 Y10 I10 J0
G01 X20 Y30 G01 X10 Y0
G01 X20 Y40 G01 X0 Y10
G02 X30 Y50 I10 J0 G02 X10 Y10 I10 J0
G01 X45 Y50 G01 X15 Y0
G02 X50 Y45 I0 J-5 G02 X5 Y-5 I0 J-5
G01 X50 Y5 G01 X0 Y-40
G02 X40 Y0 I-13.59 J14.68 G02 X-10 Y-5 I-13.59 J14.68
G01 X0 Y0 G01 X-40 Y0

Circular interpolation is quite a bit more demanding on your machine as two axes have to be precisely
coordinated. Drawing a complete circle involves not just coordinated motion but reversal of direction at each
of the 4 quadrant points. These would be the points corresponding to 0, 90, 180, and 270 degrees.

Circular Interpolation Concepts & Programming Part 4


(Unknown R)
The 4th part of Circular Interpolation Concepts & Programming series explains how cnc program for an arc
can be made if arc Radius (R) is not directly given.

Read Other Parts of this Article


o Circular Interpolation Concepts & Programming Part 1 (Concepts)
o Circular Interpolation Concepts & Programming Part 2 (Use of R)
o Circular Interpolation Concepts & Programming Part 3 (Use of I J K)
o Circular Interpolation Concepts & Programming Part 4 (Unknown R)
o Circular Interpolation Concepts & Programming Part 5 (Examples)
o Circular Interpolation Concepts & Programming Part 6 (Uses & Exercises)

Program an Arc only Arc Center is given

To program an arc when only the arc center is given (the radius is unknown) use the address letters I and J

o I relates to the address X and is the incremental value and direction (+/-) from the start point of the arc in
the X axis to the arc centre.
o J relates to the address Y and is the incremental value and direction (+/-) from the start point of the arc in
the Y axis to the arc centre.

Program an Arc only Arc Center is given

In this figure the procedure is very clear to calculate I and J values. From the point where arc is started always
look to wards arc midpoint. If the arc is less than a quadrant than you must find out the both I and J values.

G03 X (End Point) Y(End Point) I J


For CNC Lathe Machinists
Fanuc Circular Interpolation G02 G Code Example

Fanuc Dwell G04 Command


Contents
What is Dwell?
Fanuc Dwell G04Format
Fanuc Dwell G04 Examples
o Example
o Example
How dwell for Specified Revolutions?

What is Dwell?

By specifying a dwell (G04), the execution of the next cnc program block is delayed by the specified time.

Fanuc Dwell G04 Command

A program dwell time can be created at any point within a program.


Fanuc G04 Dwell time is a non-modal G-code.
G04 Dwell time is from G-code group 00.

Some CNC programming cycles have their own dwell facilities within the cycle itself.

Fanuc Dwell G04Format


G04 X (sec)

G04 U (sec)

G04 P (msec)
The dwell time starts at the moment when the tool movement speed is zero.
With address P no decimal point is allowed.

Fanuc Dwell G04 Examples


G04 P1000 (equals 1 second)

Example

so to program 10 Seconds dwell

G04 X10
G04 U10
G04 P10000

Example

G04 X2.5 (dwell time = 2.5sec)


G04 P1000 (dwell time = 1 sec = 1000 msec)

How dwell for Specified Revolutions?


Fanuc Dwell G04 pause in seconds.
It is possible to have the pause in number of revolutions by using following formula,
Seconds of pause for one spindle revolution = 60 / S (spindle speed in rpm)
Example
If the spindle rotates at 300 rpm, the pause time for one revolution will be 60 / 300 = 0.2 seconds
If a pause is required equal to 3 rpm,

G4 U0.6 (0.2 seconds x 3 rpm)


How to Mill Full Circle CNC Program Example Code
How to mill a full circle, no problem below is the cnc program example G-code which shows how to program
a full circle on a cnc milling machine.

Often cnc machinists has to complete such components which require a full circle machining sometimes inside
full circle sometimes you have to program an outside full circle.

This G-code example will show you how to program a full circle from out-side.

Contents
Full Circle CNC Program Example
How to Program Full Circle Explanation
o Summary
o Explanation

Full Circle CNC Program Example

How to Mill Full Circle CNC Program

N05 G00 X10 Y25 Z1 S1250 M3


N10 G01 Z-5 F100
N15 G02 X10 Y25 I20 J0 F125
N20 G00 Z100 M5
N25 X-20
N30 M30
How to Program Full Circle Explanation
Summary
N05 Tool rapid traverse (G00) to point P01.
N10 Infeed (G01) to Z-5
N15 X-Y plane selected automatically (G17). Tool travels clockwise around a full circle (G02).
N20/N25 Rapid traverse (G00) retraction.
N30 End of program (M30).

Explanation

1: The tool start point is N05 X10 Y25 this is the point P01

2: Now we want a complete circle so we will use G02 or G03 circular interpolation G-code
If you want a clock-wise circle you will use G02 as shown in this program.
but if you want a counter-clock-wise circle then use G03 G-code.

3: With G02 we will give the coordinates of the circle end point,
as for a full circle the start-point and end-point remains the same,
so we will use same X,Y coordinate
G02 X10 Y25

4: Now to complete G02 G-code we will have to give the circle-center-point coordinates,
I Distance from circle start-point to circle-center-point in X-axis.
J Distance from circle start-point to circle-center-point in Y-axis
so G02 X10 Y25 I20 J0
to show how to measure I and J the values of I and J are separately given in the above figure.

Fanuc Subprogram Example


Here is a Fanuc subprogram example which shows, how cnc machinists can make their cnc programs easier to
write and maintain by useing sub-programming method.

Contents
CNC Sub Programs
Example Without Fanuc Sub-Program Call
Example with Fanuc Sub-Program Call
Fanuc Subprogram Example
o Sub Program

CNC Sub Programs

Sub-programming is a way in which cnc machinists can call other cnc programs stored in cnc machines from
their programs (called as main-programs).
Read article about How to do Fanuc Sub Programming.

This Sub-programming process makes it easier for cnc programmers/machinists to keep their cnc programs
small by dividing programs into small pieces of repeatable useful code.

Fanuc Sub Programming

As the below cnc program example shows,

cnc machinist want to drill some holes and then he want to tap the same holes.

Example Without Fanuc Sub-Program Call


The simplest way to program can be read here G81 Drilling Cycle G84 Tapping Cycle CNC Program
Example.
Example with Fanuc Sub-Program Call

Below is the same program example but this time we are using Sub-programming technique.

Fanuc Subprogram Example


Fanuc Subprogram Example

O1000 ;
N1 T1 M6 ;
N2 G0 G90 G40 G21 G17 G94 G80 ;
N3 G54 X10 Y10 S? M3 ;
N4 G43 Z100 H1 ;
N5 Z5 ;
N6 G81 R3 Z-20 F? M8 ;
N7 M98 P1001 ;
N8 G0 G90 Z100
N9 T2 M6 ;
N10 G0 G90 G40 G21 G17 G94 G80 ;
N11 G54 X10 Y10 S? M3 ;
N12 G43 Z100 H1 ;
N13 Z5 ;
N14 G84 G99 G95 R3 Z-20 F1.25 M8 ;
N15 M98 P1001 ;
N16 G0 G90 Z100 ;
N17 T0 M6 ;
N18 M30 ;

Sub Program

O1001 ;
N101 Y30 ;
N102 Y50 ;
N103 Y70 ;
N104 X30 ;
N105 X50 ;
N106 X70 ;
N107 X90 ;
N108 Y50 ;
N109 Y30 ;
N110 Y10 ;
N111 X70 ;
N112 X50 ;
N113 X30 ;
N114 G80 ;
N115 M99

CNC Mill Contour Pecking Fanuc Subprogram Repeat


Example
A very simple cnc programming example which shows
how a contour can be repeated multiple times with the added benefit of pecking.
So like peck drilling this time cnc machinists are pecking a specific contour of cnc mill.

What is Fanuc Sub programming read Fanuc Sub Programming


Contents
CNC Mill Contour Pecking
Fanuc Subprogram Repeat Example

CNC Mill Contour Pecking

The subprogram is a simple mix of G-code instructions.


The main program O4000 calls subprogram O4001 to repeat 10 times

M98 P104001

Subprogram cuts contour by making 2mm depth of cut every time (in G91 Incremental Programming)

G1 G91 Z-2 (Incremental peck depth)


Then subprogram switches back to G90 Absolute Programming this makes contour programming easy.
So this program cuts a specific contour 20mm deep by taking 10 pecks of 2mm each.

Fanuc Subprogram Repeat Example

Contour Pecking Fanuc Mill Subprogram Repeat Example

O4000
T1 M6
G0 G90 G40 G21 G17 G94 G80
G54 X-75 Y-75 S? M3 (Start Point)
G43 Z100 H1
Z5
G1 Z0 F?
M98 P104001 (Call sub-program & repeat 10 times)
G0 G90 Z100
M30

Subprogram
The sub program below takes cut in G91 Incremental Programming Mode
Then switches back to G90 Absolute Programming Mode for the contour machining.

O4001
G1 G91 Z-2 (Incremental peck depth)
G90 G41 X-40 D? M8 (Absolute Move to position 1 with comp. - Switch on coolant)
Y40 (Move to position 2.)
X40 (Move to position 3.)
Y-40 (Move to position 4.)
X-75 (Move to position 5 - Clear of material - cutter diameter)
G40 Y-75 (Cancel compensation)
M99

NUM CNC Mill Program Example Outer Contour Cutting with


Drilling and Counterbore
NUM CNC Mill Program Example Outer Contour Cutting with through Drilling and Counterbore to a depth of
5 mm.

NUM CNC Mill Program Example

%358
N1 (BRIDE)
N10 G90 G71 G80 G40
N20 G0 G52 Z0
(Contour)
N30 T4 D4 M6
N40 G97 S345
N50 G94 F110
N60 G0 X62 Y-18
N70 Z-5 M3 M41
N80 G1 G42 X50 M8
N85 G1 Y33
N90 G3 X38 Y45 R12
N100 G1 X-35 Y45
N110 G2 X-50 Y 30 R15
N120 G1 X-50 Y25
N130 G1 X-35 Y0
N140 G1 X-25 Y0
N150 G2 X25 Y0 R25
N155 G1 X50
N160 G1 G40 X68 Y-12 M9
N170 G0 G52 Z0 M5
(Drilling)
N180 T6 D6 M6
N190 G97 S1061
N200 G94 F74
N210 G0 X38 Y33
N220 Z3 M3 M42
N230 G1 Z-18 M8 (5+10+3)
N240 G0 Z3 M9
N250 G0 G52 Z0 M5
(Counterbore)
N260 T7 D7 M6
N270 G97 S530
N280 G94 F106
N290 G0 X38 Y33
N300 Z3 M3 M40
N310 G1 Z-5 M8
N320 G0 Z3 M9
N330 G0 G52 Z0 M5
N340 M2

G Code Example Mill Sample G Code Program for Beginners


Contents
Sample G Code Program for Beginners
G Code Example

Sample G Code Program for Beginners


Sample G code program example for cnc programmers / cnc machinists who work or want to learn cnc mill
programming.

A similar G code example can be found here


Simple G Code Example Mill G code Programming for Beginners
If you are interested in G code subroutine example (sub program) read
CNC Mill Contour Pecking Fanuc Subprogram Repeat Example

This is the same component but this time we are machining it in taper.

G Code Example

G Code Example Mill

O1000
T1 M6
G0 G90 G40 G21 G17 G94 G80
G54 X-75 Y-25 S500 M3 (Start Point)
G43 Z100 H1
Z5
G1 Z-20 F100
X-50 M8 (Position 1)
Y0 (Position 2)
X0 Y50 (Position 3)
X50 Y0 (Position 4)
X0 Y-50 (Position 5)
X-50 Y0 (Position 6)
Y25 (Position 7)
X-75 (Position 8)
G0 Z100
M30

Slot Milling a Sample CNC Program Example


A very simple cnc milling program example which shows how a simple slot can be machined.

Another such program example which mills a pocket the same way but in a taper is here CNC Milling
Machine Programming Example for Beginners.

Slot Milling Program Example

Slot Milling Sample CNC Program

N10 G00 G90 X70 Y25 Z1 S800 M3


N20 Z-5
N30 G01 X20 F150
N40 G00 Z100
N50 X-25 Y50
N60 M30

N10 Spindle on clockwise rotation at 800 rev/min, tool rapid traverse to P01.
N20 Infeed in Z.
N30 Tool traverse P01 to P02, feedrate 150 mm/min.
N40/N50 Rapid traverse retraction.
N60 End of program.

CNC Mill Program Exercise Side Milling Drilling Slot Milling


CNC Control + Tags: Slot Milling

Submit by: BEATA

Summary

Q. Write a CNC Part Program for the figure shown

For side milling, take speed 1200 rpm & feed 100 mm/min
For drilling holes, take speed 1200rpm & feed 80mm/min
For slot milling, take speed 1200rpm & feed 120mm/min
Take hole diameter as 15mm
Use absolute coordinate system.

Solution:

Sequence of operation:
1 Set ref point, cordinate system, tool, give feed & speed value
2 Set cutter for radius compensation left offset
3 set tool at A, start spindle & give down feed (-Z direction)
4 proceed further cutting of side milling and stop spindle at A
5 Move tool at ref point & set the tool for slot cutting
6 Move tool to P, start the spindle & give down feed
7 Proceed further cutting of slot milling and stop spindle at S
8 Move tool at ref point & set the tool for drilling
9 Move tool to P, start the spindle & give full depth cut
10 Move tool up & stop the spindle.
11 Bring back tool at refrence point.
12 End of the program

Drawing/Image
CNC Program

05007
N001 G71 G90 (Set dimension type mm, set absolute co-ordinate system)
N002 G92 X-15.0 Y-15.0 Z0.0 T01 F100 S1200 (Set reference point -15, -15, 0. Tool T01 side milling
tool. Feed 100mm/rev, spindle speed 1200 rpm)
N003 G41 G00 X0.0 Y0.0 Z2.0 (Cutter radius compensation left ON, move the tool at A & give clearance
of 2mm before starting spindle rotation)
N004 G01 Z-15.0 M03 (Start the spindle. Move tool down i.e. at Z direction for cut with feed
here M03 will execute first)
N005 G01 X0.0 Y110.0 (Go to B linearly)
N006 G02 X10.0 Y120.0 R10.0 (Go to C with clockwise circular interpolation with radius = 10)
N007 G01 X75.0 (Go to D linearly)
N008 G01 X100.0 Y92.0 (Go to E linearly)
N009 G01 Y10.0 (Go to F linearly)
N010 G02 X90.0 Y0.0 R10.0 (Go to G with clockwise circular interpolation with radius = 10)
N011 G01 X0.0 (Go to A linearly)
N012 Z2.0 M05 (Go up 2mm in Z direction for clearance. Stop spindle rotation here
M05 will execute last.)
N013 G40 G00 X-15.0 Y-15.0 (Cutter radius compensation OFF. Move tool to reference set point.)
N014 M06 T02 F120 (Change the tool & use tool T02 - here for slot mill tool with dia 6mm.
Set feed as 120mm/rev.)
N015 G00 X15.0 Y55.0 (Move tool to 'P' rapidly.)
N016 G01 Z-5.0 M03 (Start the spindle. Move tool 5mm down i.e. at Z direction for cut with
feed - here M03 will execute first)
N017 Y80.0 (Go to Q linearly.)
N018 X85.0 (Go to R linearly.)
N019 Y80.0 (Go to S linearly.)
N020 Z2.0 M05 (Go up 2mm in Z direction for clearance. Stop spindle rotation - here
M05 will execute last.)
N021 G00 X-15.0 Y-15.0 (Move tool to reference set point.)
N022 M06 T03 F80 (Change the tool & use tool T03 - here for drill bit with dia 15mm. Set
feed as 80mm/rev.)
N023 G00 X50.0 Y25.0 (Move tool to 'T')
N024 G01 Z-20.0 M03 (Go down 20mm for assuring full depth of hole.)
N024 Z2.0 M05 (Go up 2mm in Z direction for clearance. Stop spindle rotation - here
M05 will execute last.)
N025 G00 X-15.0 Y-15.0 (Move tool to reference set point.)
N026 M30 (Stop the program)
CNC Mill Program G91 G41 G43
CNC milling program examples shows the use of G91 G41 G43 G-codes.

Contents
CNC Mill Program G91 G41 G43
o CNC Part Program
o G M S T Codes Explanation

CNC Mill Program G91 G41 G43

CNC Part Program

N05 G54
N10 M6 T1 G43 H1 M3
N15 S500 F120
N20 G0 X-22 Y-22
N25 Z-3
N30 G1 X3 Y6 G41 H2 (P1)
N35 G91 X0 Y24 (P2)
N40 X12 Y9 (P3)
N45 X36 (P4)
N50 Y-24 (P5)
N55 X-21 (P6)
N60 G90 X3 Y6 (P1)
N65 G0 X-21 G40

G M S T Codes Explanation
Code Description
G00 Rapid traverse
G01 Linear interpolation
G40 Cutter compensation cancel
G41 Tool nose radius compensation left
G43 Tool length compensation + direction
G54 Workpiece coordinate system 1 selection
G90 Absolute command
G91 Incremental command
M06 Tool change
T Tool
S Speed
F Feed