You are on page 1of 95

FANUC INDIA FA & ROBOT

BASIC PROGRAMMING OF
CNC MILLING MACHINE

1
FANUC INDIA FA & ROBOT

Course contents Page No.


General coordinate System 04
Designation of machine axes 05
Machine coordinate system 06
Work coordinate system 07
Work datum setting procedure 09
Work coordinate system – Selection 11
Structure of program 13

Course contents
2
FANUC INDIA FA & ROBOT

Course contents Page No.


Basic G codes 17
Basic M codes 26
Tool length compensation 27
Cutter radius compensation 29
Programming Examples 35
Canned cycles – Drilling 47
Pattern of holes 74
Custom macro programming 87
FANUC INDIA FA & ROBOT

General Co-ordinate system

General coordinate system 4


FANUC INDIA FA & ROBOT

Designation of machine axis

Designation of machine axis


5
FANUC INDIA FA & ROBOT

Machine coordinate system

• The point that is specific to


machine and serves as the
reference of the machine
is referred to as the
machine zero point

• Machine tool builder sets a


machine zero point for
each machine

Machine coordinate system


6
FANUC INDIA FA & ROBOT

Work co- ordinate system

A coordinate system used for


machining a workpiece is
referred to as a workpiece
coordinate system

A workpiece co-ordinate system


is also called as work reference
zero or work datum

The work datum will be set by


the user before the machining
process begins

Work coordinate system


7
FANUC INDIA FA & ROBOT

Work co- ordinate system

A coordinate system used


for machining a workpiece is
referred to as a workpiece
coordinate system

A workpiece co-ordinate
system is also called as
work reference zero or work
datum

The work datum will be set


by the user before the
machining process begins

Work coordinate system


8
FANUC INDIA FA & ROBOT

Work datum setting procedure

Move the work table and spindle head


to the reference position

Attach a dial gauge or fix the reference MCS


tool in the spindle

Bring the tool towards the work piece


in rapid mode or manually and make WCS
the tool to touch on the surface of the
workpiece and note the Z axis reading.

Then add the tool length with the same


sign to get the Z co ordinate value and
note down this value

Work datum setting procedure 9


FANUC INDIA FA & ROBOT

Work datum setting procedure cont.,

Then move the tool to any one edge


and make the tool to touch the edge
and note down the readings of X and
Y axes.ADD /subtract the radius of
the tool from the readings

The readings will be the distance


between the machine zero and work
zero point

Record noted X, Y, Z values in any


one of the work coordinate G codes
(G54 to G59)

Work datum setting procedure 10


FANUC INDIA FA & ROBOT

Work piece coordinate system - selection

G54 Workpiece coordinate system 1


G55 Workpiece coordinate system 2
G56 Workpiece coordinate system 3
G57 Workpiece coordinate system 4
G58 Workpiece coordinate system 5
G59 Workpiece coordinate system 6

Work piece coordinate system selection 11


FANUC INDIA FA & ROBOT

Work piece coordinate system Selection

Work piece coordinate system selection 12


FANUC INDIA FA & ROBOT

Structure of Program

Structure of Program 13
FANUC INDIA FA & ROBOT

Structure of Program 14
FANUC INDIA FA & ROBOT

Structure of Program 15
FANUC INDIA FA & ROBOT

Block

Structure of Program 16
FANUC INDIA FA & ROBOT

Basic G codes

- Preparatory function
- Tool movement related functions

Basic G codes 17
FANUC INDIA FA & ROBOT

G94 - Feed per Minute

Basic G codes 18
FANUC INDIA FA & ROBOT

G95 - Feed per revolution

Basic G codes 19
FANUC INDIA FA & ROBOT

Co ordinate value & Dimensioning

- Absolute G90 & Incremental G91 Programming


- Inch & Metric Programming – G20 & G21
- Decimal Point Programming – PRM 3401#0=1

Basic G codes 20
FANUC INDIA FA & ROBOT

Absolute and incremental programming

Basic G codes 21
FANUC INDIA FA & ROBOT

Tool movement in a straight line

Basic G codes 22
FANUC INDIA FA & ROBOT

Tool movement in a circular path

Basic G codes 23
FANUC INDIA FA & ROBOT

Direction of circular interpolation

Basic G codes 24
FANUC INDIA FA & ROBOT

ijk values

Basic G codes 25
FANUC INDIA FA & ROBOT

Basic M codes

- Miscellaneous function
- Machine operations related
functions
• M01 – Optional stop
• M02 – Program stop
• M03 – Spindle on, CW
• M04 – Spindle on, CCW
• M05 – Spindle stop
• M06 – Turret indexing
• M07 – Coolant on
• M08 – Coolant on
• M09 – Coolant off
• M30 – Program stop and rewind

Basic M codes 26
FANUC INDIA FA & ROBOT

Tool length compensation

The procedure of mentioning the difference of length of tool assumed during


programming and actual tool used for machining is called tool length compensation

1) If the actual tool length is more than the assumed tool, the difference
should be mentioned as follows
G43 H01
H01 – here 01 specifies the address where the difference
of tool will be mentioned

2) If the actual tool length is less than the assumed tool, the difference
should be
mentioned as follows
G44 H01
H01 – here 01 specifies the address where the difference
of tool will be mentioned

Tool length compensation 27


FANUC INDIA FA & ROBOT

Tool length compensation

• G43 - Tool length offset plus


• G44 - Tool length offset minus
• G49 - Tool length compensation cancel

Tool length compensation 28


FANUC INDIA FA & ROBOT

Cutter radius compensation

-When the Endmill cutter of some specified


diameter is commanded to position at a location,
actually the centre point of the cutter only
coincide with the addressed point of the work
piece.

- So, t is necessary to shift the cutter for a radius


amount towards left or right from the position.
The procedure of shifting the tool of radius
amount is called as Cutter Radius
Compensation

G41 - Cutter radius compensation left


G42 - Cutter radius compensation right
G40 - Cutter radius compensation
cancel

Cutter radius compensation 29


FANUC INDIA FA & ROBOT

Cutter radius compensation

The type of compensation is selected from


the starting point as follows
Type of Direction of Type of
operation movement compensation
External Clockwise G41
External Counter G42
clockwise
Internal Clockwise G42
Internal Counter G41
clockwise

Cutter radius compensation 30


FANUC INDIA FA & ROBOT

Cutter radius compensation

Cutter radius compensation 31


FANUC INDIA FA & ROBOT

G41 - Cutter radius compensation left

G41 D07;
Here, D specifies the address of
offset at which the radius of tool
will be mentioned

Cutter radius compensation 32


FANUC INDIA FA & ROBOT

G42 - Cutter radius compensation right

G41 D07;

Here, D specifies the


address of offset at which
the radius of tool will be
mentioned

Cutter radius compensation 33


FANUC INDIA FA & ROBOT

Operations performed in machining centre

Side cutting
Hole machining
Face cutting

Operations in machining centre 34


FANUC INDIA FA & ROBOT

Programming Examples

SQ 150

2 3

1 4
G54
SQ 200

thickness
20mm

Programming Examples 35
FANUC INDIA FA & ROBOT

Programming example

Making 150 mm* 150 mm square


for a depth of 5mm in a given Billet

Assumptions
Work offset = G54
Tool length compensation = H01

Point X co ordinate Y co ordinate


value value
1 25 25
2 25 175
3 175 175
4 175 25

Programming Examples 36
FANUC INDIA FA & ROBOT

O1001 ; Program Number


N1 G21 G94 ; Metric input, Feed in mm/min.
N2 G91 G28 X0 Y0 Z0 ; The tool is moved to home position
N3 T01 M06 ; (Dia. 15 mm End drill)
N4 G90 G54 G00 X25.0 Y25.0 ; Work offset call
N5 G43 H01 Z100.0 ; Tool length compensation call
N6 M03 S1000 Z20 ; Positioning above the starting point and
spindle starts rotating at 1000 rpm
N7 G01 Z-5.0 F400 ; The tool is moved inside work of -5.0 mm
N8 Y175.0 ; The tool is moved to second corner
N9 X175.0 ; The tool is moved to third corner
N10 Y25.0 ; The tool is moved to fourth corner
N11 X25.0 ; The tool is moved back to first corner
N12 G00 Z100.0 M05 ; The tool is taken out of the work and
spindle stop
N13 G91 G28 X0 Y0 Z0 ; The tool is moved back to home position
N14 M30 ; Program stop snd rewind
Programming Examples 37
FANUC INDIA FA & ROBOT

PROGRAMMING EXAMPLE WITHOUT SUB PROGRAM


3 4

Blank size: 150mm*150mm*20mm

Point X Y 5
1 0 25 2

2 0 50
1 6
3 45 150
4 105 150 G55
8 7
5 150 50
6 150 25
7 125 0
8 25 0

Programming Examples 38
FANUC INDIA FA & ROBOT

O1002 ; Program Number


N1 G21 G94 ; Metric input, Feed in mm/min.
N2 G91 G28 X0 Y0 Z0 ; The tool is moved to home position
N3 T01 M06 ; (Dia. 15 mm End drill)
N4 G90 G55 G00 X-25.0 Y-25.0 ; Work offset call
N5 G43 H01 Z100.0 ; Tool length compensation call
N6 M03 S1000 Z20 ; Positioning above the starting point and
spindle starts rotating at 1000 rpm
N7 G01 Z-20.0 F400 ; The tool is moved inside work of -20.0 mm
N8 G41 G01 X0.0 Y0.0 D01 ; Cutter radius compensation call
N9 G01 X0.0 Y50.0 ; The tool is moved to point 2
N10 G01 X45.0 Y150.0 ; The tool is moved to point 3
N11 G01 X105.0 Y150.0 ; The tool is moved to point 4
N12 G01 X150.0 Y50.0 ; The tool is moved to point 5
N13 G01 X150.0 Y25.0 ; The tool is moved to point 6

Programming Examples 39
FANUC INDIA FA & ROBOT

N14 G01 X125.0 Y0.0 ; The tool is moved point 7


N15 G01 X25.0 Y0.0 ; The tool is moved to point 8
N16 G01 X0.0 Y25.0 ; The tool is moved to point 1
N17 G40 G00 X-25.0 Y-25.0 ; The tool is moved back to starting position
N18 G00 Z100.0 M05 ; The tool is taken out of the work and
spindle stop

N19 G91 G28 X0 Y0 Z0 ; The tool is moved back to home position


N20 M30 ; Program stop and rewind

Programming Examples 40
FANUC INDIA FA & ROBOT

PROGRAMMING EXAMPLE WITH SUB PROGRAM


3 4

Blank size: 150mm*150mm*20mm

Point X Y 5
1 0 25 2

2 0 50
1 6
3 45 150
4 105 150 G55
8 7
5 150 50
6 150 25
7 125 0
8 25 0

Programming Examples 41
FANUC INDIA FA & ROBOT

O1003 ; Program Number


N1 G21 G94 ; Metric input, Feed in mm/min.
N2 G91 G28 X0 Y0 Z0 ; The tool is moved to home position
N3 T01 M06 ; (Dia. 15 mm End drill)
N4 G90 G55 G00 X-25.0 Y-25.0 ; Work offset call
N5 G43 H01 Z100.0 ; Tool length compensation call
N6 M03 S1000 Z20 ; Positioning above the starting point and
spindle starts rotating at 1000 rpm
N7 G01 Z0.0 F400 ; The tool is moved To Z0.0
N8 M98 P1500 L10 ; Sub program No.1500 call, L indicates
No. of times
N18 G00 Z100.0 M05 ; The tool is taken out of the work and
spindle stop
N19 G91 G28 X0 Y0 Z0 ; The tool is moved back to home position
N20 M30 ; Program stop snd rewind

Programming Examples 42
FANUC INDIA FA & ROBOT

O 1500 ; Sub program No


N200 G91 Z-2.0 F400 ; The tool is moved incrementally -2 mm
N210 G90 G41 G01 X0.0 Y0.0 Cutter Radius comp. (left),
F400 D01 ; The tool is moved towards work piece
N220 G01 X0.0 Y50.0 ; The tool is moved to point 2
N230 G01 X45.0 Y150.0 ; The tool is moved to point 3
N240 G01 X105.0 Y150.0 ; The tool is moved to point 4
N250 G01 X150.0 Y50.0 ; The tool is moved to point 5
N260 G01 X150.0 Y25.0 ; The tool is moved point 6
N270 G01 X125.0 Y0.0 ; The tool is moved to point 7
N280 G01 X25.0 Y0.0 ; The tool is moved to point 8
N290 G01 X0.0 Y25.0 ; The tool is moved to point 1
N17 G40 G00 X-25.0 Y-25.0 ; The tool is moved back to starting position

N310 M99 ; Sub program end

Programming Examples 43
FANUC INDIA FA & ROBOT

PROGRAMMING EXAMPLE WITH SUB PROGRAM

Blank size: 200mm*200mm*20mm


2 3 4 5
R25
Point X Y
1 0 0
2 0 200
3 75 200 R25

4 125 200 1 8 7 6
G57
5 200 200
6 200 0
7 125 0
8 75 0

Programming Examples 44
FANUC INDIA FA & ROBOT

O1004 ; Program Number


N1 G21 G94 ; Metric input, Feed in mm/min.
N2 G91 G28 X0 Y0 Z0 ; The tool is moved to home position
N3 T01 M06 ; (Dia. 15 mm End drill)
N4 G90 G57 G00 X-25.0 Y-25.0 ; Work offset call
N5 G43 H01 Z100.0 ; Tool length compensation call
N6 M03 S1000 Z20 ; Positioning above the starting point and
spindle starts rotating at 1000 rpm
N7 G01 Z0.0 F400 ; The tool is moved To Z0.0
N8 M98 P1501 L10 ; Sub program No.1500 call, L indicates
No. of times
N18 G00 Z100.0 M05 ; The tool is taken out of the work and
spindle stop
N19 G91 G28 X0 Y0 Z0 ; The tool is moved back to home position
N20 M30 ; Program stop snd rewind

Programming Examples 45
FANUC INDIA FA & ROBOT

O 1501 ; Sub program No


N200 G91 Z-2.0 F400 ; The tool is moved incrementally -2 mm
N210 G90 G41 G01 X0.0 Y0.0 Cutter Radius comp. (left),
F400 D01 ; The tool is moved towards work piece
N220 G01 X0 Y200.0 ; The tool is moved to point 2
N230 G01 X75.0 Y200.0 ; The tool is moved to point 3
N240 G03 X125.0 Y200.0 R25.0 ; The tool is moved to point 4 with CIP-CCW
N250 G01 X200.0 Y200.0 ; The tool is moved to point 5
N260 G01 X200.0 Y0 ; The tool is moved point 6
N270 G01 X125.0 Y0 ; The tool is moved to point 7
N280 G03 X75.0 Y0 R25.0 ; The tool is moved to point 8 with CIP CCW
N290 G01 X0 Y0 ; The tool is moved to point 1
N17 G40 G00 X-25.0 Y-25.0 ; The tool is moved back to starting position

N310 M99 ; Sub program end

Programming Examples 46
FANUC INDIA FA & ROBOT

Canned cycles - Drilling

Canned cycles - Drilling 47


FANUC INDIA FA & ROBOT

G81 SPOT DRILLING CYCLE


STEP Description of the cycle
FORMAT AND EXPLANATION
1 Rapid motion to hole position
G81 X…. Y…. R…. Z…. F….
2 Rapid motion to safety X = Hole position in X axis
level/reference level Y = Hole position in Y axis
3 Feed rate motion to Z depth R = Reference position (Z axis st. point)
Z = Final depth (abs.)
F = Federate specification
4 Rapid retract to
initial/reference level

Canned cycles - Drilling 48


FANUC INDIA FA & ROBOT

Programming Example

BLANK SIZE
100*100*20
DIA. 8, FIVE HOLES
HOLE1 (20,20)
HOLE2 (20,80)
HOLE3 (80,80)
HOLE4 (80,20)
HOLE5 (50,50)

Canned cycles - Drilling 49


FANUC INDIA FA & ROBOT

PROGRAMMING EXAMPLE

O1005
N1 G91 G28 X0 Y0 Z0
N2 T01 M06
N3 G21
N4 G17 G90 G54 G00 X20 Y20
N5 G43 H01 Z100
N6 M03 S1000 Z20
N7 G99 G81 Z-4. R5 F300
N8 X80
N9 Y80
N10 X20N11 X50 Y50
N12 G80 G00 Z100
N13 G91 G28 X0 Y0 Z0
N14 M05
N15 M30

Canned cycles - Drilling 50


FANUC INDIA FA & ROBOT

G82 COUNTER BORING CYCLE

STEP Description of the cycle Format and explanation

1 Rapid motion to hole position G82 X…. Y…. R…. Z…. P….F….
2 Rapid motion to safety level/reference level X = Hole position in X axis
Y = Hole position in Y axis
3 Feed rate motion to Z depth R = Reference position (Z axis st. point)
Z = Final depth (abs.)
4 Dwell at the depth in millisecond P = Dwell time in milliseconds
F = Federate specification
5 Rapid retract to initial/reference level

Canned cycles - Drilling 51


FANUC INDIA FA & ROBOT

PROGRAMMING EXAMPLE

BLANK SIZE
100*100*20
DIA. 8, FIVE HOLES
HOLE1 (20,20)
HOLE2 (20,80)
HOLE3 (80,80)
HOLE4 (80,20)
HOLE5 (50,50)

Canned cycles - Drilling 52


FANUC INDIA FA & ROBOT

O1006
N1 G91 G28 X0 Y0 Z0
N2 T02 M06
N3 G21
N4 G17 G90 G54 G00 X20 Y20
N5 G43 H01 Z100
N6 M03 S1000 Z20
N7 G99 G82 Z-15. R5 P2000 F300
N8 X80
N9 Y80
N10 X20
N11 X50 Y50
N12 G80 G00 Z100 M05
N13 G91 G28 X0 Y0 Z0
N14 M30
Canned cycles - Drilling 53
FANUC INDIA FA & ROBOT

DEEP HOLE DRILLING HIGH SPEED DEEP HOLE CYCLE

STEP Description of the cycle STEP Description of the cycle


1 Rapid motion to hole position 1 Rapid motion to hole position
2 Rapid motion to safety 2 Rapid motion to safety
level/reference level level/reference level
3 Feed rate motion to Z depth by 3 Feed rate motion to Z depth by the
the amount of specified depth amount of specified depth

4 Rapid retract to safety level/R 4 Rapid retract by a clearance value


level (clearance value is set by a system
parameter)

5 Rapid motion to the previous 5 Feed rate motion in Z axis by the


depth less a clearance distance specified plus clearance
(clearance is set by a system
parameter)

6 Steps 3,4, and 5 repeat until the 6 Steps 4 and 5 repeat until the
programmed Z depth is reached programmed Z depth is reached

7 Rapid retract to safety/R level 7 Rapid retract to safety/R level

Canned cycles - Drilling 54


FANUC INDIA FA & ROBOT

FORMAT AND EXPLANATION


G73 X…. Y…. R…. Z…. Q….F…. G83 X…. Y…. R…. Z…. Q….F….
X = Hole position in X axis X = Hole position in X axis
Y = Hole position in Y axis Y = Hole position in Y axis
R = Reference position (Z axis st. point) R = Reference position (Z axis st. point)
Z = Final depth (abs.) Z = Final depth (abs.)
Q = Pecking depth (Micron) Q = Pecking depth (Micron)
F = Federate specification F = Federate specification

Canned cycles - Drilling 55


FANUC INDIA FA & ROBOT

WHEN TO USE DEEP HOLE DRILLING CYCLE (G83)


For deep hole drilling, also known as peck drilling, where the drill has
to be retracted above the part (to a clearance position) after drilling to a certain
depth.
WHEN TO USE HIGH SPEED DEEP HOLE DRILLING CYCLE(G73)
For deep hole drilling, also known as peck drilling, where the chip
breaking is ore important than the full retract of the drill from the holes. This type
often used for a long series drills, when a full retract is not very important.

Programming Example

BLANK SIZE
100*100*20
DIA. 8, FIVE HOLES
HOLE1 (20,20)
HOLE2 (20,80)
HOLE3 (80,80)
HOLE4 (80,20)
HOLE5 (50,50)

Canned cycles - Drilling 56


FANUC INDIA FA & ROBOT

O1007
N1 G91 G28 X0 Y0 Z0
N2 T03 M06
N3 G21
N4 G17 G90 G54 G00 X20 Y20
N5 G43 H01 Z100
N6 M03 S1000 Z20
N7 G99 G83 Z-30. R5 Q8000 F300 or G73 Z-30 R5 Q8000 F300
N8 X80
N9 Y80
N10 X20
N11 X50 Y50
N12 G80 G00 Z100 M05
N14 G91 G28 X0 Y0 Z0
N15 M30

Canned cycles - Drilling 57


FANUC INDIA FA & ROBOT

TAPPING CYCLE - STANDARD TAPPING CYCLE - REVERSE

STEP Description of the Cycle STEP Description of the cycle

1 Rapid motion to hole position 1 Rapid motion to hole position

2 Rapid motion to safety 2 Rapid motion to safety


level/reference level level/reference level

3 Feed rate motion to Z depth 3 Feed rate motion to Z depth

4 Spindle rotation stop 4 Spindle rotation stop

5 Spindle reverse rotation (M04) 5 Spindle reverse rotation (M04)


and feed rate back to safety/R and feed rate back to safety/R
level level

6 Spindle rotation stop 6 Spindle rotation stop

7 Spindle rotation normal 7 Spindle rotation normal

Canned cycles - Drilling 58


FANUC INDIA FA & ROBOT

FORMAT AND EXPLANATION


G84 X…. Y…. R…. Z….R… F…. G74 X…. Y…. R…. Z…R….. F….
X = Hole position in X axis X = Hole position in X axis
Y = Hole position in Y axis Y = Hole position in Y axis
R = Reference position (Z axis st. point) R = Reference position (Z axis st. point)
Z = Final depth (abs.) Z = Final depth (abs.)
F = Federate specification F = Federate specification

Canned cycles - Drilling 59


FANUC INDIA FA & ROBOT

The important notes for the tapping operation


• Safety/reference level should be higher in the tapping cycle than in the other cycles to
follow for the stabilization of the feed rate, due to acceleration
• Feed rate section for the tap is very important. In tapping, there is a direct relationship
between the spindle speed and the lead of the tap. This relationship must be maintained at
all the times.
• The override switches on the control panel used for spindle speed and feed rate, are
ineffective during these cycles.
• Tapping motion (in or out of the part) will be completed even if the feed hold key is
pressed during tapping cycle processing for safety reasons.

PROGRAMMING EXAMPLE

BLANK SIZE
100*100*20
DIA. 8, FIVE HOLES
HOLE1 (20,20)
HOLE2 (20,80)
HOLE3 (80,80)
HOLE4 (80,20)
HOLE5 (50,50)

Canned cycles - Drilling 60


FANUC INDIA FA & ROBOT

O1008
N1 G91 G28 X0 Y0 Z0
N2 T03 M06
N3 G21
N4 G17 G90 G54 G00 X20 Y20
N5 G43 H01 Z100
N6 M03 S1000 Z20
N7 G99 G84 Z-15. R5 F300 or G74 Z-30 R5 F300 (Feed = RPM * Pitch)
N8 X80
N9 Y80
N10 X20
N11 X50 Y50
N12 G80 G00 Z100 M05
N13 G91 G28 X0 Y0 Z0
N14 M30

Canned cycles - Drilling 61


FANUC INDIA FA & ROBOT

G85 BORING CYCLE


STEP Description of the cycle
1 Rapid motion to hole position G85 X…. Y…. R…. Z…. F….

2 Rapid motion to X = Hole position in X axis


safety level/reference level Y = Hole position in Y axis
R = Reference position (Z axis st. point)
3 Feed rate motion to Z depth Z = Final depth (abs.)
F = Feed rate specification
4 Feed rate motion back to safety/R
level

Canned cycles - Drilling 62


FANUC INDIA FA & ROBOT

WHEN TO USE THIS CYCLE

This cycle is typically used for boring and reaming


operations. This cycle is used in cases where the tool motion into
and out of holes should improve the hole surface finish, its
dimensional tolerances and/or its concentricity, roundness, etc.

PROGRAMMING EXAMPLE

DIMNSION OF
BLANK
100*100*20
HOLE DIA. 10 mm
HOLE (50,50)

Canned cycles - Drilling 63


FANUC INDIA FA & ROBOT

PROGRAMMING EXAMPLE
O1009
N1 G91 G28 X0 Y0 Z0

N2 T01 M06

N3 G21

N4 G17 G90 G54 G00 X50 Y50

N5 G43 H01 Z100

N6 M03 S1000 Z20

N7 G99 G85 Z-20. R5 F300

N8 G80 G00Z100 M05

N9 G91 G28 X0 Y0 Z0

N10 M30

Canned cycles - Drilling 64


FANUC INDIA FA & ROBOT

PRECISION BORING CYCLE (G76)


STEP Description of the cycle
1 Rapid motion to hole position
2 Rapid motion to
safety level/reference level
3 Feed rate motion to Z depth
4 Spindle rotation stop
5 Shifting in programmed direction
6 Rapid retract to reference level

ROUGH BORING CYCLE (G86)

STEP Description of the cycle


1 Rapid motion to hole position
2 Rapid motion to
safety level/reference level
3 Feed rate motion to Z depth
4 Spindle rotation stop
5 Rapid retract to reference level

Canned cycles - Drilling 65


FANUC INDIA FA & ROBOT

Format and Explanation


G86 X…. Y…. R…. Z…Q... F (rough)
G76 X…. Y…. R…. Z…I…J... F ….(fine)
X = Hole position in X axis
Y = Hole position in Y axis
R = Reference position (Z axis st. point)
Z = Final depth (abs.)
F = Federate specification
Q = amount of shift for boring
I, J = amount of shift

66
FANUC INDIA FA & ROBOT

PROGRAMMING EXAMPLE

O1009
N1 G91 G28 X0 Y0 Z0
N2 T01 M06
DIMNSION OF
BLANK 100*100*20 N3 G21
HOLE (50,50) N4 G17 G90 G54 G00 X50 Y50
N5 G43 H01 Z100
N6 M03 S1000 Z20
N7 G99 G86 Z-20. R5 F300
N8 G80 Z100
N9 G91 G28 X0 Y0 Z0
N10 M05
N11 M30

Canned cycles - Drilling 67


FANUC INDIA FA & ROBOT

BORING CYCLE (G88)


STEP Description of the cycle
1 Rapid motion to XY position
2 Rapid motion to safety level/reference level
3 Feed rate motion to Z depth
4 Dwell at the depth in milliseconds
5 Spindle rotation stops (feed hold condition is generated and the CNC operator
switches to manual operation mode and perform a manual task, then switches back to
memory mode)
6 Rapid retract to safety/reference level
7 Spindle rotation on

G88 X…. Y…. R…. Z….P… F….

X = Hole position in X axis


Y = Hole position in Y axis
R = Reference position (Z axis st. point)
Z = Final depth (abs.)
P = Dwell time in milliseconds
F = Federate specification

Canned cycles - Drilling 68


FANUC INDIA FA & ROBOT

WHEN TO USE THIS CYCLE

This cycle is rare. Its use is limited to boring operations with special tools
that require manual interference at the bottom of a hole. This cycle may be used by
some tool manufacturers for certain operations.

PROGRAMMING EXAMPLE

DIMNSION OF
BLANK
100*100*20

HOLE (50,50)

Canned cycles - Drilling 69


FANUC INDIA FA & ROBOT

O1010
N1 G91 G28 X0 Y0 Z0
N2 T01 M06
N3 G21
N4 G17 G90 G54 G00 X50 Y50
N5 G43 H01 Z100
N6 M03 S1000 Z20
N7 G99 G88 Z-20. R5 P2000 F300
N8 G80 G00 Z100 M05
N9 G91 G28 X0 Y0 Z0
N10 M30

Canned cycles - Drilling 70


FANUC INDIA FA & ROBOT

BORING (REAMING) CYCLE (G89)

STEP Description of the cycle G89 X…. Y…. R…. Z…. P…F….
1 Rapid motion to XY position X = Hole position in X axis
2 Rapid motion to safety level/reference Y = Hole position in Y axis
level R = Reference position (Z axis st.
point)
3 Feed rate motion to Z depth Z = Final depth (abs.)
P = dwell time in milliseconds
4 Dwell at the depth F = Federate specification
5 Feed rate motion back to safety/R level

Canned cycles - Drilling 71


FANUC INDIA FA & ROBOT

WHEN TO USE THIS CYCLE


For boring operations, when the feed rate is required for the in and out
directions of the machined hole, with a specified dwell at the bottom. The dwell is
the only value that distinguishes this cycle from the cycle85/G85.

PROGRAMMING EXAMPLE

DIMNSIONS OF BLANK
100*100*20
HOLE DIA. 10 mm
HOLE (50,50)

Canned cycles - Drilling 72


FANUC INDIA FA & ROBOT

O1011

N1 G91 G28 X0 Y0 Z0

N2 T01 M06

N3 G21

N4 G17 G90 G54 G00 X50 Y50

N5 G43 H01 Z100

N6 M03 S1000 Z20

N7 G99 G85 Z-20. R5 P2000 F300

N8 G80 G00 Z100 M05

N9 G91 G28 X0 Y0 Z0

N10 M30

Pattern of holes 73
FANUC INDIA FA & ROBOT

PATTERN OF HOLES

RANDOM HOLE PATTERN

BLANK SIZE =
100*100*20
DIA. 8, FIVE HOLES
HOLE1 (28,16)
HOLE2 (60,32)
HOLE3 (88,40)
HOLE4 (104,48)

Pattern of holes 74
FANUC INDIA FA & ROBOT

O1012
N1 G91 G28 X0 Y0 Z0
N2 T01 M06
N3 G21
N4 G17 G90 G54 G00 X28 Y16
N5 G43 H01 Z100
N6 M03 S1000 Z20
N7 G99 G83 Z-30. R5 Q8000 F300
N8 X60 Y32
N9 X88 Y40
N10 X104 Y 48
N11 G80 G00 Z100 M05
N13 G91 G28 X0 Y0 Z0
N14 M30

Pattern of holes 75
FANUC INDIA FA & ROBOT

STRAIGHT ROW HOLE PATTERN


First hole dimension
from ref. = (15,10)
distance between
holes = 20,
diameter of
O1013 holes = 10 mm
N1G21 G94
N2 G91 G28 X0 Y0 Z0
N3 T01 M06
N4 G17 G90 G54 G00 X15 Y10
N5 G43 H01 Z100
N6 M03 S1000 Z20
N7 G99 G83 Z-30. R5 Q8000 F300
N8 G91 X20.0 K5
N9 G80 G00 Z100 M05
N10 G28 X0 Y0 Z0
N11 M30

Pattern of holes 76
FANUC INDIA FA & ROBOT

O1014
N1 G91 G28 X0 Y0 Z0
N2 T01 M06
N3 G21
N4 G17 G90 G54 G00 X15 Y10
N5 G43 H01 Z100
N6 M03 S1000 Z20
N7 G99 G83 Z-30. R5 Q8000 F300
N8 G91 X20.0 K5
N9 G80 G00 Z100 M05
N10 G28 X0 Y0 Z0
N11 M30

Pattern of holes 77
FANUC INDIA FA & ROBOT

PATTERN OF HOLES IN AN INCLINED LINE

ANGLE OF THE INCLINED LINE WITH X AXIS = 15


DISTANCE BETWEEN HOLES = 40
FIRST HOLE DIMENSION IS (20,20)
DIAMETER OF HOLES = 10 mm

The following calculation is required in FANUC to find distance between


holes in X axis and in Y axis.
X = 40 * cos15 = 38.63703305
Y = 40 * sin15 = 10.3527618

Pattern of holes 78
FANUC INDIA FA & ROBOT

O1015
N1 G21 G94
N2 G91 G28 X0 Y0 Z0
N3 T01 M06
N4 G17 G90 G54 G00 X20 Y20
N5 G43 H01 Z100
N6 M03 S1000 Z20
N7 G99 G83 Z-30. R5 Q8000 F300
N8 G91 X38.6370 Y10.3527 K5
N9 G80 G00 Z100 M05
N10 G28 X0 Y0 Z0
N11 M30

Pattern of holes 79
FANUC INDIA FA & ROBOT

PROGRAMMING EXAMPLE

RECTANGULAR GRID PATTERN

DISTANCE OF FIRST HOLE


FROM REFERENCE = (20,30)
DISTANCE BETWEEN COLUMNS = 25
DISTANCE BETWEEN ROWS = 20
DIAMETER OF HOLES = 10 mm

O1016
N1 G21 G94
N2 G91 G28 X0 Y0 Z0
N3 T01 M06
N4 G17 G90 G54 G00 X20 Y30
N5 G43 H01 Z100
N6 M03 S1000 Z20

Pattern of holes 80
FANUC INDIA FA & ROBOT

N7 G99 G83 Z-30. R5 Q8000 F300


N8 G91 Y20 K6
N9 X25
N10 Y-20 K6
N11 X25
N12 Y20 K6
N13 X25
N14 Y-20 K6
N15 X25
N16 Y20 K6
N17 G80 G00 Z100 M05
N18 G28 X0 Y0 Z0
N30 M30

Pattern of holes 81
FANUC INDIA FA & ROBOT

CIRCLE OF HOLES PATTERN


Distance of reference point in X axis from the WCS = 75
Distance of reference point in Y axis from the WCS = 60
Starting angle of the first hole from X axis = 30 deg.
Indexing angle between holes = 60, Number of holes = 6
Radius of the circle = 50mm, Diameter of holes = 8mm

2
3
1

4 6

Pattern of holes 82
FANUC INDIA FA & ROBOT

Hole # 1
X = 75 + 50 * cos30 = 118.30127
Y = 60 + 50 * sin30 = 85.0

Hole # 2
X = 75 + 50 * cos90 = 75.0
Y = 60 + 50 * sin90 = 110.0

Hole # 3
X = 75 + 50 * cos150 = 31.6987298
Y = 60 + 50 * sin150 = 85.0
Hole # 4
X = 75 + 50 * cos210 = 31.6987298

Y = 60 + 50* sin210 = 35.0

Hole # 5
X = 75 + 50 * cos270 = 75.0

Y = 60 + 50 * sin270 = 100.0

Hole # 6
X = 75 + 50 * cos330 = 118.30127

Y =holes
Pattern of 60 + 50* sin330 = 35.0 83
FANUC INDIA FA & ROBOT

O1017
N1 G91 G28 X0 Y0 Z0
N2 T03 M06
N3 G21
N4 G17 G90 G54 G00 X118.3012 Y85.0
N5 G43 H01 Z100
N6 M03 S1000 Z20
N7 G99 G83 Z-30. R5 Q8000 F300
N8 X75.0 Y110.0
N9 X31.6987 Y85.0
N10 X31.6987 Y35.0
N11 X75.0 Y10
N12 X118.301 Y35.0
N13 G80 G00 Z100 M05
N14 G91 G28 X0 Y0 Z0
N15 M30

Pattern of holes 84
FANUC INDIA FA & ROBOT

CIRCLES OF HOLES USING POLAR SYSTEM

Distance of reference point in X axis from the WCS = 75


Distance of reference point in Y axis from the WCS = 60
Starting angle of the first hole from X axis = 30 deg.
Indexing angle between holes = 60, Number of holes = 6
Radius of the circle = 50mm, Diameter of holes = 8mm
2
3
1

4 6

Pattern of holes 85
FANUC INDIA FA & ROBOT

O1018
N1 G91 G28 X0 Y0 Z0
N2 T03 M06
N3 G21
N4 G17 G90 G54 G00 X75.0 Y60.0
N5 G43 H01 Z100
N6 M03 S1000 Z20
N7 G16; POLAR SYSTEM ON
N8 G99 G83 X50 Y30 Z-30. R5 Q8000 F300
N9 X50 Y90
N10 X50 Y150
N11 X50 Y210
N12 X50 Y270
N13 X50 Y330
N14 G15 ; POLAR SYSTEM OFF
N15 G80 G00 Z100 M05
N16 G91 G28 X0 Y0 Z0
N17 M30
Pattern of holes 86
FANUC INDIA FA & ROBOT

CUSTOM MACRO PROGRAMMING

Custom Macro programming 87


FANUC INDIA FA & ROBOT

Custom Macro

• Part Program prepared using variables


• Arithmetic operations possible
• Conditional statements like GOTO , DO WHILE are used
• For developing user defined cycles
• Can be easily called from user program

Custom Macro programming


FANUC INDIA FA & ROBOT

Macro call

Custom Macro programming 89


FANUC INDIA FA & ROBOT

Simple Macro Call

Custom Macro programming


FANUC INDIA FA & ROBOT

Custom Macro programming 91


FANUC INDIA FA & ROBOT

Custom Macro programming 92


FANUC INDIA FA & ROBOT

Custom Macro programming 93


FANUC INDIA FA & ROBOT

Model Macro Call- G66

• Once G66 is issued to specify a modal call a macro is


called after a block specifying movement along axes is
executed. This continues until G67 is issued to cancel a
modal call.

Custom Macro programming


FANUC INDIA FA & ROBOT

G66

Custom Macro programming 95

You might also like