Fanuc G-Code Example for Drilling, Tapping, and Boring

Fanuc G-Code Example for Drilling, Tapping, and Boring

Fanuc CNC controls are widely used in machining centers across the world due to their reliability, flexibility, and industry acceptance. Among the most common machining operations performed on Fanuc-controlled CNC machines are drilling, tapping, and boring. These operations are essential for producing accurate holes, threads, and precise internal dimensions in metal and plastic components.

We will explain Fanuc G-code examples for drilling, tapping, and boring, starting from basic concepts and progressing to complete CNC programs. This guide is suitable for beginners, CNC operators, programmers, and manufacturing students who want to understand real-world Fanuc CNC programming.

1. Introduction to Hole Machining in CNC

Hole machining is one of the most frequently used CNC processes. Almost every mechanical part requires holes for bolts, screws, shafts, or assembly purposes. In CNC machining, holes are produced mainly using:

Drilling – creating a hole from solid material

Tapping – cutting internal threads inside a drilled hole

Boring – enlarging and finishing an existing hole with high accuracy

Fanuc CNC machines simplify these operations using canned cycles, which reduce programming time and improve consistency.

2. Understanding Fanuc Canned Cycles

Canned cycles are predefined CNC routines that automate repetitive machining tasks. Instead of writing multiple lines of code for each hole, the programmer can use a single G-code with parameters.

Benefits of Canned Cycles:

  • Shorter programs
  • Reduced programming errors
  • Consistent machining quality
  • Easier modifications

Fanuc canned cycles for hole machining include:

  • G81 – Drilling cycle
  • G82 – Drilling with dwell
  • G83 – Peck drilling
  • G84 – Tapping cycle
  • G85 / G86 / G89 – Boring cycles

3. Fanuc G81 Drilling Cycle (Simple Drilling)

The G81 canned cycle is used for standard drilling operations where the tool feeds directly to the specified depth and retracts after drilling.

G81 X__ Y__ Z__ R__ F__
  • X, Y – Hole position
  • Z – Final drilling depth
  • R – Reference plane (safe height)
  • F – Feed rate

Example: Simple Drilling Program

%
O1001 (DRILLING EXAMPLE)
G21 G17 G90 G40 G49 G80
T01 M06 (10MM DRILL)
S1200 M03
G00 X20 Y20
G43 H01 Z50
G81 Z-20 R5 F150
X40 Y20
X40 Y40
X20 Y40
G80
G00 Z100
M05
M30
%
  • The drill moves to four hole positions
  • Each hole is drilled to 20 mm depth
  • R5 ensures safe rapid movement
  • G80 cancels the canned cycle

4. G82 Drilling Cycle with Dwell

The G82 cycle is similar to G81 but includes a dwell time at the bottom of the hole. This helps improve surface finish and chip breakage.

G82 X__ Y__ Z__ R__ P__ F__
  • P – Dwell time (milliseconds)
G82 X50 Y50 Z-25 R5 P500 F120

This command drills a hole to 25 mm, pauses for 0.5 seconds, then retracts.

5. G83 Peck Drilling Cycle

The G83 peck drilling cycle is used for deep holes. It breaks chips by drilling in small steps and retracting periodically.

G83 X__ Y__ Z__ R__ Q__ F__
  • Q – Peck depth

Example: Peck Drilling Program

%
O1002 (PECK DRILLING)
G21 G17 G90 G80
T02 M06 (8MM DRILL)
S1500 M03
G00 X30 Y30
G43 H02 Z50
G83 Z-40 R5 Q5 F100
G80
G00 Z100
M05
M30
%
  • Drilling depth: 40 mm
  • Peck depth: 5 mm
  • Chips are cleared after every peck

6. Fanuc G84 Tapping Cycle

The G84 canned cycle is used for rigid tapping, where the spindle rotation is synchronized with feed rate.

G84 X__ Y__ Z__ R__ F__

⚠️ Important:
Feed rate must match thread pitch.

Example: M10 Tapping Program

For M10 × 1.5 thread:

  • Pitch = 1.5 mm
  • Spindle speed = 500 RPM
  • Feed = 500 × 1.5 = 750 mm/min
%
O1003 (TAPPING EXAMPLE)
G21 G17 G90 G80
T03 M06 (M10 TAP)
S500 M03
G00 X25 Y25
G43 H03 Z50
G84 Z-20 R5 F750
G80
G00 Z100
M05
M30
%
  • Tool feeds down and retracts automatically
  • Spindle reverses direction during retraction
  • Accurate threads are produced

7. Left-Hand Tapping (G74)

Fanuc also supports left-hand tapping using G74.

G74 X60 Y60 Z-15 R5 F750

This is used for left-hand threaded holes.

8. Fanuc Boring Cycles Overview

Boring operations improve hole accuracy and surface finish. Fanuc provides multiple boring cycles:

G-CodeFunction
G85Boring, feed in & feed out
G86Boring, spindle stop & rapid out
G89Boring with dwell

9. G85 Boring Cycle (Feed In, Feed Out)

Used when surface finish is critical.

G85 X__ Y__ Z__ R__ F__

Example: G85 Boring

%
O1004 (BORING EXAMPLE)
G21 G17 G90 G80
T04 M06 (BORING BAR)
S800 M03
G00 X40 Y40
G43 H04 Z50
G85 Z-30 R5 F80
G80
G00 Z100
M05
M30
%
  • Tool feeds down and feeds out
  • No rapid movement inside the hole
  • Produces excellent finish

10. G86 Boring Cycle (Spindle Stop)

Used when tool marks during retraction must be avoided.

G86 X__ Y__ Z__ R__ F__

Example:

G86 X70 Y30 Z-25 R5 F70

The spindle stops at bottom, then retracts rapidly.

11. G89 Boring Cycle with Dwell

Used for precision holes where a short dwell improves accuracy.

G89 X__ Y__ Z__ R__ P__ F__

Example:

G89 X80 Y80 Z-35 R5 P300 F60

12. Safety Tips for Drilling, Tapping, and Boring

  1. Always verify tool length offsets (H values)
  2. Use correct spindle speeds and feeds
  3. Simulate programs before machining
  4. Use G80 to cancel canned cycles
  5. Ensure proper coolant usage (M08 / M09)

13. Common Programming Mistakes

  • Forgetting G80
  • Incorrect feed rate in tapping
  • Wrong R-plane value
  • Using G84 without rigid tapping enabled
  • Not matching pitch and feed

14. Complete Combined Example Program

%
O1005 (DRILL TAP BORE)
G21 G17 G90 G40 G49 G80
T01 M06 (DRILL)
S1200 M03
G00 X20 Y20
G43 H01 Z50
G81 Z-20 R5 F150
G80

T02 M06 (TAP)
S500 M03
G00 X20 Y20
G43 H02 Z50
G84 Z-18 R5 F750
G80

T03 M06 (BORING)
S800 M03
G00 X20 Y20
G43 H03 Z50
G85 Z-25 R5 F80
G80

G00 Z100
M05
M30
%

Drilling, tapping, and boring are fundamental CNC machining operations, and Fanuc canned cycles make these tasks efficient and accurate. By understanding G81, G83, G84, and boring cycles, CNC programmers can significantly reduce programming time while improving machining quality.

Whether you are a beginner learning CNC programming or an experienced machinist looking to refine your skills, mastering these Fanuc G-code examples will help you produce precise and reliable parts.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *