CNC Mill

G Code Programming

MCAR

May 2012

1

Part



Table of Contents
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

4

Part Two – Cutter Radius Compensation
• 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

2

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

3

5.. the Z axis is set at a fixed position to allow the removal of material using the X and/or Y axis. When they have completed the task. Y-2. boring and tapping. This program example cuts a square shape into a part ½” below the Z axis 0 offset position. and pockets on a part surface. G01 X3... In other machine functions such as drilling.Part One : Programming Skills 3 Axis Programming An Example of a Milling Function In most milling applications. An Example of a Milling Function G0 X4. radii. X-3. This includes End / Face Milling. F5. the other axis do all the work. 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. Y2. the Z axis is the axis performing the task and the X and Y axis are set at a fixed position.. the Z axis lifts out of the cut to a clearance position. G0 Z1. and Side Milling. Y2. MCAR May 2012 4 . Z-0. Notice how once the Z axis is set.5.

Canned cycle call X10. Move to next position to perform cycle G0 G80 Z1. This will allow a programmer a variety of options when deciding how to machine a given part. Choose between a milling function or other function.75 Y-6.. Putting it all together Having three axis available to manipulate opens the door for countless possibilities of three dimensional machining.2 inches deep into a part in two places.. Position move G83 Z-3. The Z Axis is the primary axis performing all the work to achieve the hole depth. The next step will be to understand and learn the many cycles and functions that the machine can perform. 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 5 .25 Y-8.25 R.1 F7. Exercise On the next page decide what type of function is being performed.An Example of a Drilling Function G0 X12.00.2 Q. . 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.

G01 Z-.5 Y2..6.45 F10. G00 X4. 5.6.6.5. G76 Z-. G01 Z-.6. MCAR May 2012 6 . G01 Z-. X2.45 F10. G00 X4.6. G0 Z.75. G00 X4. G00 X4.45 Q.1 F10.5 Y2.3 Axis Function Type Exercise Describe what type of function that each group of code is performing...3 Z-. Other or Both 1.45 F10..1 F10.01 R.75 D01. G13 I. G01 Z-..5 Y2.5 Y2. G00 X4.. X6.45 F10. G81 Z-.5 Y2. 6.45 R. 3.5. G00 X4.6. 2. 4. Your Choices are Milling.5 Y2.

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
Know your Codes
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

7

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 code’s
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

8

What are some machine operations that
can be performed using G Codes?
 Rapid movement
 Feed movement
 Linear movement
 Radial 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

9

.375 Y2. If the G Codes were at any given location on a line. (This is a radial feed move) The reason for this method is mostly to help identify what is happening with the particular line you are looking at.5 F10. For example.. then call the other programming words to add to the function that the G code is performing. you will need to know what data is required in order to perform the function you are wanting.375 Y2. (This is a positioning move) G01 X4. it will be harder for someone to follow the program from function to function.625 R1.G00 Rapid Traverse G43 Tool Length Compensation G01 Linear Feed G54 Work Offset G02 Circular Interpolation CW G80 Canned Cycle Cancel G03 Circular Interpolation CCW G90 Absolute Programming G04 Dwell G91 Incremental Programming G28 Reference Return G94 Feed Per Minute G40 Cutter Comp Cancel G98 Return to Initial Z G41 Cutter Compensation Left G99 Return to R Point G42 Cutter Compensation Right 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. G00 X4.625 F10. (This is a linear feed move) G02 X4.375 Y2. For each line entered. In the MCAR May 2012 10 .625.

in effect. This manual contains only reference material that may not be available or may not be in the same format that you need to use. and tap holes. One of the most useful functions performed by a G code is known as a canned cycle. and hole patterns for canned cycles. contact your machine tool manufacturer or talk to a programmer within your company. Canned cycles are. custom macros built into the machine to act like mini programs when they are called up. MCAR May 2012 11 . ream. Most programming manuals for a machine tool will have the basic list of codes like the ones listed above. You will learn more about canned cycles in a later lesson. 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. 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. The best advice for understanding what format your particular machine uses is to consult the programming manuals for your machine.example above. you will come across the need to drill. Other complex G codes that will be taught later are cutter radius compensation for milling functions. Along with other program words (variables) the machine will perform a complex task using minimal data from the programmer. bore. Complex G Codes When programming.

G57. This is why data confirmation is so important and making sure the program is always proof read before each use to insure unwanted. There are some exceptions.G28.G12.G84. mistyped or incorrect codes have not been added.G76. Sometimes.G59 (work offsets) Non-Modal G Codes Codes in the Group G04.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. If the operator does not use the correct information or possibly an incorrect G code on any given line of the program.G13.G02.G86.G18. G codes make the machine perform a task.G01. Tool Length Return Mode Coord.G55. the machine will still try to perform the task it has be told to do. Non Modal commands are ones that cancel themselves as soon as the function is performed.G52.G10.G70.G41.G88.G85.G19 G90. MCAR May 2012 12 .G74.G92 What to be careful of when selecting G Codes As you have learned.G81.G71. This is called a modal command.G53. Group Name 1 Motion 2 3 5 6 7 8 10 12 Plane Distance Feed Units Cutter Comp. it is wise to have another person check your program for grammatical mistakes.G03. System Group Name 0 or 00 Non-Modal Modal G Codes Codes in the Group G00.G77.G82. especially long programs and ones that are critical and have no margin for error. The following list shows the various groups and also the ones that do not need to be cancelled.G58.G49 G98.G91 G93.G42 G43.G89 G17.G73.G56.G87.G72.G99 G54.G21 G40.G94 G20. G80.

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

M00 Program Stop M08 Coolant On M01 Optional Stop M09 Coolant off M02 Program End M19 Orient Spindle M03 Spindle Start CW M30 Program End & Reset M04 Spindle Start CCW M97 Local Sub Program Call M05 Spindle Stop M98 Sub Program Call M06 Tool Change M99 Sub Program Loop/End Codes May Be Different There are no set guidelines for machine tool builders as to what each M code should be assigned to. They are simply a code that activates and deactivates a series of switches and relays within the electrical control panel on the machine. and many more functions. Below are some of the most common M codes used in programming. MCAR May 2012 14 . they are the most common ones and most machine tool builders do not alter these common M codes. Although these are not all of the codes you may use. This means that they perform various tasks on the equipment.M-Codes Miscellaneous Codes M codes are known as Miscellaneous codes. Even some machines built by the same builder from one model year to the next may be different. start and stop the spindle. such as turn the coolant on and off. turn the conveyor on and off. Keep in Mind . only one M Code can be used per line of code. An easy way to remember what an M code does is to think of the code as a machine code.Only One M-code per line! There are a few machines that will accept more than one M code but generally.

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. 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. They will all accomplish the same thing but the formatting will be a little different within each one.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. MCAR May 2012 15 . Compatibility One of the biggest problems within any shop is writing the programs so they can be read and understood by anyone. at the end of every tool operation and at the end of the program. for each tool call. This is called Basic Program Structure. you will likely come back with 10 different programs. The important thing is to be able to understand what needs to be in a program and what doesn’t.

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

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

part size.5 M09. By having the machine at Z Axis home position. broken tool(mainly for small end mills and taps). tool wear. M01. Things the operator may check for include. and part clamping. but he/she does have the option to do so if needed. surface finish. MCAR May 2012 18 . the operator may safely use the optional stop to check the part or tool as it completes this portion of the program. With the optional stop. G0 G80 Z. 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.Ending for a Tool Cycle . The M01 is the optional stop M code and will allow the operator to stop the program before the next tool is called. the operator does not have to stop the program every time. G28 G91 Z0.

making work piece change out less cumbersome. When ending a program. MCAR May 2012 19 . and end of program. the Z Axis does not need to be taken to the home position. end of tool. 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. Simply rearrange all of the information in order. G28 G91 Y0 Z0.Ending of a Program . Some or all of the code may not be positioned on the line where it is needed. The code provided next to each exercise number will give you all the required information. If only one tool is used throughout the program. G0 G80 Z.5 M09. M30. 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. Exercise For the exercise on the next page you will need to write the code for a program start up. this is only done to assure that the tool does not interfere with the operator as he/she changes parts. tool call.

Z0. M06. 2.. M09. M03. (T1 – 3/8” SPOTTER) . 4. G80. Z1. M08... M03. G00. S1500.5. 3. T01. G54. Y8. MCAR May 2012 20 . S2200. M08. G28.5.Program Structure Exercise 1. Z1.Y5. M30. Z0. (ABC COMPANY). G90. G00. G91. T04. G00 (Z0 IS TOP OF PART). G80.. G56. G43. Z. Y0. G90. X6.. H01. M08. H01. M09. (T4 – 1/2” DRILL). . G00. Z. X3. G28. O1234. G43.M06. . M01. G91.

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

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 (. shift the tool in the correct direction and distance from the part. MCAR May 2012 22 . The location where the shift occurs is often called the lead in position. Example: If you are using a 1” diameter end mill and are going to cut along the right edge of a part. Rule #1: Figure which mode of Cutter Radius Compensation is to be used. must be added to the amount shifted. any extra material.501 more than the actual position of the upper right corner of the part. One thing to note. They do not need to be followed in exact order. the position must be at least .001) more than the radius amount of the cutter size away from the start where cutter 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. from a cast surface or previous milling operation. Simply put. otherwise the tool will move down and possible crash into the work piece.The Rules These simple rules must be followed when using Cutter Radius Compensation. only that they ALL need to be followed.

One of two things will happen. when cutter compensation is cancelled. MCAR May 2012 23 . Rule #5: Clear the work piece completely before canceling cutter compensation. 1: the machine gives a compensation error alarm. On most machines you may move up on the Z axis once you are in cutter compensation. 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. This results in an imperfection. (This is the better of the two) 2: the machine plunges the tool into the part in an attempt to make the compensation. On some machines.Rule #3: Do not insert a G41 or G42 in a line with a Z axis movement. Rule #4: Do not try to cut an ID radius that is smaller than the radius of the tool. it is wise to move up and clear the work piece. then cancel cutter compensation in order to avoid crashing into the part. the machine physically shifts the tool back into centerline mode. If your tool is not completely clear. it may crash into the part.

If the offset value is incorrect. chances are. the more it will feel natural is a good rule of thumb to go by. Following the rules above will give a firm basis and understanding of what needs to be present for cutter compensation to work correctly.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. either an alarm will be generated or the tool path will look correct. The resulting part may be cut out of tolerance. The more you use it. It was designed to make your life easier and your programming a lot more practical. If your cutter compensation alarms out when you try to use it. even in graphics enabled machines. 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 because one of the rules stated above was not followed. MCAR May 2012 24 .

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

1. tool change G0 G90 G54 X3.. ← Cutter comp left.5 Y3. work offset call S2000 M03.1. ← Move to next coordinate in shape. ← End of program and rewind Please complete the Following exercise. ← Linear feed in Z axis to ½” deep at 150 IPM G41 X3. T1 M06. write a program using Cutter Radius Compensation.5 F150. dia... M09. Using the print. ← Move to next coordinate in shape X3. ← Feed up to Z. F10. ← Tool call.1 F150. ← Cancel cutter comp G0 Z1..65..100” above Z0 G01 Z-0. ← Extra clearance added for cutter comp cancel Z. ← Rapid to first position.55. offset #1 Y0.. ← Set length offset and position .0” above Z0 and turn coolant off M30. ← Rapid to 1. ← Set spindle speed and start spindle clockwise G43 H01 Z. feed at 10 IPM X0. MCAR May 2012 26 . ← Move to next coordinate in shape Y3.1 (for extra piece of mind) G40 X3.Same Program as above except an optional Z Clearance before cutter compensation cancel is added. D01.

If the operator needs to change the tool size. This type of programming involves positioning the cutter in reference to the actual dimensions of the work piece shape. Machine Compensated Programming Method Machine Compensated programming is the most widely used method of programming side milling functions. etc. Profile. Machine Compensated and User Compensated. and Slots. Example of Machine Compensated Programming The following Code is an example of Machine Compensated Programming using the picture to the right of the code. For all other non milling operations such as drilling.Programming Methods Types of Programming Methods There are two types of programming methods used in profile milling operations on modern machining centers. tapping. 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. MCAR May 2012 27 . The machine will then recalculate the new path using this new diameter. Common examples of side milling functions are Pockets. The tool centerline is ALWAYS programmed. 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.

5 M09. you simply insert the cutter compensation and program the actual size of the profile you wish to machine.. Using Cutter Comp. The part is a 4” Square. G0 G54 G90 X5. Using the offset values you assign while setting up the tools. G40 X5. the machine will adjust the tool path then compensate for the tool size as it moves to each coordinate. F15. Key factors for this type of programming are the correct Cutter Compensation Mode. G43 H01 Z. D01. MCAR May 2012 28 . S1500 M03...5 F50. G41 X4.5. All the programmed moves must be calculated out manually to compensate the cutter’s size in reference to the geometry being machined.. 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. Y0. G28 G91 Y0 Z0. What you are seeing in the above example is a machine compensated method of programming.. Inserting the D# value when using Cutter Comp. G01 Z-. M30. Y4. X4. G0 Z. X0.5 M08. Y5.5 F50.T1 M06..

M30.5.. G0 G54 G90 X4. G0 Z.. G28 G91 Y0 Z0. X-.5 M09.Example of Machine Compensated Programming The following Code is an example of Machine Compensated Programming. MCAR May 2012 29 . T1 M06. The part is a 4” Square.5.5.. G01 Z-.5 S1500 M03.5 F15.5 F50. Y4. 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. G43 H01 Z. What you are seeing in the above example is a user compensated method of programming.5 M08.5. X4. Y-. Y4.

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 . A lot of programmers say it is more logical to program most profile milling functions using Machine Compensated programming. The reason being. Look at the following drawing and decide which methods of programming you would choose. decisions. This results in less arithmetic mistakes and faster programming times. decisions. the shape of the part can be directly input eliminating all of the extra math equations involved in manually compensating the tool path.How to pick one over the other Decisions. In this example.

When complex geometry like angles and radii are part of a profile. MCAR May 2012 31 . It would be like having to reprogram the entire operation because in fact. 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. the programmer will need to use geometry and trigonometry to figure out the end points for each move. determine what type of programming method should be used. With that in mind. Below are some shapes. you would have to in order to get the correct end points. while in production of those parts.

Part Three : Canned Cycles What is a canned cycle? G-Code Input data Describes a feature Performs a task Minimal programming Standard Canned cycles are one of the most useful series of G-Codes in all of CNC programming. The programmer will also need to know what parameters to alter or insert in order for the cycle to work correctly.       Functions Below are the functions that canned cycles can perform. They can make a programmer’s job easier and more efficient by utilizing minimal required data to end up with a seemingly complex programming function. Once the canned cycle is called. MCAR May 2012 32 . it will perform the operation at that location.  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.

Canned cycles are considered modal. you will first need to decide what function you want to perform and if a cycle is available to do so. 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. Canned cycles cover most drilling. meaning they stay active until cancelled.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.0F15. Here is a list of the standard Fanuc style canned cycles: MCAR May 2012 33 . the machine will perform the same operation at the new location as soon as the machine stops moving. boring.Example G81Z-1. When programming a canned cycle. spot facing. counter boring. tapping.

rapid out G87 Boring Boring. shift and rapid out G77 Boring Back boring with shift in/out G81 Drilling Straight drilling G82 Drilling Spot drilling/Counter boring with dwell G83 Drilling Deep hole peck drill G84 Tapping Right hand tapping G85 Boring/Reaming Boring/Reaming. rapid out MCAR May 2012 34 . dwell. feed in. orient. spindle stop.G Code Cycle Type Cycle Description G73 Speed Peck High speed peck drill G74 Tapping Cycle Left hand tapping G76 Boring Boring with stop. man. spindle stop. manual jog out G88 Boring Boring. feed in. feed in. spindle stop. jog out G89 Boring/Reaming Bore/Ream in. dwell. feed in/feed out G86 Boring Boring.

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

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

Stop. but you will also keep from omitting or including data that would prevent the function from being performed properly. 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. Manual Retract Z R F G88 – Bore In. Rapid Out Z R F G87 – Bore In. Bore Out Z R F P P P P Q I J K P Bold letters indicate commonly used variables.G73 – High Speed Peck Z R F Q I J G74 – Left Hand Tapping Z R F G76 – Fine Boring Z R G77 – Back Boring Z G81 – Straight Drilling K F Q I J R F Q I J Z R F G82 – Spot Drilling Z R F G83 – Deep Hole Peck Drilling Z R F G84 – Right Hand Tapping Z R F G85 – Bore in. You can also make the machine peck so many times then retract to clear chips. Bore Out Z R F G86 – Bore in. Bold and Underlined letters indicate required variables. MCAR May 2012 37 . Dwell. Man. Retract Z R F P G89 – Bore in. 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. Dwell. In cycles such as G73 for example.

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

The three sets of cycles listed above will drill the exact same hole to the exact same depth. work with the materials. knowledge of tooling. insert your cycle and the variables needed. it is an invaluable asset. This may be a little tricky if you do not understand the process of the cycle or the tools being used.5 inches deep. This knowledge comes from not only personal experience but asking your operators who run the machines. Each cycle allows the Z axis to be manipulated in different ways in order to achieve the objective of a hole that is 3. For example. MCAR May 2012 39 . understand process of machining. if you wanted to drill a deep hole. 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. 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. and most importantly. 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. and have experience with the tooling on a daily basis. Though it is not required. the only difference is how the machine will control chip build up and coolant penetration down inside the hole. Potential Pitfalls Now that you have the code structure figured out. It has been a common theme in the industry that the best programmers are the ones who have some machining background. 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.

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. you simply need to insert a G80 GCode at the end of the cycle. G81 Z-. A common G-code often found on the same line as the G80 is the G00 rapid command..5 R. This allows the machine to go into a rapid movement for the next position move.25.. X8.5 R. G00 G80 X10.. G99 X5.. R.. MCAR May 2012 40 . G98 X7. G80 is the cancel code for canned cycles from G73-G89.1 F3. Y-2.. Y-4. You may want to put in a programmer’s note so the operator will understand why you are doing this.G99 returns the Z axis to the R starting position. Y-5. after each completed canned cycle. as defined in the canned cycle. You may also use a G80 to end a canned cycle before calling a new one. X6.5.5 Y1.5 Y2. it is usually because of an obstruction of some kind. G81 Z-1. This is often inserted as a precautionary move in case the machine does not load G00 by default when a G80 command is executed. Here is an example.1 F5.1 F5. Cancelling Canned Cycles To cancel the canned cycle. Either G98 or G99 is active when you start the machine depending on a parameter setting. When you see this called out like this. X3.. Using both methods during one cycle Example: G81 G98 Z-.

In Review As you have read. Instead of writing each line of code for each peck of a deep hole drilling cycle. There are two exercises that follow on canned cycles. for example. MCAR May 2012 41 .G00 G80. 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. Once they are mastered. the canned cycle uses built in macros that are designed to eliminate all of the extra programming work and potential costly errors as well. the cycles will undoubtedly become second nature when performing any hole making task.

T3 M06 (3/8 X 16 TAP) G00 G90 ____ X2.5 Y-3.15 F31.2 Q. G28 G91 Z0.13 R. X5. X1..5. (T3 3/8 X 16 TAP). Y-5.75 R. Y-4. S500.75.5 Y-1. X2.Canned Cycle/ Programming Exercise #1 Study the following program then fill in the blanks with the missing G and M Codes. Y-4.15 R. . ____.. G43 H04 Z1. May 2012 42 . T2 ____ (5/16” DRILL) ____ G90 G54 X2. T1 M06 (1/2” SPOTTER).5 Y-3.. T4 M06 (7/16” DRILL) ____ G90 ____ X5.. S1000 ____. ____.5 Y-4.5. ____. (Z0 IS TOP OF PART).25.5 Y-1.75. M01. X5. G00 ____ G54 X2. G43 H03 Z1.75. S1000 M03. X2.Y-3. G84 G99 Z-. ____ G91 Z0. X8.5.75 Q. (T2 5/16” DRILL). G00 G80 ____. Y-5. (T4 7/16” DRILL).25.5 Y-3. G00 G80 ____. S1200 M03. MCAR G73 ____ Z-1.5 Y-3. G43 ____ Z1.1 F3. X7. Y-. ____. M08. Y-1. Y-..25. X5.5 Y-4. (TOOLS). X5.75. X7.175R.1 F6. X7.5 Y-4. X5. ____ ____ Y0 Z0.25. O1500(CANNED EXERCISE #1). Y-3... (X0 Y0 IS TOP LEFT CORNER OF PART).25. (T1 1/2” SPOTTER). G00 ____ M09. M01. ____. G28 ____ Z0. G00 ____ M09.. X7. X8. G81 G99 Z-.75.75.1 F3.75.25. ____ H01 Z1.25. G83 ____ Z-1.5 Y-1.. X1.

MCAR X3. ____ G99 Z-. T1 ____ (5/8 SPOTTER). ____ ____ ____ X2.. S1200 ____. ____ H02 Z1. ____ ____ Z-.5 Q. S1200 ____. ____. ____. ____ ____ Z0.15 F5.5. Y-3... ____ ____ Y0 Z0.1 F8.5 X7. (TOOLS).. Y-2. T3 & T4 are Deep Hole Peck Drilling cycles O1600(CANNED EXERCISE #2).6 Q. Y-8. X10. Y-2. ____. T2 ____ (3/8” DRILL) ____ ____ ____ X2. (T2 3/8” DRILL).25 Y-7.75 R.25.05 F5. ____. (T1 5/8” SPOTTER). T3 ____ (1/4” DRILL) ____ ____ ____ X8. ____ ____ ____.. ____ H04 Z1.075 R. Y-3. X7. T2 is a Straight Drilling cycle.5. ____ H03 Z1.. (T4 1” DRILL). T4 ____ (1” DRILL) ____ ____ ____ X5.1 R.25 X3. T1 Is a Straight Drilling cycle.1 F4.Canned Cycle/ Programming Exercise #1 Study the following program then fill in all of the blanks with the missing G and M Codes. ____ ____ Z0. ____ ____ ____. ____ ____ ____. ____ ____ ____. ____ G99 Z-1. May 2012 43 . ____.. ____. X10. Y-2. ____ G80 Z1. ____. X8. ____ G99 Z-1. (Z0 IS TOP OF PART).75 Y-5.75 Y-5. (X0 Y0 IS TOP LEFT CORNER OF PART). S375 ____. Y-8. S800 ____. (T3 1/4” DRILL).25 Y-7. X5. ____.12 R. ____. X10... ____ H01 Z1.

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

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

Below is an example of a G71 cycle with a G81 canned cycle called before it.. (imagining a clock face.size of the arc. MCAR May 2012 46 . From there. G98 G81 Z-1. G00 X0. The programmer will then insert the amount of spacing between each hole and the total number of holes. Y0. G71 I6. Starting at a 6” radius and 45º up CCW.05 F4. As with the G70 cycle the machine will position to the center point of the circle. notice the L0 which tells the machine not to drill a hole in that location. The total length of the arc in this case would be 100º. K25. the canned cycle is called but again. X0. 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. 0º would be at the 3 o’clock position) After completing the first hole. the machine would continue on to add 3 more holes spaced 25ºapart from the first location. L0 R.. The machine would then return to the center of the pattern and the cycle would cancel. The hole pattern is called on the next line. The first hole location starts the same way as the G70 as well. L4. Y0. J45.

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

Y1. G00 G80 M09.5 Y4. (T2 5/16” DRILL).75 L0. G28 G91 Z0. G81 G99 Z-. May 2012 .1 F3. G X3. . Y1. (X0 Y0 IS TOP LEFT CORNER OF PART). L0. T3 M06 (3/8 X 16 TAP) G00 G90 G54 X3.5 Y4. G I J K L .25 L0.75. G28 G91 Z0. MCAR G43 H02 Z1.2 Q. G43 H03 Z1. . M30. G84 G99 Z-. (T3 3/8 X 16 TAP). M08. S1000 M03.25. G43 H01 Z1.25.15 R. G X6. G G00 G80 M09. . L0. G28 G91 Y0 Z0.. . L0. 48 . Y5. G73 G99 Z-1. G0 G80 M09. (T1 1/2” SPOTTER).75 R. .15 F31. S500. M08. G I J K L .5 Y4. O1500(Hole Pattern #1). M01. Y5. Y5.75 L0.1 F6. X10. X6.25. T2 M06 (5/16” DRILL) G00 G90 G54 X10. M01. T1 M06 (1/2” SPOTTER).13 R. G00 G90 G54 X3. X6.Study the print on the next page. M08. (TOOLS). G I J K L . Y1. L0. S1200 M03. Using the locations from the print fill in the blanks with the correct Hole Pattern Cycle G Code and its variables. X10. (Z0 IS TOP OF PART).

MCAR August 2010 49 .

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.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. 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. MCAR April 2010 50 . M99 is used to end a subroutine and is inserted in place of the M30 at the end of the data. This allows for custom or repetitive functions to be performed throughout a program.

M97 . M98 is often used when multiple fixtures are called. When the P100 is called. M97 P100. M98 P1000. 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. This M function keeps all the program data locally and for use mostly on one part. MCAR April 2010 51 . Then it will return to the current program and continue on.Call Local Subroutine M97 is mostly used when multiple position moves are required and are used by several tools. 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. possibly to a separate subroutine call. the data from that program will be used until the machine reads a M99. 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.Call Program Subroutine M98 works similarly to M97 but uses a separate program to perform the same action. A “P” and the “N” sequence number is then added to call the correct data. 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. The machine will search the program directory for program O1000. M98 . When it finds it.

MCAR April 2010 52 .M99 – Subroutine Cancel or Program Loop M99 will end a subroutine and return to the location in the program where it was called. The next page contains an example of a program without a subroutine. It will continue repeating until stopped by the operator. 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.

0.0M03S3000.0. X2. X4.0Y1. X3.0.0.0. G00Z1. Y1.0. X3. G80 G81Z-. G81Z-.M09.0. X4. G81Z-. G91G28Z0.0. X4. X3..1F20.0.0. X2.0.1F20. X1. G00Z1. X5. O1000 X4.0. T01M06.0M03S4900. X4.0.0.0.0. T01M06.0. G43H01Z.0. X2. X4. X1.0Y1.0. X2. G00G90G54X1.125R.Example of Program without a Sub Routine % X3.1M08.0. G43H01Z. G91G28Z0. G80 X5.80R.0.0. G00G90G55X1. M01.0. X2.0. G43H02Z. X5.1F20. X2. G00G90G54X1.0. X3. M01. MCAR April 2010 53 .0Y1.M09. X3.125R.1M08.0M03S4900. Y1. Y1.1M08.0.0.0. T02M06.

M30.0.M09. X3. G91G28Z0. G81Z-. X2.0.8R. X5.0M03S3000.1F20. X1. X4. X4. G80 G00Z1.M09.0.0.0.0. G43H02Z. T02M06.X1. G00G90G55X1.0. Y1. M01.0. X3.0Y1.0. MCAR April 2010 54 . G91G28Z0. X2.1M08.0.0. G80 G00Z1.

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. the M98 calls the sub program. As you can see. performs the drilling cycle and then returns to the beginning of the next line of code. MCAR August 2010 55 . it still follows the same path as described by program O1115. .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. When it is called again for a different drill cycle or even a different work offset.

Use a G81 for the spot and a G73 for the drill.125 1/2” Drill RPM=1250 Feed=6.Subroutine Exercise Create a main program and a sub program for the above part that will spot drill and drill the holes shown.5 IPM Depth=1. 5/8” Spot Drill RPM=1000 Feed=4.0 IPM Depth=.25 56 .

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

Most vises have hardened and ground steel jaws or soft aluminum jaws that can be machines into various shapes to aid in clamping. 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. 58 . The part to be clamped is set between two jaws.Vise A Vise is the most common method of clamping parts to a table. one fixed and one mobile. There are several styles on the market but most work very similar to each other.

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. They also soft steel jaws that can be machined allowing for different shapes and machined surfaces to be held without marring.Chuck Occasionally. 59 . a three jaw chuck will be used to clamp a work piece. Three jaw chucks usually have a set of removable hardened steel jaws for clamping on raw material. Most commonly three jaw chucks are used with round parts.

60 . 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.Clamps Some parts may be clamped directly to the work table as required.

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

Being informed and educated on what happens while tools are cutting. 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 . Though it takes years of experience to be a top set up person. people buy expensive tools thinking that more cost equals a better tool. 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. Unfortunately. costs more and produces a faster. 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.Finding a Zero Point As talked about in the work offsets section. Sometimes companies give reference locations that they want used as the part zero. cleaner part. however. it is not up to each worker to purchase the tooling so your options may be limited to which tools to choose from. In most shops. a zero point is a location on the work piece where coordinates are referenced to in order to accurately create features and perform tasks. Learning from other people’s mistakes as well as your own is key to any great set up. In other cases. It is a proven fact that just because a tool can run a large amount of parts and costs minimal. This falls under the old saying. the most expensive tools are not necessarily always the right tool either. informing yourself on the latest technology and advances in machining is often a great way to help fill the voids that experience brings. Most programmers use the zero location given on the part print as their reference. Many times people will select a tool that can do the job but may not be the best tool for your particular task. it may not be better than a tool that does not run as long. No matter where it is put. “you get what you pay for”.

try to put them in a relative order as they are to be used. Though many tool carousels can handle large tools. Such things MUST be taken into consideration when using large tools. It is also what is called. You will learn more about that in a little bit. the key is educating yourself and having facts to back up your opinions. the drill in position Two and the tap in position Three.company’s machines or a particular material. Preparing to Write Programs We have come to the point where you are ready to write programs. 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. you will have saved a tremendous amount of time and money. Again. Other issues that may arise when placing tools is if you use oversized tools in your operation. The work piece was still just as secure and 63 . Consult your particular machine’s user manual for weight and size restrictions. it may overweight the carousel and cause undue wear and tear. The time lost is not only in the set up but also the extra handling of the work piece. if you need a tapped hole. When placing tools in the machine. you may want to put the spotter in position One. This helps when programming by being able to simply call the next tool in numerical order. If you can save just one extra set up on a job. Too often are extra set ups made that are unnecessary. 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. having two large tools next to each other may not only cause interference. Quite often it is from how that person was taught. 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. but a lot of the time it is because the programmer did not stop and thoroughly look at the part and plan things out. For example. process of machining.

small diameter drills tend to “walk” as well. especially if the drill is long. you cannot tap a hole that has not been drilled yet. Though you can drill a hole without a spot or center drill. If you drill a hole before you spot or center drill it. correct parts. the top 64 . you will want to spot or center drill. and most of all. That is something to think about when looking at a part print and getting ready to program it. drill then tap the hole. it happens more often than you may think. instead it flexes out of position until enough downward pressure forces the drill to start cutting. Too often process of machining is overlooked or taken for granted. As silly as it seems. Long drills tend to flex and need a starting spot to keep their accuracy. it may not drill in the exact location. the hole is not out of location. if you want a tapped hole. As described earlier in this lesson. the hole now drills downward at an angle.supported but an extra operation was added to the program and not performed in an entirely new set up. “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 Proofreading for Mistakes or Typos Process of Machining Process of Machining is the first key to any good program. Ask yourself. thought the amount of walk may be small at the top of a hole. efficient. Normal length. The term walking means that the tool does not immediately start cutting. Knowing the correct and most efficient order to create features on any part translates into safe. Three things result from this.

Tooling Needed After you know what processes you are going to use. With this knowledge of what can happen. From there. If you are not experienced. This list goes on and on. you will need to select the tools to perform those tasks. part clamping is another. maybe the tapped holes and the reamed holes use the same drill for the initial hole. An example of optimizing is a plate has five tapped holes. and the hole itself will not be straight. The one thing they all have in common? They need to be spot faced/c-drilled.of the hole will be larger from tool drilling on and angle. There is no silver bullet to any one operation. you may want to think twice before skipping the spotting/c-drill operation if you are trying to save some time on a job. There are an infinite number of variables when machining. Next. especially when you have a large quantity of parts. 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. Machine alignment plays a role. No one can just wave a magic wand and grant you experience. The key is to start with what you know from experience. 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. You can save unneeded tool changes by spotting all of the holes while the tool is in operation. That can save more time. start with a recommendation from a lead man or tool supplier. meaning that there is not a perfect tool to do everything. it is something that can take a while to obtain in certain circumstances. three reamed holes and two bored holes. Little things add up. 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. What works on large parts may not work on small parts. it is simply trial and error. Visual Optimization Once you have your idea of what needs to happen. What works on one material may not work on another and so forth. 65 .

and improper feature size or shape. Once you write a cycle for a particular feature. All three drawings contain roughly the same amount of work. There may need to be more than one program written based on part features. improper machine movements which can result in a crash. go back one more time and check again for missing or misplaced decimal points and any other typos.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. 66 . the only thing left is to write one. machine errors. go back and double check to make sure the data makes sense. Ready to Write a Program Now that you have the necessary information and knowledge base to create a program. It is too often that programs are rushed to be written and then rushed to be run without checking for mistakes. The only difference being the number of programs/operations required to achieve a finished part and sizes of certain features. When you have completed the program. Select one of the following three drawings and create a program that you will use to set up and manufacture a part. This results in omitting or incorrectly locating features.

67 .