You are on page 1of 67

# CNC Mill

G Code Programming

MCAR

May 2012

Part

One Programming Skills
3 Axis Programming
Programming Words
o G Codes
o M Codes
o Program Zero and Work Offsets
o Tool Offsets
Basic Program Structure
CNC Programming Exercise #1
Homework Programming Exercise #2

## Part Two Cutter Radius Compensation

o What is CRC?
o G40, G41 & G42
o The Rules of Cutter Radius Compensation
o Examples of CRC
Programming Methods
o Machine Compensated Programming
o User Compensated Programming

21

## Part Three Canned Cycles

Definition
Various Types
o G73 G76
o G81 G89
G98 & G99 Return Options
Cancelling Canned Cycles G80
Canned Cycle Exercise #1
Homework Canned Cycle Exercise #2
Hole Pattern usage in Canned Cycles
o G70 Hole Circle
o G71 Holes Along Arc
o G72 Holes Along Angle
Hole Pattern Exercise

32

MCAR

May 2012

## Part Four Subroutines

What They Are and How They Work
o M97
o M98
o M99

50

Part

57

MCAR

## Five Understanding Set Ups & Writing Programs

Work Piece Holding
Finding a Zero Point
Tool Selection & Placement
Running the First Part
Preparing to Write Programs
o Process of Machining
o Tooling Selection
o Visual Optimization
o Proofreading for Mistakes / Typos

May 2012

## Part One : Programming Skills

3 Axis Programming
An Example of a Milling Function

## In most milling applications, the Z axis is set at a fixed position to allow

the removal of material using the X and/or Y axis. This includes End /
Face Milling, and Side Milling.
Contour Milling is the only milling function that may use the Z axis
along with the X and/or Y axis to create various angles, radii, and
pockets on a part surface.
In other machine functions such as drilling, boring and tapping, the Z
axis is the axis performing the task and the X and Y axis are set at a
fixed position.

## An Example of a Milling Function

G0 X4. Y2.;
Z-0.5;
G01 X3. F5.;
Y-2.;
X-3.;
Y2.5;
G0 Z1.
This program example cuts a square shape into a part below
the Z axis 0 offset position. Notice how once the Z axis is set, the other
axis do all the work. When they have completed the task, the Z axis
lifts out of the cut to a clearance position.

MCAR

May 2012

## An Example of a Drilling Function

G0 X12.75 Y-6.00;

Position move

X10.25 Y-8.;

G0 G80 Z1. ;

## Cancel canned cycle and clear Z axis to safe location

This program example uses a Deep Hole Peck Drilling Cycle to cut
a hole 3.2 inches deep into a part in two places. The Z Axis is the
primary axis performing all the work to achieve the hole depth.

## Putting it all together

Having three axis available to manipulate opens the door for
countless possibilities of three dimensional machining. The next step
will be to understand and learn the many cycles and functions that the
machine can perform. This will allow a programmer a variety of
options when deciding how to machine a given part.

Exercise
On the next page decide what type of function is being
performed. Choose between a milling function or other function. Be
careful and do not assume that just because you may not see a canned
cycle that the cycle is automatically a milling function

MCAR

May 2012

## 3 Axis Function Type Exercise

Describe what type of function that each group of code is performing.
Your Choices are Milling, Other or Both

## 1. G00 X4.5 Y2.6;

G01 Z-.45 F10.;
G0 Z.5;
2. G00 X4.5 Y2.6;
G81 Z-.45 R.1 F10.;
3. G00 X4.5 Y2.6;
G01 Z-.45 F10.;
X2.5;
4. G00 X4.5 Y2.6;
G01 Z-.45 F10.;
G13 I.75 D01;
5. G00 X4.5 Y2.6;
G76 Z-.45 Q.01 R.1 F10.;
6. G00 X4.5 Y2.6;
G01 Z-.45 F10.;
X6.3 Z-.75;

MCAR

May 2012

Programming Words
What are programming words?
Programming words are a letter/number combination inserted in
a program to tell the machine to perform a task. Each code entered
into a CNC program must contain a letter entered before a numeric
value. This letter/number data is called a programming word. A word
simply tells the machine what parameter data to alter in order to
perform a task. G and M codes are the most common words used in
programming.
Using words to create a program
X, Y, & Z program moves are prime examples of words that tell a
machine where to move to. Various words can be used by themselves
or group inside a canned cycle to allow for complex equations to be
performed. Every function of a program will need different words to
complete the necessary parameters in order to work.
Decimal point usage in words
Words that are used in CNC programming are grouped into two
classes. Ones that allow for a decimal point and others that do not.
The ones that allow a decimal point are:
A, B, C, F, I, J, K, Q, R, U, V, W, X, Y, & Z
The ones that do not allow decimal points are:
D, G, H, L, M, N, O, P, S, & T
When writing a program, you will need to know which codes are
needed to perform a certain task. You will also need to be sure to
include any extra codes that will give the machine enough information
to perform the task you have assigned.
MCAR

May 2012

## It is helpful to have the most used programming G code words

written down on a reference sheet so you will know what their usage
will be when creating a program. It is sometimes equally helpful to list
the different variable words that are often used along with the main G
code.

G Codes
What are G Codes?
G codes are preparatory codes. This means that the codes instruct
the machine to perform a function based on a particular G codes
parameters. Sometimes, additional information must be inserted in the
form of other programming words, along with the G code so that the
function performs as expected.
For example, G00 tells the machine to move in a rapid motion
while G01 tells the machine to move in a controlled motion along a
straight line.
Most G codes must have extra programming words included on
the same line in order to perform the task requested. An example
would be calling G01 which is a linear feed move. Most often, you will
find G01 on a line with X, Y, and/or Z.
There are some G codes however, that can work all by themselves
without the extra words. G20 is the Inch Input G code is an example of
a G code that does not need any other variable to operate.
G codes control a variety of functions such as machine
positioning, offset length compensation, tool radius compensation,
hole pattern creation, canned cycles, feed rate control, to name a few.
What makes G codes so useful is that each code specializes in a
function and thus helps reduce the programming time by requiring
only specific data.
There are just about as many G Codes as there are functions to a
machine.

MCAR

May 2012

## What are some machine operations that

can be performed using G Codes?
Rapid movement
Feed movement
Linear movement
Select fixture offset
Create patterns
G Codes allow the machine to perform simple to complex tasks
such as position the machine, select offsets, move in a controlled
manner, create a hole pattern, cut in a radial motion, just to name a
few. G Codes can reduce the amount of programming time by
condensing the amount of code needed to perform a task.
Using G Codes
When you want to use a G code, the first thing you will need to
ask yourself is, What do I want the machine to do? Once you decide
which function to perform, you will need to know what G code will
need to be used to perform that function. For instance, if you want to
position the machine, one of the first things you want to insert is a G00
for machine rapid positioning.
On the next page, there is a list of common Fanuc based G codes.
Note Every machine tool is different so be sure to check with
your machine tool builder for an accurate list for your specific model
machine.

MCAR

May 2012

G00

Rapid Traverse

G43

## Tool Length Compensation

G01

Linear Feed

G54

Work Offset

G02

Circular Interpolation CW

G80

G03

## Circular Interpolation CCW

G90

Absolute Programming

G04

Dwell

G91

Incremental Programming

G28

Reference Return

G94

G40

G98

G41

G99

G42

## Making Sense of Programming G Codes

A common method of writing any given line of a program that
uses G codes is to call the G code first, then call the other programming
words to add to the function that the G code is performing.
For example,
G00 X4.375 Y2.625;

## The reason for this method is mostly to help identify what is

happening with the particular line you are looking at. If the G Codes
were at any given location on a line, it will be harder for someone to
follow the program from function to function.
For each line entered, you will need to know what data is
required in order to perform the function you are wanting. In the
MCAR

May 2012

10

example above, notice that the X and Y coordinate values were the
same but the machine responded differently based on the G code
called and the other programming words used.
machine uses is to consult the programming manuals for your machine,
contact your machine tool manufacturer or talk to a programmer
within your company. This manual contains only reference material
that may not be available or may not be in the same format that you
need to use. Most programming manuals for a machine tool will have
the basic list of codes like the ones listed above. It will also contain the
format for each G code as well as the various programming words
needed to make the code work most efficiently.
Complex G Codes
When programming, you will come across the need to drill, bore,
ream, and tap holes. One of the most useful functions performed by a
G code is known as a canned cycle. Along with other program words
(variables) the machine will perform a complex task using minimal data
from the programmer. Canned cycles are, in effect, custom macros built
into the machine to act like mini programs when they are called up.
Other complex G codes that will be taught later are cutter radius
compensation for milling functions, and hole patterns for canned
cycles.

MCAR

May 2012

11

## Modal and Non Modal Groups

Most G codes stay active in the control until they are canceled by
another G code of the same group. This is called a modal command.
There are some exceptions. Non Modal commands are ones that
cancel themselves as soon as the function is performed. The following
list shows the various groups and also the ones that do not need to be
cancelled.
Group

Name

Motion

2
3
5
6
7
8
10
12

Plane
Distance
Feed
Units
Cutter Comp.
Tool Length
Return Mode
Coord. System

Group

Name

0 or 00

Non-Modal

Modal G Codes
Codes in the Group

G00,G01,G02,G03,G73,G74,G76,G77,
G80,G81,G82,G84,G85,G86,G87,G88,G89
G17,G18,G19
G90,G91
G93,G94
G20,G21
G40,G41,G42
G43,G49
G98,G99
G54,G55,G56,G57,G58,G59 (work offsets)
Non-Modal G Codes
Codes in the Group

G04,G10,G12,G13,G70,G71,G72,G28,G52,G53,G92

## What to be careful of when selecting G Codes

As you have learned, G codes make the machine perform a task. If
the operator does not use the correct information or possibly an
incorrect G code on any given line of the program, the machine will
still try to perform the task it has be told to do. This is why data
confirmation is so important and making sure the program is always
proof read before each use to insure unwanted, mistyped or incorrect
codes have not been added. Sometimes, it is wise to have another
person check your program for grammatical mistakes, especially long
programs and ones that are critical and have no margin for error.

MCAR

May 2012

12

## Leaving incorrect data in a program may result in a machine error

or the potential hazard of the machine crashing into the work piece,
fixture, or work table.
help to reduce crashes and misshapen parts features.
Correct G code for what you want done
Any variables need to be on the same line
No typographical mistakes
G Codes make the machine perform a task. If the programmer does
not use the correct information or possibly calls an incorrect G code on
any given line of the program, the machine will try to perform the task
it has been told to do. This is why data confirmation is so important
and making sure the program is always proof read before each use to
insure unwanted, mistyped or incorrect codes have not been added.
Leaving incorrect data in a program may result in a machine error or
the potential hazard of the machine crashing

MCAR

May 2012

13

M-Codes
Miscellaneous Codes
M codes are known as Miscellaneous codes. This means that they
perform various tasks on the equipment, such as turn the coolant on
and off, turn the conveyor on and off, start and stop the spindle, and
many more functions. An easy way to remember what an M code does
is to think of the code as a machine code. They are simply a code that
activates and deactivates a series of switches and relays within the
electrical control panel on the machine.
Below are some of the most common M codes used in
programming. Although these are not all of the codes you may use,
they are the most common ones and most machine tool builders do not
alter these common M codes.
M00

Program Stop

M08

Coolant On

M01

Optional Stop

M09

Coolant off

M02

Program End

M19

Orient Spindle

M03

Spindle Start CW

M30

M04

M97

M05

Spindle Stop

M98

M06

Tool Change

M99

## Codes May Be Different

There are no set guidelines for machine tool builders as to what
each M code should be assigned to. Even some machines built by the
same builder from one model year to the next may be different.
Keep in Mind - Only One M-code per line!
There are a few machines that will accept more than one M code
but generally, only one M Code can be used per line of code.
MCAR

May 2012

14

## Basic Program Structure

What is Basic Program Structure?
Almost every program uses the same group of G codes and
programming words at the beginning of the program, for each tool
call, at the end of every tool operation and at the end of the program.
This is called Basic Program Structure.
Compatibility
One of the biggest problems within any shop is writing the
programs so they can be read and understood by anyone. Any person
who writes a program was either taught by someone who has a certain
style or has developed their own style over the years by trial and error.
If you give a print to 10 different programmers at 10 different
companies and tell them to write a program to make the same part,
you will likely come back with 10 different programs. They will all
accomplish the same thing but the formatting will be a little different
within each one. The important thing is to be able to understand what
needs to be in a program and what doesnt.

MCAR

May 2012

15

Start of a Program
Start of a Program
O1234(Part #### for XYZ Company);
(COMMENT);
(T1 TOOL DESCRIPTION);
T1 M06;
G0 G54 G90 X#.# Y#.# S1500 M03;
G43 H01 Z.5 M08;
The code on above is an example of a typical program start up.
Each line of a program ends with a semi colon ( ; ) known as an end of
block ( EOB ). The machine will attempt to execute all the code before
each end of block in a program. If you do not insert an end of block
when you want to end a line of code, errors or erratic machine
movement can occur. For every CNC program on a Fanuc style control,
a program number must be designated for the machines memory. The
letter O is used before a 4 or 5 number program designation for most
Fanuc based controls. It is important to remember to use the letter O
and not a zero here otherwise the machine will generate an alarm and
will not load the program. Any words in parenthesis are called
comments. Comments can be seen by the operator but are ignored by
the machine. The first tool is called as well as the tool change M Code.
Once the machine completes the tool change, it will proceed to the
next line and not before!
The machine now activates a work offset, moves in Absolute and
Rapid mode to the first position and starts the spindle at a set RPM.
Once this has been done, the machine inserts the Tool length offset
value, moves to the initial Z movement and turns the coolant pump on.
You are now ready to cut some chips!

MCAR

May 2012

16

Tool Call
(T1 TOOL DESCRIPTION);
T1 M06;
G0 G54 G90 X#.# Y#.# S1500 M03;
G43 H01 Z.5 M08;
The tool call is very similar to the program start up except the lack
of extra comments and the program number. The rest of the code stays
the same. Even though you may not change your work offset while
running the part, always make a habit of inserting it when calling a
tool. The reason for this is in case you need to power down your
machine while in a cycle. This happens a lot if you have a long cycle
time and it is the end of the work day. For example, you write a
program using G57 and it is a 40 minute total run time. The operator
starts the run 20 minutes before quitting time. Since he knows he will
not finish the entire program, he will activate the optional stop button
and stop the program before the next tool change. The next morning
when he starts the machine back up, the machine automatically
defaults to G54. See where you would run into a problem? If he
advances the program to the next tool and the work offset was not in
there to be picked up, the machine will not be performing the work in
the correct location. The part will be scrap or worse, the machine will
crash.

MCAR

May 2012

17

## Ending for a Tool Cycle

;
G0 G80 Z.5 M09;
G28 G91 Z0;
M01;
Before calling the next tool it is recommended to cancel any canned
cycles, shut the coolant off and to take the machine to its Z Axis home
position.
The M01 is the optional stop M code and will allow the operator to
stop the program before the next tool is called. By having the machine
at Z Axis home position, the operator may safely use the optional stop
to check the part or tool as it completes this portion of the program.
Things the operator may check for include, surface finish, tool wear,
broken tool(mainly for small end mills and taps), part size, and part
clamping. With the optional stop, the operator does not have to stop
the program every time, but he/she does have the option to do so if
needed.

MCAR

May 2012

18

Ending of a Program
;
G0 G80 Z.5 M09;
G28 G91 Y0 Z0;
M30;
When ending a program, you will most likely want to position the
machine so the operator can get to the work piece without reaching
too far into the machine. Moving the Y Axis out and the Z Axis to their
home positions will allow the operator to gain easy access to the vise
or fixture, making work piece change out less cumbersome. If only one
tool is used throughout the program, the Z Axis does not need to be
taken to the home position, this is only done to assure that the tool
does not interfere with the operator as he/she changes parts.

Exercise
For the exercise on the next page you will need to write the code for a
program start up, tool call, end of tool, and end of program. The code
provided next to each exercise number will give you all the required
information. Simply rearrange all of the information in order. Some or
all of the code may not be positioned on the line where it is needed.

MCAR

May 2012

19

## Program Structure Exercise

1. X3. , S1500, G90,M06;
H01, T01, M03,Y5., G43;
(T1 3/8 SPOTTER)

## O1234, G54, M08, Z1.;

(ABC COMPANY), G00
(Z0 IS TOP OF PART);
2. M01, G91, M09;
G80, Z0, Z.5;
G28, G00;
3. M06, Y8., M08, M03;
G00, T04, X6., G43, S2200;
Z1., M08, G56, H01, ;
(T4 1/2 DRILL), G90;
4. G00, G91, Z0;
G80, M30, M09;
G28, Y0. Z.5;

MCAR

May 2012

20

## Part Two : Cutter Radius Compensation

Cutter Radius Compensation is a G code that is inserted into a
particular part of the program so the machine is made to shift or
compensate the tool based on the tools size. This will allow the tool
to mill along the edge of a tool while programming the actual shape
of the part.
Once inserted, the machine recalculates the complex
mathematical equations based on part and tool geometry. The tool
then moves around the new computer modified path so that that it
cuts on the edge of the tool at all times. When finished, the machine
shifts the tool back to the centerline position, in effect, out of
compensation mode.
Without Cutter Radius Compensation, the programmer would
have to make the calculations otherwise the tool path would follow
the centerline of the cutter, thus machining the part undersize.
Cutter Radius Compensation is one of the most useful functions
of modern CNC machining. It can also be one of the most frustrating if
certain rules are not followed when inserting it into programs. There
are no set order to the rules, only that they ALL must be followed to
generate a tool path with no errors.
The three G Codes used with Cutter Radius Compensation are
G40(Cutter Compensation Cancel), G41(Cutter Compensation Left) &
G42(Cutter Compensation Right).

MCAR

May 2012

21

The Rules
These simple rules must be followed when using Cutter Radius
Compensation. They do not need to be followed in exact order, only
that they ALL need to be followed.
Rule #1: Figure which mode of Cutter Radius Compensation is
to be used.
Figure G41 or G42 based on what you want the cutter to do and
how the cutter will be interacting with the part.
More programming mistakes are made from making the wrong
compensation selection than other compensation errors

## Rule #2: The Tool must be positioned at least one thousandth of

an inch (.001) more than the radius amount of the cutter size
away from the start where cutter compensation is to be used.
Simply put, shift the tool in the correct direction and distance
from the part. The location where the shift occurs is often called the
Example: If you are using a 1 diameter end mill and are going to cut
along the right edge of a part, the position must be at least .501 more
than the actual position of the upper right corner of the part.
One thing to note, any extra material, from a cast surface or
previous milling operation, must be added to the amount shifted,
otherwise the tool will move down and possible crash into the work
piece.

MCAR

May 2012

22

## Rule #3: Do not insert a G41 or G42 in a line with a Z axis

movement.
What this does is selects Z axis as the plane being shifted and will
cause an error in compensation or give a machine error citing improper
compensation.

Rule #4: Do not try to cut an ID radius that is smaller than the
One of two things will happen.
1: the machine gives a compensation error alarm. (This is the better of
the two)
2: the machine plunges the tool into the part in an attempt to make
the compensation. This results in an imperfection.

## Rule #5: Clear the work piece completely before canceling

cutter compensation.
On some machines, when cutter compensation is cancelled, the
machine physically shifts the tool back into centerline mode.
If your tool is not completely clear, it may crash into the part.
On most machines you may move up on the Z axis once you are in
cutter compensation, it is wise to move up and clear the work piece,
then cancel cutter compensation in order to avoid crashing into the
part.
MCAR

May 2012

23

## Rule #6: Be sure to enter the tool radius or diameter (depending

on machine) into the offset page before running an operation
with cutter compensation.
If the offset value is incorrect, even in graphics enabled machines,
either an alarm will be generated or the tool path will look correct.
The resulting part may be cut out of tolerance.
The Mystery of
Cutter Compensation is solved!
Cutter Compensation should not be a burden nor should it be
something that frustrates the programmer.
It was designed to make your life easier and your programming a
lot more practical.
Following the rules above will give a firm basis and
understanding of what needs to be present for cutter compensation to
work correctly.
If your cutter compensation alarms out when you try to use it,
chances are, it was because one of the rules stated above was not
followed.
The more you use it, the more it will feel natural is a good rule of
thumb to go by.

MCAR

May 2012

24

## The following are examples of Cutter Radius Compensation

used in a program.
T1 M06; Tool call, tool change
G0 G90 G54 X3.5 Y3.55 ; Rapid to first position, work offset call
S2000 M03; Set spindle speed and start spindle clockwise
G43 H01 Z.1; Set tool length offset and position .100 above Z0
G01 Z-0.5 F50.; Linear feed in Z axis to deep at 50 IPM
G41 X3. D01; Cutter comp left, dia. offset #1
Y0.; Move to next coordinate in shape
X0.; Move to next coordinate in shape
Y3.; Move to next coordinate in shape
X3.1; Extra clearance added for cutter comp cancel
G40 X3.65; Cancel cutter comp
G0 Z1. M09; Rapid to 1.0 above Z0 and turn coolant off
M30; End of program and rewind
In this example, the machine shifts into Cutter Compensation,
makes a square and then shifts out of Cutter Compensation.

MCAR

May 2012

25

## Same Program as above except an optional Z Clearance before

T1 M06; Tool call, tool change
G0 G90 G54 X3.5 Y3.55; Rapid to first position, work offset call
S2000 M03; Set spindle speed and start spindle clockwise
G43 H01 Z.1; Set length offset and position .100 above Z0
G01 Z-0.5 F150.; Linear feed in Z axis to deep at 150 IPM
G41 X3. D01; Cutter comp left, dia. offset #1
Y0. F10.; Move to next coordinate in shape, feed at 10 IPM
X0.; Move to next coordinate in shape
Y3.;. Move to next coordinate in shape
X3.1; Extra clearance added for cutter comp cancel
Z.1 F150.; Feed up to Z.1 (for extra piece of mind)
G40 X3.65; Cancel cutter comp
G0 Z1. M09; Rapid to 1.0 above Z0 and turn coolant off
M30; End of program and rewind

## Please complete the Following exercise. Using the print, write a

MCAR

May 2012

26

Programming Methods
Types of Programming Methods
There are two types of programming methods used in profile
milling operations on modern machining centers, Machine
Compensated and User Compensated.
For all other non milling operations such as drilling, tapping, etc.
The tool centerline is ALWAYS programmed.
Machine Compensated Programming Method
Machine Compensated programming is the most widely used
method of programming side milling functions. Common examples of
side milling functions are Pockets, Profile, and Slots. This type of
programming involves positioning the cutter in reference to the actual
dimensions of the work piece shape. The programmer then uses Cutter
Radius Compensation to allow the machine to perform complex
calculations that produces an offset tool path based on the required
data entered. If the operator needs to change the tool size, all he/she
would have to do is make sure the proper diameter is inserted into the
tools Diameter Offset location in the offset page. The machine will
then recalculate the new path using this new diameter.
Example of Machine Compensated Programming
The following Code is an example of Machine Compensated
Programming using the picture to the right of the code.

MCAR

May 2012

27

T1 M06;
G0 G54 G90 X5. Y5. S1500 M03;
G43 H01 Z.5 M08;
G01 Z-.5 F50.;
G41 X4. D01;
Y0. F15.;
X0.;
Y4.;
X4.5.;
G40 X5.5 F50.;
G0 Z.5 M09;
G28 G91 Y0 Z0;
M30;
What you are seeing in the above example is a machine
compensated method of programming. The part is a 4 Square. Using
Cutter Comp, you simply insert the cutter compensation and program
the actual size of the profile you wish to machine. Using the offset
values you assign while setting up the tools, the machine will adjust
the tool path then compensate for the tool size as it moves to each
coordinate.
Key factors for this type of programming are the correct Cutter
Compensation Mode, Inserting the D# value when using Cutter Comp,
and Using Cutter Compensation Correctly(lead in /out)
User Compensated Programming Method
User Compensated programming is mostly used in older
equipment that does not have Cutter Radius Compensation.
All the programmed moves must be calculated out manually to
compensate the cutters size in reference to the geometry being
machined.

MCAR

May 2012

28

## Example of Machine Compensated Programming

The following Code is an example of Machine Compensated
Programming.
T1 M06;
G0 G54 G90 X4.5. Y4.5 S1500 M03;
G43 H01 Z.5 M08;
G01 Z-.5 F50.;
Y-.5 F15.;
X-.5;
Y4.5;
X4.5.;
G0 Z.5 M09;
G28 G91 Y0 Z0;
M30;

## What you are seeing in the above example is a user compensated

method of programming. The part is a 4 Square. The programmer will
have to calculate and shift the programmed tool path so manually
compensate for the tool size.
Key factors for this type of programming are calculations and tool
size.

MCAR

May 2012

29

## How to pick one over the other

Decisions, decisions, decisions. A lot of programmers say it is more
logical to program most profile milling functions using Machine
Compensated programming. The reason being, the shape of the part
can be directly input eliminating all of the extra math equations
involved in manually compensating the tool path. This results in less
arithmetic mistakes and faster programming times.
Look at the following drawing and decide which methods of
programming you would choose.

In this example, can you see how much more work a programmer
will need to do in order to calculate all the end points for each
manually compensated moves while the machine compensated method
will allow the programmer to just insert cutter compensation and
program to exact points as they are referenced on a part print?

MCAR

May 2012

30

## When complex geometry like angles and radii are part of a

profile, the programmer will need to use geometry and trigonometry
to figure out the end points for each move. With that in mind, think of
how much more arithmetic it will take to compensate the programmed
paths using a certain sized tool and then having to change that tool to
a different sized one, while in production of those parts. It would be
like having to reprogram the entire operation because in fact, you
would have to in order to get the correct end points.
Below are some shapes, determine what type of programming method
should be used.

MCAR

May 2012

31

## Part Three : Canned Cycles

What is a canned cycle?
G-Code
Input data
Describes a feature
Minimal programming
Standard
Canned cycles are one of the most useful series of G-Codes in all
of CNC programming. They can make a programmers job easier and
more efficient by utilizing minimal required data to end up with a
seemingly complex programming function.

Functions
Below are the functions that canned cycles can perform.
Spot drilling
Drilling, straight and peck
Reaming
Boring
Tapping
Structure
Position machine
Call cycle
Perform cycle
Parameters
A typical canned cycle requires the machine to be in position
before the canned cycle is called. Once the canned cycle is called, it will
perform the operation at that location. The programmer will also
need to know what parameters to alter or insert in order for the cycle
to work correctly.

MCAR

May 2012

32

Example

G81Z-1.0F15.0R.100
G81 Canned cycle
Z Final depth
F Feed rate
R Reference (rapid) plane
Modal or Non Modal?
If a machine is moved to a new position without cancelling the
canned cycle, the machine will perform the same operation at the new
location as soon as the machine stops moving. Canned cycles are
considered modal, meaning they stay active until cancelled.
When programming a canned cycle, you will first need to decide
what function you want to perform and if a cycle is available to do so.
Canned cycles cover most drilling, boring, counter boring, spot facing,
tapping, and reaming applications. Each canned cycle is similar in
appearance but the G-Code that controls it will dictate what function it
will perform and the data required making it work.
Here is a list of the standard Fanuc style canned cycles:

MCAR

May 2012

33

G Code

Cycle Type

Cycle Description

G73

Speed Peck

G74

Tapping Cycle

G76

Boring

G77

Boring

## Back boring with shift in/out

G81

Drilling

Straight drilling

G82

Drilling

G83

Drilling

G84

Tapping

G85

Boring/Reaming

G86

Boring

G87

Boring

G88

Boring

G89

Boring/Reaming

MCAR

May 2012

34

## Creating a Canned Cycle

Variables, finding the perfect recipe
The variables in the cycle are preset and are commonly used in
many machines with Fanuc style controls. They can control everything
from the Z axis movement, the depth of cut, the feed of the machine,
and what type of function is being preformed among other things as
well. The different variables are common CNC commands called
programming words. A word will start with a letter then followed by a
number otherwise known as an Alpha-Numeric statement. The number
portion of the statement will sometimes allow a decimal point to be
used and sometimes not.
Understanding the variables can be confusing and you may find it
beneficial to create a reference sheet like the example on the next
page. This will help you when using cycles that you are not familiar
with.
To explain how a canned cycle works using variables, try to think
recipe and use the ingredients correctly, you will be eating something
tasty really soon. Lets say you choose to skip on some ingredients, you
may still end up with a finish product but it will probably not be as
satisfying. If you use the wrong ingredients or leave out the most
important ones, you will more than likely be dining out because
whatever it was you were trying to make, will not turn out. A canned
cycle is along the same thinking. You need to use all the required
variables to work perfectly. Leaving some variables out, the cycle will
still work but maybe not as efficiently. If, however, you enter variables
that do not belong or are entered incorrectly, it will cause the machine
to reject the code all together and you will have to reprogram the cycle
before it will operate.

MCAR

May 2012

35

## Why are certain words repeated in the various canned

cycles?
Some information you may find in one canned cycle will be used
in others. They are things the cycle will have in common such as a
reference plane, feed rate, etc.
The G Code itself defines the machining process that occurs and
will also dictate how much extra information is required. The extra
data helps define how that process takes place.
For example, If you are drilling a shallow hole, then there will be
minimal information needed: Where to start, how deep to go and how
fast to feed the tool into the work piece. If you are doing complex
start, how deep to go, how fast to feed the tool into the work piece,
how deep to go before retracting, how much to deduct from each
pass, where to retract the tool for each peck.

MCAR

May 2012

36

P
Q

## Bold letters indicate commonly used variables.

Bold and Underlined letters indicate required variables.
It is sometimes useful to make a cheat sheet of the various canned
cycles and have the other words listed with each one so you will not
only be sure to use the correct ones with the correct cycle, but you will
also keep from omitting or including data that would prevent the
function from being performed properly.
In cycles such as G73 for example, you may enter a simple form of
clearance and peck amount or you may make the machine use
reducing peck amounts as the tool goes deeper. You can also make the
machine peck so many times then retract to clear chips.
MCAR

May 2012

37

Just the same, too little information can cause mistakes as well.
Most CNC machines have codes that are called modal which means
they remain active in the memory until altered by the user. A common
modal command is feed rate. If you do not enter a new feed rate when
you want it to change, it will stay the same and may cause issues such
as when tapping.
This is why it is important to know all the variables before you try
to enter them in and not shoot from the hip as it were when
entering data. Carefully constructed programs will allow for less
mistakes and faster set up times.
Once you have used a canned cycle several times, you will start to
memorize the variables used in that cycle. You may not remember
them all for every cycle, but the main ones will surely become familiar
to you. Now that you have the cycle picked out, the next step will be to
add the variables and write the code as needed. Most programmers
will try to use the same format from cycle to cycle so that each cycle is
easy to read. An example of this will be as follows;
G81(canned cycle) Z-3.5 (final depth) R.1(reference, rapid plane,)
F4.5(feed Rate); these codes are the minimum requirements for a
canned cycle.
G73 Z-3.5 Q.25 K.75 R.1 F4.5;
G83 Z-3.5 Q.175 R.1 F4.5;
The above three sets of cycles show the Z depth is written after
the G Code calling the cycle. Next are the variables. Notice how the R
reference (rapid) plane and the F feed rate stay in order next to one
another? This is more for ease of reading for the programmer than
anything else. It will be up to you on how the codes are entered. The
more confusing you write the program, the harder and longer it takes
for someone to set up and operate. Try to follow some sort of
repeatable pattern. In short, keep things simple.

MCAR

May 2012

38

The three sets of cycles listed above will drill the exact same hole
to the exact same depth, the only difference is how the machine will
control chip build up and coolant penetration down inside the hole.
Each cycle allows the Z axis to be manipulated in different ways in
order to achieve the objective of a hole that is 3.5 inches deep. The G73
and G83 cycles help to force the chip to break up as it is ejected from
the emerging hole while occasionally allowing coolant to flush down
into the hole.
Potential Pitfalls
Now that you have the code structure figured out, insert your
cycle and the variables needed. This may be a little tricky if you do not
understand the process of the cycle or the tools being used. For
example, if you wanted to drill a deep hole, how often should you
want the drill to retract per pass? Should you take multiple pecks
before retracting completely to clear the chips? How much feed should
there be pushing a long drill bit versus pushing a shorter one? There
may be a lot of potential questions per cycle. This knowledge comes
the machines, work with the materials, and have experience with the
tooling on a daily basis. It has been a common theme in the industry
that the best programmers are the ones who have some machining
background, knowledge of tooling, and most importantly, understand
process of machining. Though it is not required, it is an invaluable
asset.
Using G98 & G99 Canned Cycle Return Plane
G98 & G99 are used in canned cycles to change the way the Z axis
is returned to a clearance position after each completed operation.
G98 returns the Z axis after each completed canned cycle to the initial Z
axis starting location(The last Z position before the start of the canned
cycle) before moving to the next location. This is extremely handy for
moving around clamps and other obstructions.
MCAR

May 2012

39

## G99 returns the Z axis to the R starting position, as defined in the

canned cycle, after each completed canned cycle.
G98 or G99 are usually inserted after the can cycle is called for
aesthetics but can be called before the canned cycle on the same line
or on a separate line with each position move allowing for more
efficient machining if only a couple positions have an interference
potential. Either G98 or G99 is active when you start the machine
depending on a parameter setting.
Using both methods during one cycle
Example:
G81 G98 Z-.5 R.1 F5.;
X3.5 Y2.;
G99 X5.;
G98 X7.5 Y1.25;
When you see this called out like this, it is usually because of an
obstruction of some kind. You may want to put in a programmers
note so the operator will understand why you are doing this.
Cancelling Canned Cycles
To cancel the canned cycle, you simply need to insert a G80 GCode at the end of the cycle. G80 is the cancel code for canned cycles
from G73-G89. A common G-code often found on the same line as the
G80 is the G00 rapid command. This allows the machine to go into a
rapid movement for the next position move. This is often inserted as a
precautionary move in case the machine does not load G00 by default
when a G80 command is executed.
You may also use a G80 to end a canned cycle before calling a
new one. Here is an example.
G81 Z-.5 R.1 F5.;
X6. Y-5.;
X8. Y-4.;
G00 G80 X10. Y-2.;
G81 Z-1. R.1 F3.5;
MCAR

May 2012

40

G00 G80;
In Review
As you have read, canned cycles are very powerful tools that you
can use to shorten the amount of programming you will need to do in
order to complete a task. Instead of writing each line of code for each
peck of a deep hole drilling cycle, for example, the canned cycle uses
built in macros that are designed to eliminate all of the extra
programming work and potential costly errors as well. Once they are
mastered, the cycles will undoubtedly become second nature when
There are two exercises that follow on canned cycles.

MCAR

May 2012

41

## Canned Cycle/ Programming Exercise #1

Study the following program then fill in the blanks with the missing G and M Codes.

O1500(CANNED EXERCISE
#1);
(X0 Y0 IS TOP LEFT CORNER
OF PART);
(Z0 IS TOP OF PART);
(TOOLS);
(T1 1/2 SPOTTER);
(T2 5/16 DRILL);
(T3 3/8 X 16 TAP);
(T4 7/16 DRILL);
;
T1 M06 (1/2 SPOTTER);
G00 ____ G54 X2.5 Y-1.25;
S1000 M03;
____ H01 Z1. ____;
G81 G99 Z-.13 R.1 F3.;
X5. Y-.75;
X7.5 Y-1.25;
X8.5 Y-3.;
X5.Y-3.;
X7.5 Y-4.75;
X5. Y-5.25;
X2.5 Y-4.75;
X1.5 Y-3.;
G00 ____ M09;
____ G91 Z0;
M01;
T2 ____ (5/16 DRILL)
____ G90 G54 X2.5 Y-1.25;
S1200 M03;
G43 ____ Z1. ____;
MCAR

## G73 ____ Z-1.2 Q.15 R.1 F6.;

X7.5;
Y-4.75;
X2.5;
G00 G80 ____;
G28 G91 Z0;
____;
T3 M06 (3/8 X 16 TAP)
G00 G90 ____ X2.5 Y-4.75;
S500;
G43 H03 Z1. ____;
G84 G99 Z-.75 R.15 F31.25;
Y-1.25;
X7.5;
Y-4.75;
G00 G80 ____;
G28 ____ Z0;
M01;
T4 M06 (7/16 DRILL)
____ G90 ____ X5. Y-.75;
S1000 ____;
G43 H04 Z1. M08;
G83 ____ Z-1.75 Q.175R.1
F3.;
X8.5 Y-3.;
X5. Y-3.;
X5. Y-5.25;
X1.5 Y-3.;
G00 ____ M09;
____ ____ Y0 Z0;
____;
May 2012

42

## Canned Cycle/ Programming Exercise #1

Study the following program then fill in all of the blanks with the missing G and M Codes.
T1 Is a Straight Drilling cycle, T2 is a Straight Drilling cycle,
T3 & T4 are Deep Hole Peck Drilling cycles

## O1600(CANNED EXERCISE #2);

(X0 Y0 IS TOP LEFT CORNER OF
PART);
(Z0 IS TOP OF PART);
(TOOLS);
(T1 5/8 SPOTTER);
(T2 3/8 DRILL);
(T3 1/4 DRILL);
(T4 1 DRILL);
T1 ____ (5/8 SPOTTER);
____ ____ ____ X2. Y-2.;
S800 ____;
____ H01 Z1. ____;
____ G99 Z-.12 R.1 F4.;
X8.
X10.
Y-3.5
X7.75 Y-5.
X5.25 Y-7.25
X3. Y-8.
____ G80 Z1. ____;
____ ____ Z0;
____;
T2 ____ (3/8 DRILL)
____ ____ ____ X2. Y-2.;
S1200 ____;
____ H02 Z1. ____;
____ ____ Z-.75 R.05 F5.;
X10.;
X7.75 Y-5.;
MCAR

X3. Y-8.;
____ ____ ____;
____ ____ Z0;
____;
T3 ____ (1/4 DRILL)
____ ____ ____ X8. Y-2.;
S1200 ____;
____ H03 Z1. ____;
____ G99 Z-1.6 Q.1 R.15 F5.5;
X10. Y-3.5;
____ ____ ____;
____ ____ ____;
____;
T4 ____ (1 DRILL)
____ ____ ____ X5.25 Y-7.25;
S375 ____;
____ H04 Z1. ____;
____ G99 Z-1.5 Q.075 R.1 F8.;
____ ____ ____;
____ ____ Y0 Z0;
____;

May 2012

43

Hole Patterns
Taking the guess work out of hole patterns
Whenever you are programming and need to make a series of
holes along a circle, arc, or angle, there is a series of codes that will
simplify this task. The of G70- G72 hole pattern G Codes are considered
a support G Code series. What this means is that they do not actually
call the function to tell the machine how to make the holes. Instead,
these codes will help position the machine after the hole making G
Code is called. With only a few required operator parameters, you can
create a series of holes for a circle, arc or along an angle.
G70 Circular Hole Pattern
G70 I#,J#,L#
J = Starting Angle
L = Number of Holes
Out of the three pattern types, G70 is the most used. You will
come across it most in any industry drilling flanges. This function
simplifies and eliminates the need of mathematical equations in order
to figure out the various locations of a hole pattern around a circle.
The programmer simply positions the machine to the center of the
planned pattern, inserts the starting radius of the circle, the angles for
the first hole location and the number of evenly spaced holes from the
starting location. The computer then breaks down the pattern by
figuring each set of coordinates, starting with the first one described
by the programmer. It will then move counter clockwise around the
circle to each location where a hole is calculated to be. When finished,
the machine returns to the original circle center location and cancels
the cycle.
MCAR

May 2012

44

## It is important to note that when you are using a hole pattern of

any type to be sure to insert an L0 on the line of the canned cycle.
Otherwise, the machine will try to put a hole at that position when the
canned cycle is called.
Below is an example of a G70 with a G81 canned cycle called
before it.
G00 X0. Y0.;
G98 G81 Z-1. L0 R.05 F4.;
G70 I6. J45. L8;
The machine will position to the center point of the circle, in this
case, it is X0, Y0. From there, the canned cycle is called but notice the
L0 which tells the machine not to drill a hole in that location. The hole
pattern is called on the next line. Starting at a 6 radius and 45 up
CCW. (imagining a clock face, 0 would be at the 3 oclock position)
After completing the first hole, the machine would continue on to add
7 more holes evenly spaced around a circle from the first location. The
machine would then return to the center of the pattern and the cycle
would cancel.
G71 Holes Around an Arc
G71 I#,J#,L#
J = Starting Angle
K = Angle Between Holes
L = Number of Holes
Similar to G70, the G71 pattern will create hole locations using
much the same equations and style that G70 uses, however, instead of
a full circle, this cycle will insert precisely spaced holes along an arc that
is defined by the programmer. The same radius callout will define the
MCAR

May 2012

45

size of the arc. The first hole location starts the same way as the G70 as
well. The programmer will then insert the amount of spacing between
each hole and the total number of holes. These two factors will
determine how long the total arc amount will be. It is possible to
create a full circle using this method but it would be easier to just use
the G70 pattern code if a full circle was desired.
Below is an example of a G71 cycle with a G81 canned cycle called
before it.
G00 X0. Y0.;
G98 G81 Z-1. L0 R.05 F4.;
G71 I6. J45. K25. L4;
As with the G70 cycle the machine will position to the center
point of the circle, X0, Y0. From there, the canned cycle is called but
again, notice the L0 which tells the machine not to drill a hole in that
location. The hole pattern is called on the next line. Starting at a 6
radius and 45 up CCW. (imagining a clock face, 0 would be at the 3
oclock position) After completing the first hole, the machine would
continue on to add 3 more holes spaced 25apart from the first
location. The total length of the arc in this case would be 100. The
machine would then return to the center of the pattern and the cycle
would cancel.

MCAR

May 2012

46

## G72 Holes along an angle

G72 I#,J#,L#
I = Distance Between Holes
J = Angle
L = Number of Holes
Unlike the previous two patterns, the G72 creates a hole pattern
along an angle. The programmer will specify the starting position and
call the canned cycle as in the other two pattern cycles, but this pattern
does not revolve around an arc. Instead, the programmer will insert an
angle, the spacing between holes and the number of holes to be
inserted. Below is an example of a G72 pattern with a G81 canned cycle
before it.
G00 X0. Y0.;
G98 G81 Z-1. L0 R.05 F4.;
G72 I1. J45. L4;
The machine will drill 4 holes, 1 apart on a 45 angle starting at
X0, Y0. When completed, the cycle will return to the starting location
and cancel itself.
The G70 G72 cycles play a supporting role not only reducing the
amount of code required to perform these complex tasks, but it also
reduced the amount of math skills needed to calculate each position.
Not all patterns fit into this group of cycles. Any pattern needing holes
not equally spaced will have to be calculated or another cycle written
specifically for those holes. The equal spacing requirement is the only
hang up when using these patterns.
Complete the following Exercises to help with understanding G Code.

MCAR

May 2012

47

Study the print on the next page. Using the locations from the print fill in the blanks with
the correct Hole Pattern Cycle G Code and its variables.

## O1500(Hole Pattern #1);

(X0 Y0 IS TOP LEFT CORNER OF
PART);
(Z0 IS TOP OF PART);
(TOOLS);
(T1 1/2 SPOTTER);
(T2 5/16 DRILL);
(T3 3/8 X 16 TAP);
T1 M06 (1/2 SPOTTER);
G00 G90 G54 X3.5 Y4.25;
S1000 M03;
G43 H01 Z1. M08;
G81 G99 Z-.13 R.1 F3. L0;
G
I
J
K
L
;
X6. Y1. L0;
G
I
J
K
L
;
X10. Y5.75 L0;
G
I
J
K
L
;
G0 G80 M09;
G28 G91 Z0;
M01;
T2 M06 (5/16 DRILL)
G00 G90 G54 X10. Y5.75;
S1200 M03;

MCAR

## G43 H02 Z1. M08;

G73 G99 Z-1.2 Q.15 R.1 F6.;
G
X6. Y1. L0;
G
X3.5 Y4.25 L0;
G
G00 G80 M09;
G28 G91 Z0;
M01;
T3 M06 (3/8 X 16 TAP)
G00 G90 G54 X3.5 Y4.25;
S500;
G43 H03 Z1. M08;
G84 G99 Z-.75 R.15 F31.25;
X6. Y1. L0;
X10. Y5.75 L0;
G00 G80 M09;
G28 G91 Y0 Z0;
M30;

May 2012

;
;
;

;
;
;

48

MCAR

August 2010

49

## Part Four : Subroutines

What are Subroutines?
Subroutines are portions of data that is stored either locally or in
a separate program that allows a function to be called with minimal
data once the initial cycle is written. This allows for custom or
repetitive functions to be performed throughout a program.
Subroutines also allow for programs to be smaller and more
efficient without limiting the number of operations or fixture locations
that can be used.
Calling and Cancelling Various Subroutines
Subroutines are portions of data that is stored either locally or in
a separate program that allows a function to be called with minimal
data once the initial cycle is written. This allows for custom or
repetitive functions to be performed throughout a program.
Subroutines also allow for programs to be smaller and more
efficient without limiting the number of operations or fixture locations
that can be used.
M97 calls a local subroutine in that the portion of code is
actually stored at the end of an existing program.
M98 calls an entirely separate program which contains the code
that will be used.
M99 is used to end a subroutine and is inserted in place of the
M30 at the end of the data.

MCAR

April 2010

50

## M97 - Call Local Subroutine

M97 is mostly used when multiple position moves are required
and are used by several tools. This M function keeps all the program
data locally and for use mostly on one part.
It is called in the program by inserting the canned cycle and then
calling an M97 on the next line to call the data that will be used
repetitively. A P and the N sequence number is then added to call
the correct data.
M97 P100;
When the P100 is called, the machine searches the program for
the N100 sequence number and will being using the data from this
location until cancelled by the code M99.
The N100 should be inserted after the M30 otherwise the
machine will see the data as commands when it passes it if it is entered
before the M30 command.
M98 - Call Program Subroutine
M98 works similarly to M97 but uses a separate program to
perform the same action.
M98 is often used when multiple fixtures are called. The main
program may only contain data that calls each fixture offset and then
the subroutine is called to carry out a task at that location.
M98 P1000;
The machine will search the program directory for program
O1000. When it finds it, the data from that program will be used until
and continue on, possibly to a separate subroutine call.

MCAR

April 2010

51

## M99 Subroutine Cancel or Program Loop

M99 will end a subroutine and return to the location in the
program where it was called.
If a M99 is called at the end of a program without having a
subroutine called prior to reading it, the program will rewind to the
beginning and start all over again. It will continue repeating until
stopped by the operator.

MCAR

April 2010

52

## Example of Program without a Sub Routine

%

X3.0;

O1000

X4.0;

T01M06;

X5.0;

G00G90G54X1.0Y1.0M03S4900;

Y1.0;

G43H01Z.1M08;

X4.0;

G81Z-.125R.1F20.0;

X3.0;

X2.0;

X2.0;

X3.0;

X1.0;

X4.0;

G80

X5.0;

G00Z1.M09;

Y1.0;

G91G28Z0;

X4.0;

M01;

X3.0;

T01M06;

X2.0;

G00G90G55X1.0Y1.0M03S4900;

X1.0;

G43H01Z.1M08;

G80

G81Z-.125R.1F20.0;

G00Z1.M09;

X2.0;

G91G28Z0;

X3.0;

M01;

X4.0;

T02M06;

X5.0;

G00G90G54X1.0Y1.0M03S3000;

Y1.0;

G43H02Z.1M08;

X4.0;

G81Z-.80R.1F20.;

X3.0;

X2.0;

X2.0;

MCAR

April 2010

53

X1.0;
G80
G00Z1.M09;
G91G28Z0;
M01;
T02M06;
G00G90G55X1.0Y1.0M03S3000;
G43H02Z.1M08;
G81Z-.8R.1F20.0;
X2.0;
X3.0;
X4.0;
X5.0;
Y1.0;
X4.0;
X3.0;
X2.0;
X1.0;
G80
G00Z1.M09;
G91G28Z0;
M30;

MCAR

April 2010

54

The sample program on the previous page shows how much code it
would take to run two tools for two separate work offsets making the same
part. Imagine if there were ten tools instead of two. Below is the same
program using a Sub Routine

## Example of M98 Sub Routine

This sample program calls a sub program in order to eliminate the
repetitive typing of the hole locations for this particular feature.

As you can see, the M98 calls the sub program, performs the drilling
cycle and then returns to the beginning of the next line of code. When it is
called again for a different drill cycle or even a different work offset, , it still
follows the same path as described by program O1115.

MCAR

August 2010

55

Subroutine Exercise

Create a main program and a sub program for the above part that will
spot drill and drill the holes shown. Use a G81 for the spot and a G73 for the
drill.
5/8 Spot Drill

RPM=1000

1/2 Drill

RPM=1250

56

## Part Five : Understanding Set Ups and

Writing Programs
Work Piece Holding, the Key to a Successful Set Up
If you take a look at any safe and efficient set up, the one thing that
you will notice is that they all have one thing in common, the work piece is
secure and supported. It is easy to overlook the simple fact that if you do
not hold your work piece correctly, it can affect everything from feature
size, location, chatter, GDT and most of all, safety.
Nothing is worse than having a work piece ejected from a machine,
especially if it is near the end of the cycle. Not only can it damage the work
piece and machine, it can fly out and cause injury.
With off-site programming(programming done on a PC away from the
machine), there are a large number of programs written without the
programmer ever giving one thought on how the part is to be held. With
that in mind, make sure that when you start programming any part, you
know what forces you are going to exert on the part, what operations are
going to be performed and most importantly, how you are going to hold it.
Knowing how much force you are applying and the certain types of
operations needing to be performed will help determine what method of
holding is required. If you are not sure that a holding method will secure
and support the part, you should probably look at other ways that will work
better. The overall goal should be to make an efficient and safe work
environment.
What are some of the ways to hold a work piece to the machine
table?

Vise
Chuck
Clamps
Fixture

57

Vise

## A Vise is the most common method of clamping parts to a table. There

are several styles on the market but most work very similar to each other.
The part to be clamped is set between two jaws, one fixed and one mobile.
The part can be set either directly on the bottom of the vise or on some sort
of riser block / parallels depending on the function to be performed on the
part. A screw attached to the moveable jaw can be rotated to adjust the
clamping area and jaw pressure.
Most vises have hardened and ground steel jaws or soft aluminum jaws
that can be machines into various shapes to aid in clamping.

58

Chuck

## Occasionally, a three jaw chuck will be used to clamp a work piece. It is

either clamped directly to the table or onto a rotary table called a 4th axis
which will allow for machining to be done at various angles.
Three jaw chucks usually have a set of removable hardened steel jaws
for clamping on raw material. They also soft steel jaws that can be machined
allowing for different shapes and machined surfaces to be held without
marring. Most commonly three jaw chucks are used with round parts.

59

Clamps

Some parts may be clamped directly to the work table as required. This
is usually done due to size constrictions or if the work piece already has a
machined surface that will be more accurate or rigid if it is clamped directly
to the table. This method of work holding is not recommended for
production runs as it takes too much time to set each piece in place and find
the work zero.

60

Fixture

Fixtures are prefabricated devices that support and clamp the work
piece for rigidity, accuracy and repeatability. They are often used instead of
direct clamping to the table when performing large production runs. Some
fixtures utilize clamps, pins and bolts to secure and locate part features. This
is especially useful when working with castings that are of irregular shapes.

61

## Finding a Zero Point

As talked about in the work offsets section, a zero point is a location
on the work piece where coordinates are referenced to in order to
accurately create features and perform tasks. Most programmers use the
zero location given on the part print as their reference. Sometimes
companies give reference locations that they want used as the part zero. No
matter where it is put, the part zero should not change while performing
operations on the work piece

## Tool Selection and Placement

An important key to any good set up is to have the right tool for the
work to be done. Many times people will select a tool that can do the job
but may not be the best tool for your particular task. In other cases, people
buy expensive tools thinking that more cost equals a better tool. This falls
under the old saying, you get what you pay for. Unfortunately, the most
expensive tools are not necessarily always the right tool either. Though it
takes years of experience to be a top set up person, informing yourself on
the latest technology and advances in machining is often a great way to help
fill the voids that experience brings. Learning from other peoples mistakes
as well as your own is key to any great set up.
Knowing that certain tools having distinct edge prep will work great
with one type of material and will be disastrous with another type can be
the difference in struggling to get the parts done to getting them done
quickly and correctly. It is a proven fact that just because a tool can run a
large amount of parts and costs minimal, it may not be better than a tool
that does not run as long, costs more and produces a faster, cleaner part.
In most shops, it is not up to each worker to purchase the tooling so
your options may be limited to which tools to choose from. Being informed
and educated on what happens while tools are cutting, however, is an
important asset for that worker to be able to tell the person who does buy
the tools the good and bad points of a tool and what its limits are on the
62

## companys machines or a particular material. Too often the communication is

not there and the person buying the tools does not know that they are
purchasing the wrong tool even though they may have been told it was the
right one to buy. Again, the key is educating yourself and having facts to
When placing tools in the machine, try to put them in a relative order
as they are to be used. For example, if you need a tapped hole, you may
want to put the spotter in position One, the drill in position Two and the tap
in position Three. This helps when programming by being able to simply call
the next tool in numerical order. It is also what is called, process of
Other issues that may arise when placing tools is if you use oversized
tools in your operation. Though many tool carousels can handle large tools,
having two large tools next to each other may not only cause interference, it
may overweight the carousel and cause undue wear and tear. Such things
MUST be taken into consideration when using large tools. Consult your
particular machines user manual for weight and size restrictions.

## Preparing to Write Programs

We have come to the point where you are ready to write programs. An
important piece of advice for writing programs is to make sure you perform
as many operations that you can per each work holding set up. Too often
are extra set ups made that are unnecessary. Quite often it is from how that
person was taught, but a lot of the time it is because the programmer did
not stop and thoroughly look at the part and plan things out.
If you can save just one extra set up on a job, you will have saved a
tremendous amount of time and money. Something as simple as allowing
the part to overhang the edge of a vise and perform a side milling
operation after drilling and tapping holes instead of performing those
operations separately. The time lost is not only in the set up but also the
extra handling of the work piece. The work piece was still just as secure and
63

supported but an extra operation was added to the program and not
performed in an entirely new set up.
That is something to think about when looking at a part print and
getting ready to program it. Ask yourself, What operations need to be
performed to make this part and how many can I eliminate extra set ups?

## What are some things to take into consideration when writing a

program?

Process of Machining
Visual Optimization
Tooling Needed
Process of Machining

## Process of Machining is the first key to any good program. Knowing

the correct and most efficient order to create features on any part translates
into safe, efficient, and most of all, correct parts. Too often process of
machining is overlooked or taken for granted.
As described earlier in this lesson, if you want a tapped hole, you will
want to spot or center drill, drill then tap the hole. Though you can drill a
hole without a spot or center drill, you cannot tap a hole that has not been
drilled yet. As silly as it seems, it happens more often than you may think. If
you drill a hole before you spot or center drill it, it may not drill in the exact
location, especially if the drill is long. Long drills tend to flex and need a
starting spot to keep their accuracy. Normal length, small diameter drills
tend to walk as well. The term walking means that the tool does not
immediately start cutting, instead it flexes out of position until enough
downward pressure forces the drill to start cutting, thought the amount of
walk may be small at the top of a hole, the hole now drills downward at an
angle. Three things result from this, the hole is not out of location, the top

64

of the hole will be larger from tool drilling on and angle, and the hole itself
will not be straight. Tapping a hole like this can result in the tap breaking
since the tap is made of harder, more brittle material and will not be able to
flex as much. With this knowledge of what can happen, you may want to
think twice before skipping the spotting/c-drill operation if you are trying to
save some time on a job.
Visual Optimization
Once you have your idea of what needs to happen, you will want to
make sure you optimize the process to get the most out of every tool before
it is changed for another tool. An example of optimizing is a plate has five
tapped holes, three reamed holes and two bored holes. The one thing they
all have in common? They need to be spot faced/c-drilled. You can save
unneeded tool changes by spotting all of the holes while the tool is in
operation. Next, maybe the tapped holes and the reamed holes use the same
drill for the initial hole. That can save more time. Little things add up,
especially when you have a large quantity of parts.

Tooling Needed
After you know what processes you are going to use, you will need to
select the tools to perform those tasks. There is no silver bullet to any one
operation, meaning that there is not a perfect tool to do everything. What
works on large parts may not work on small parts. What works on one
material may not work on another and so forth. There are an infinite
number of variables when machining. A good example is that a certain type
of tool that works great on a new machine may not work on a machine that
is several years old and has a lot of wear and tear. Machine alignment plays
a role, part clamping is another. This list goes on and on. The key is to start
with what you know from experience. If you are not experienced, start with
a recommendation from a lead man or tool supplier. From there, it is simply
trial and error. No one can just wave a magic wand and grant you
experience, it is something that can take a while to obtain in certain
circumstances.
65

## Proofreading for Mistakes or Typos

The last thing you need to think about when writing a program is to
check and recheck for mistakes and typos. It is too often that programs are
rushed to be written and then rushed to be run without checking for
mistakes. This results in omitting or incorrectly locating features, improper
machine movements which can result in a crash, machine errors, and
improper feature size or shape. Once you write a cycle for a particular
feature, go back and double check to make sure the data makes sense.
When you have completed the program, go back one more time and check
again for missing or misplaced decimal points and any other typos.

## Ready to Write a Program

Now that you have the necessary information and knowledge base to
create a program, the only thing left is to write one. Select one of the
following three drawings and create a program that you will use to set up
and manufacture a part. There may need to be more than one program
written based on part features. All three drawings contain roughly the same
amount of work. The only difference being the number of
programs/operations required to achieve a finished part and sizes of certain
features.

66

67