You are on page 1of 42

Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

CNC Machining
History of CNC machines

Introduction to CNC

G codes

Basic Programming
Startup block when programming
Absolute / Incremental
Rapid, Linear Interpolation, Circular Interpolation
Introduction to Spindle and Feed functions

Offsets – work offsets and tool offsets

Other commands
Dwell
Fixed cycles
Coordinate Rotation

Miscellaneous Functions

Program Structure

Dr. R. Jill Urbanic 1


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

Introduction to CNC Machining

A little history of NC/ CNC machining

 1725 – systematized punched cards were used to control the cloth pattern
 1808 – punched holes in sheet metal cards to automatically control patterns made
by weaving machines
 1863 – automatic player piano controlled by the Programmed sequence
 1947 – First 3-axis curvature data employed to control M/C Tool.
 1951 – First numerical control (NC) machine tool
 1960s – Direct numerical control (DNC) was introduced
 1970s – CNC machine introduced
 1980s – Distributive numerical control

Numerical Control can defined as on operation of machine tools by the means of


specifically coded instructions to the machine control system. Instructions are
combinations of letters of the alphabet, digits and selected symbols. The explicit
instructions describe the type and order of the individual steps required to perform a
given task. We use an instruction language called G-code to deliver these instructions to
the machine.

NC  CNC

NC  Numerical Control uses fixed logical functions that are hardwired in the
controller. The system can interpret a part program, but does not allow any changes to the
program. All changes must be done away from the controller The NC system requires the
use of punched tapes for input of the program information.

CNC  Computer Numerical Control uses an internal microprocessor; hence, the


program can be changed on the controller itself.
Simulations
Conversational controllers

G code:
- alphanumeric code delivering instructions to the machine
- uses the standard Cartesian coordinate system
- interpreted language  evaluated one line segment at a time on the machine
controller

Dr. R. Jill Urbanic 2


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

Describing A Machine Tool


Examination of various machine tools reveals that they all consist of a machine base
(usually a large casting) with an assortment of machine components (axes, tables, turrets,
spindles, etc) fastened to it in various configurations.
A machine tool consists of a multiple kinematic links. Each link ends with a tool or a
fixture. There are various machine topologies or machine structures. It is not sufficient to
state that the machine has X, Y, and Z axes. How these axes are fastened together has a
tremendous impact on the machine description. Topology basically distinguishes various
machine configurations from one another. (Gantry vs. column, table/table vs. head/table,
etc.)
Each axis has a stroke length, the table has dimensions, there are a certain number of
tools that may be stored on the machine, there is an RPM range for the spindle along with
the power output rating, a feedrate range, a rapid traverse rate, a maximum tool length,
diameter and weight. The specifications are machine dependent. The main specifications
have been listed; however, there are more.

Dr. R. Jill Urbanic 3


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

Vertical Milling Machine Representation and Actual Machine Classic Machine

3 Axis Gantry Mill and Conceptual Representation

5 Axis Horizontal Milling Machine

Dr. R. Jill Urbanic 4


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

Machine Geometry
 Right hand coordinate system
 Axes, planes, point of origin X0, Y0, Z0
o Z axis axis along which a simple hole can be machined with a single
point tool
o X axis  longitudinal direction
o Y axis  cross direction (vertical) column direction (horizontal)
o Z axis  spindle direction
o machine origin  part origin relationship  work offset
 Additional Axes:
o secondary axes (mounted on the spindle) U, V, W  parallel to X, Y, Z
respectively
o rotary axes (fixture) A, B, C  rotated about the X, Y, Z axes
respectively)
o Positive direction for the rotary axes follow the right hand rule

Standard Orientation of Planes and CNC machine tool axes

Dr. R. Jill Urbanic 5


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

Relationship of Primary and Secondary Axes

From a programming perspective  programming always takes place from the viewpoint
of the spindle, NOT the operator. The positive and negative motion of the machine axes
may be OPPOSITE to the positive and negative programming directions.

Remember the REFERENCE FRAME IS ALWAYS THE SPINDLE

Dr. R. Jill Urbanic 6


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

Introduction to Process Planning


Processing Planning  determines the appropriate procedures for transforming raw
materials into a final product given an engineering design
fabrication, heat treat, assembly, inspection, testing, finishing, packaging, …

drilling, milling, turning, grinding

Process selection depends on the following items:


- Material requirements
- Volumes
- Tolerances
- Part complexity Study the part print
- Setup costs
- Expertise

Generic Machining Operations


- Study the part print
- Select the most suitable machining method
o tool selection
o order of operations
o tool paths
- Decide on the method of holding the workpiece
- Select the cutting tools
- Establish the feeds and speeds
- Machine the part

Program Planning  suggested order of operations [There will be iterations in this process]

 Study of initial information (drawing, volumes, machine capabilities, and any


other relevant information)
 Material stock evaluation (bar stock, forging, casting, etc.)
 Machine tool specifications (work envelope, speeds, feeds, etc.)
 Control system features
 Sequence of machining operations
 Tooling selection and arrangement of the cutting tools
 Setup of the part
 Technological data (speeds, feedrates)
 Determination of the tool path
 Working sketches and mathematical calculations (what if studies)
 Program writing, verification
 Transfer the program to the CNC machine(s)
 Program testing and debugging
 Program documentation

Dr. R. Jill Urbanic 7


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

Basic Programming
A program for a numerically controlled machine tool is comprised of a series of program
blocks, each block being terminated by an “end of block” code. [The EOB button on the
keypad generates a semicolon (;) as the end of block code.] A block is comprised of one
or more words. A word is comprised of an address followed by numbers. Those
numbers that require decimal point programming are signed values. A positive value is
the default and thus the plus sign (+) need not be programmed. The address is a letter
which indicates the meaning of the numerical value following the address. Some
addresses may differ in meaning depending on the preparatory functions specified in the
program.
Character  Word  Block  Program

Character: smallest unit of the CNC program, and can be a digit, letter or symbol
*Use capital letters*

Word: combination of alphanumeric characters, creating a single instruction to the


control system

Block: consists of one or more words  Each block must be separated form all others 
EOB or “end of block” code

The word address format notation for the metric system

X ±5.3
Number of digits after the decimal point
Decimal point
Number of digits before the decimal point

Possible value

Address

If there is no decimal point for a notation, the decimal point is not used. The following
address codes require decimal programming:

X, Y, Z, I, J, K, R, Q, F

If the decimal point is omitted, the value programmed represents the number of minimum
dimension units and in the metric mode would result in the value being multiplied by
0.001 mm. For example, X5 would result in a value of 0.005 mm in the x direction,
whereas X5. yields a value of 5.0 mm.

Dr. R. Jill Urbanic 8


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

The functions, the address codes along with their numeric value ranges, and the meanings
of the functions are listed in the following table:

Note [ ] METRIC values

Description Codes Values Word Format Comment


Notation
Program O 0001 - 9999 O4
Number
Sequence N 001-99999 N5 Block number
Number
Preparatory G 00-99 G2 Motion mode
Function
Dimension A, B, C A+5.3 B+5.3 C+5.3 Rotary or indexing axes
Word X, Y, Z X4.4 Y+4.4 Z+4.4 Translational axes
[X5.3 Y+5.3 Z+5.3]
R R+4.4 [R+5.3] Arc radius, corner R
I, J, K I+4.4 [I+5.3] Coordinate value of arc
centre
U, V, W U+4.4 [U+5.3] Incremental values
Feed F Machine F5.3 Feed rate – the notation
Function dependent may vary depending on
0.0001 – the machine
3600.0000
mm/min
Spindle S Machine S5 Spindle speed in
Function dependent rev/min (integer value)
35-3500
rpm
Tool T 01-99 T4 Tool number, tool
Function offset number
Misc. M 00 - 99 M2 ON/OFF Special
Function controls that are
machine dependent
Offset H, D 00 - 99 D2, H3 Tool offsets
Number
Dwell P, X 0-99999.99 P5.3, X5.3 Dwell time
sec
Subprogram P 0001-9999 P4
Number
Repetitive L 0-9999 L4 Repetitive count in
Count canned cycles or
subprogram
Parameter P, Q, R See notes Parameters in canned
cycles
Symbols in Programming

Dr. R. Jill Urbanic 9


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

Symbol Description Comment


. Decimal point
+ Plus sign Positive value or addition
- Minus sign Negative value or substraction
* Multiplication sign Multiplication
/ Slash Block skip function or
Division
() Parenthesis Program comments and messages
% Percent sign Stop code (end of program file)
: Colon Program number designation
, Comma Used only within comments
[] Brackets Arguments for Fanuc controls
; Semi-colon Non-programmable end of block symbol
(screen display only)
# Sharp sign Variable definition or call in Fanuc macros
= Equal sign Equality in Fanuc macros

Modality: Once a Modal command is turned on and executed, it remains active until it is
overridden by another modal command. If a command is not a modal command, it must
be repeated on every line of the CNC program that it is used.

Conflicting commands: The purpose of the preparatory codes is to select a mode of


operation. Consider G01 G00 X.3.5 Y6.125 F20.0

G00 is the rapid mode and is a code for a particular type of tool motion.
G01 is the linear interpolation command, and has an associated feed rate.

Both commands cannot be active at the same time. If a conflict situation occurs, then the
latter code will be active. In the above example, a rapid motion will occur. The feed rate
is ignored.

Word order in a block: G codes are normally programmed at the beginning of a block,
after the block number, before the other significant data. This is good programming
practice, and will avoid surprises, such as if you were switching between rapid and
interpolation modes, absolute and incremental modes, etc.

Group Codes (Grouping of commands): Fanuc has grouped “like commands” into
arbitrarily numbered group codes. If two or more commands are used in the same
program block, they are in conflict with each other. The group codes vary from 00 to 25.

G codes of group 00 are not modal.

A number of G codes can be specified in a single block if they are of different


groups from one another.

Dr. R. Jill Urbanic 10


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

Startup Block or Safe Block


A startup block is a special sequence block. It contains one or more modal words that
preset the control system into a desired initial or default state. This block is placed at the
beginning of every program or at the beginning of every new tool  this is a safe
programming approach, and should be followed consistently. If a program is transported
from one machine to another, the programmer does not have to rely on the default
settings of the machine. The startup block proceeds any motion commands, including tool
changes. The startup block will be different for milling and turning machines due to their
unique requirements.

The most common entries are:

G00  select the rapid mode


G17  select the XY plane
G20 / G21  select English or Metric mode. DO NOT mix modes within any program
G40  cancel cutter compensation
G54  select a default work coordinate system
G64  continuous cutting mode (normal cutting mode)
G80  cancels any active canned cycles
G90 (G91)  select absolute or incremental programming modes
G98  retract to an initial level default

English / Metric
All controls are based on the metric system. Any switching does not ensure a full
conversion will take place. Some tool offset screens may still be in the metric mode.
Units must be consistent for dimensional words (X, Y, Z, I, J, K, …) Feedrate function
(F), tool offset values (H, D), and for constant surface speed mode (CSS – lathes).
G20: select English mode.
G21: select Metric mode.

Absolute / Incremental
There are two ways to command axis travel; the absolute command mode and the
incremental command mode. In the absolute command mode, the absolute coordinate
values (X,Y,Z) of the end points are programmed. The (X,Y,Z) values are measured with
respect to the program origin. In the incremental mode, the actual distance the tool is to
be moved is from one point to another is programmed. If the required motion for any axis
is zero, that axis in general need not be programmed. In the absolute mode if any of the
axis are not programmed, the existing absolute values in the buffers remain the same and
no motion is produced along those axes; in the incremental mode, if any of the axes are
not programmed, the incremental distance to be moved is assumed to be zero and thus no
incremental motion is produced along those axes.

G90: absolute
G91: incremental

Dr. R. Jill Urbanic 11


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

G90 X0 Y0 Z0  returns to the home position


G91 X0 Y0 Z0  no movement

Active Plane
The G codes to set the active planes are summarized in the following table. For three
dimensional helical interpolation, the arc vectors are I, J and K.

Active Linear Arc Vectors


G code Plane Motion
G17 XY Plane Z I, J
G18 ZX Plane Y I, K
G19 YZ Plane X J, K

Interpolation
Linear Interpolation
If we have two points, A and B, which lie in the XY plane and if we wish to move the
cutter from point A to point B, the path that is generated between A and B will depend on
the feedrates that are applied to the X and Y axes. For any machine tool there will be a
maximum federate that can be applied to each of its axes. In some machine tools the
maximum federate allowed will be the same for all axes; however, this is not always the
case.

If the reason for the move is merely to reposition the tool and cutting takes places during
the move, the actual path taken between A and B may not be important as long as the tool
is guaranteed to be at point B at the end of the move. This type of motion is referred to as
“point to point” because only the end point criterion must be satisfied and the path that
the tool takes to get there. Under these conditions, it would be desirable to perform the
positioning as quickly as possible and therefore point-to-point motion is usually
performed in a rapid feedrate mode.

On the other hand, if the pupose of moving the tool from A to B is to perform a straight
line cut along the line AB, then the path that the tool takes in moving from A to B is
critical and must be linearly interpolated. Linear interpolation is accomplished by
setting the relative feedrates of each axis such as to ensure that a straight line motion
between A and B is generated at the required feedrate.

Dr. R. Jill Urbanic 12


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

Y
Point to Point C B 50,30
Path

Interpolated
A Path
10,10

Consider the above example illustrated above. The tool is to be moved 40 units in X and
20 units in Y. To rapid position the tool, the maximum feedrate, which is assumed to be
the same for both axes, is applied simultaneously to both axes. The resulting motion is
ACB since the required distances are not the same. The Y axis motion is completed
before the X axis motion.

If the tool is to perform a straight line motion, the feedrates must be calculated as
follows:
x y
Fx  F . , F y  F . , L  x 2  y 2
L L
x and y are the distances required along the x and y axes
Here in the above example, Fx is twice Fy.

The above discussion on interpolation has been limited to a two dimensional example.
However, the concepts are identical when working with all three dimensions.

It is the programmer’s responsibility to assure that any tool motion


occurs without interfering with any obstacles along its way (e.g. clamps,
vices, fixtures, the part itself!)

Circular Interpolation
The circular interpolation mode permits the tool to be moved in a circular arc, if, and only
if, the arc line in a plane which is parallel to one of the three Cartesian planes (XY, ZX,
ZY). To specify circular interpolation, four pieces of data must be provided:
(1) plane selection (G17, G18, G19),
(2) direction of rotation CW or CCW (G02, G03 respectively)
(3) the end point position on the arc, and
(4) the distance from the starting point on the arc to the centre of the arc or the arc
radius

Format for an arc parallel to XY plane:


G17 G02 X____ Y____ Z____ I____ J____ K____ F____;
G03 R____

Dr. R. Jill Urbanic 13


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

Circular Interpolation: Case 1 - XY plane and incremental center (X, Y, I, and J)

This section covers the use of G2 to make arcs in the X-Y plane on controllers that use
incremental center coordinates.

Center location method: Incremental using I and J

Controller modes: G90 (Absolute coordinates) G17 (XY plane circles)

Example:
G1 X1.375 Y0.25 (GO TO START OF ARC)
G2 X1.75 Y-0.125 I0 J-0.375 (CLOCKWISE CIRCULAR MOVE)

 The G1 positions the tool at the start of the arc.


 The G2 drives the arc to the coordinate position specified by X and Y.
 The center point is specified by I and J coordinates.
 I is measured along the X axis and J along the Y axis.
 These are incremental values from the start point - in other words, they are the
distance from the start point to the center along X and Y.
 I is zero because the start and center points have the same X value.
 J is negative because the center point is in a negative direction on theY axis.

Note that Z values have been ignored. We are assuming that Z was set prior to the G1
linear move and we are creating a 2D arc so the Z value, whatever it is, remains the same
throughout.

Case 2 - XY plane and a radius R (X, Y, and R)

Dr. R. Jill Urbanic 14


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

This section covers the use of G2 to make arcs in the X-Y plane on controllers that let
you specify the arc radius with an R-word.

Center location method: R word


Controller modes: G90 (Absolute coordinates) G17 (XY plane circles)

Example:
G1 X1.375 Y0.25 (GO TO START OF ARC)
G2 X1.75 Y-0.125 R0.375 (CLOCKWISE CIRCULAR MOVE)

 The G1 positions the tool at the start of the arc.


 The G2 drives the arc to the coordinate position specified by X and Y.
 The center point is calculated based on the radius which is specified in the R0.375.

It looks almost too easy - what's the catch?

There are a several things to consider.


If you need to program a 360° circle, you probably can't use an R-word - you'll need to
use I and J.

You are defining an arc using two points and a radius so there are two possible arcs that
will fit your values - you need to tell the control which one you mean. This is done by
using a positive R value if the arc is less than 180 degrees and a negative R value is
greater than 180 degrees.

Center location method: R word


Controller modes: G90 (Absolute coordinates) G17 (XY plane circles)

The figure shows


the path generated
with

G2 X1.75 Y-0.125 R0.375 (UNDER 180 DEG) and


G2 X1.75 Y-0.125 R-0.375 (OVER 180 DEG)

Dr. R. Jill Urbanic 15


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

If the arc is exactly 180 degrees, you have a choice to make. You can try a positive value
and see what happens (best to "cut air" for this and a bit of prayer won't hurt) or you can,
and should, break the arc into two segments and program it in two moves.

Special cases - Quadrants and complete circles

Some controllers will not handle arcs that pass through an "axis crossover point" (a
quadrant boundary - 0, 90, 180, 270 degrees.) If this is the case, you need to break the arc
at these points. Many people recommend doing this for all arcs, regardless of controller
capabilities, and many postprocessors offer the option to do it automatically. Also, see if
your controller uses a G-code for this, usually a G75 for "multi-quadrant" mode which is
cancelled by a G74. A bit of needless info - the "axis crossover" restriction usually relates
to motors having to change direction at this point.

Example:
G1 X1.1053 Y0.1355
G2 X1.375 Y0.25 I0.2697 J-0.2605
G2 X1.75 Y-0.125 I0 J-0.375
G2 X1.6887 Y-0.3305 I-0.375 J0

 The G1 positions the tool at the start of the arc.


 The G2's drive the arc to the quadrant boundaries and the end positions specified
by X and Y.
 The center point is specified by I and J coordinates. I is measured along the X axis
and J along the Y axis.
 These are incremental values from the start point of each arc segment.
 Don't forget that the controller sees this as three separate arcs, not just one.
 Most controllers would not require that the "G2" be repeated in each block above.

Regarding complete circles - some controllers handle them and some don't. A controller
that can process multi-quadrant arcs may accept an arc end point that is identical to the
current tool position and machine a complete circle. Others may do nothing, and others
may throw an error condition. If you have any doubt about the capabilities, break the
circle into pieces and cut each arc separately.

Dr. R. Jill Urbanic 16


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

Planes other than XY

On many machines, G2 and G3 commands can be used to drive arcs in the ZX and YZ
planes. G18 is usually used to switch to the ZX plane and G19 selects the YZ plane.
Don't forget, though, that to make a circular feature on a part in these planes using a 3
axis machine the tool path itself won't be circular unless an angled head is used.
A G2 causes clockwise motion as viewed from the positive direction of the perpendicular
axis and the figure reflects this.

Y X Z
G03 G03 G03

G02 G02 G02

X Z Y

To determine the direction of rotation, the plane is viewed from the positive direction of
the Z axis (X / Y) onto the XY plane (ZX or YZ) in the right hand Cartesian coordinate
system. Note the axis labels and the G02 / G03 directions. Do not get this confused or
you will have unexpected results.

Lathes
Use of G2 and G3 on a lathe is similar to their use on a machining center, although tool
shape is more of a consideration. A 2 axis lathe operates in the ZX plane, and uses the I
and K words for center location.

Dr. R. Jill Urbanic 17


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

The figure shows a simple case using an imaginary tool tip as a reference point. The nose
radius is 0.0625. The program fragment below follows the part profile, accounting for
insert geometry.

G1 Z1.6875
G2 X0.9375 Z1.6875 I1.6875 K0
G1 X1.5 (GO PAST)

Note that the G2 direction is "backwards" based on normal G18 conventions. This just
illustrates how important it is to read the programming manual applicable to the machine
being programmed. If we programmed this move using the center point of the nose
radius, the instructions would be more like previous examples although the setup would
be different.

Cutter Compensation
Cutter (radius) compensation can generally be used for G2 and G3 moves just as for
linear moves. Most considerations are the same - you need to be careful where you turn it
on and off and so on. Also, be sure that you don't inadvertently enter a tool radius that is
larger than, or even equal to, the smallest arc radius used in an inside corner.

3D Circular Interpolation
Some machines provide helical interpolation via G2 and G3 commands. Programming it
is pretty straightforward - just include a Z value in the G2/G3 that differs from the
starting position. The motion will end with the tool in the specified Z position. The Z
increments will be determined by the number of actual XY moves to complete the arc. In
other words, when the arc is 40 percent done, so is the Z motion. This can be used for
ramping into a pocket or other approach moves.

Also, some controllers allow a more advanced form of 3D arcs using a sphere to control
depth. An explanation is outside the scope of this course.

Dr. R. Jill Urbanic 18


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

Spindle Function
The program command relative to spindle speed is controlled in the CNC system by the
address S. The actual spindle speed range of values must be determined by the machine
specifications.

There are two main methods of programming the spindle speed. They are:

 Direct spindle speed  r/min [typical for milling machines]


 Peripheral spindle speed  ft/min or m/min [typical for turning machines]

G96 Constant surface speed control


G97 Constant surface speed control cancel

Most machine spindles can be rotated both clockwise and counter clockwise. There are
two miscellaneous functions that control the direction of the spindle.

M03: CW
M04: CCW

Feedrate Function
The address for a feedrate word is F, followed by the number of digits. There are two
types of feedrates:

 Feedrate per minute  in/min or mm/min


 Feedrate per revolution in/rev or mm/rev

G94 Per minute feed


G95 Per revolution feed

To select the best spindle speed and feedrate, some general knowledge of machining is
required. There are several parameters that must be considered, such as:

 Cutting tool material


 Workpiece material
 Tool diameter [machining centre] or tool radius [turning]
 Tool geometry (number of flutes or cutting edges)
 Tool overhang
 Amount of material to be removed (depth and width of cut)
 Surface finish requirements for the part

Dr. R. Jill Urbanic 19


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

Acceleration and Deceleration

During a contouring operation, the cutting direction is constantly being changed. The
control may have to stop the X axis motion, then start the Y axis motion. To stop, the X
axis must decelerate, and the Y axis must accelerate. A possible cutting error may occur
at sharp corners because of undesirable overshoot, especially when using high feedrates.

Exaggerated
overshoot
Exact Stop

G09/G61 used

If the error needs correction, Fanuc controls provides two Gcodes to alleviate this
problem (note: this increases cycle time):
G09 Exact stop check (one block only)
G61 Exact stop check mode (modal)

For completeness, there are 3 other feedrate modes, G62 (automatic corner override),
G64 (normal) and G63 (tapping mode  ignores any feedrate override settings on the
control panel). G62 and G64 are illustrated below.

G62 G64

Check out these links:


Simulations: http://www.cncsimulator.com/
G codes / CNC training:

Dr. R. Jill Urbanic 20


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

Cutter Compensation
In the homework assignment, the tool coordinates had to be hand calculated. These points
would then need to be incorporated into the program to generate the correct tool path.
You spent some time to create the coordinate values. For complex geometry or a non-
standard cutter, errors could be easily made. The results will be potentially a scrapped
part, tool, fixture, and machine damage. If a different tool is used, the program needs to
be completely rewritten – obviously there has to be a better way. There is no guarantee
that the person developing the program will know the actual cutter diameter at the time of
programming. We will now examine cutter compensation – or 2D cutter offset
compensation IN THE COMPENSATION PLANE (remember G17, G18, G19).

G40 Cutter compensation Cancel


G41 Cutter compensation Left
G42 Cutter compensation Right

G41 G42
Left Right

G42 G41 M03

M03
Right Left

G40 G40 Climb milling – G41 Conventional milling – G42

None None

Figure 2.1: G40, G41, G42 Compensation

The concept of compensation is simple, but there are three steps that must be taken:
 Select the tool plane
 Select the compensation mode for the tool path under consideration
o Must know the direction of the cutter motion and which side of the feature
is being cut (i.e. clockwise / counter clockwise direction, internal or
external tool path)
 CANCEL the compensation immediately after it is utilized to prevent catastrophic
problems

Dr. R. Jill Urbanic 21


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

Figure 2.2: G40, G41, G42 Compensation and Arc Mode


Class Exercise

Essentially, the controller must know three things:


 Tool diameter / radius
 Coordinates of the part
 Which side the part that the tool path is to be generated

When you are using cutter compensation, the outline of the part is programmed.
The controller must determine the 2D offset vector based on the effective radius of the
cutter in order to generate the tool coordinates for the required cutter path. The vector is
calculated base on the offset amount that has been set in the tool offset memory and is
specified in the program by the D code. The compensation methods are controller
specific. Some generic issues (based on Fanuc controllers) are presented here.

The D code is a two digit integer code (address notation from lecture 1). This code
represents the location in the tool offset file memory where the actual tool offset value is
stored. It is good programming practice to relate the D code to the designated tool
number for which the code is used.

The appropriate side of the part to be cut is determined by viewing the geometry in the
direction the cutter is to travel – you compensate the cutter either to the left or to the
right.

G40, G41 and G42 are used simultaneously with G00, G01, G02 and G03 to define a
mode that determines the amount and direction of the offset vectors and the direction of
tool motion. A G41 or G42 command causes the controller to enter the offset mode with
the offset specified by the D code, and a G40 command cause the controller to cancel the
offset mode. Thus for sections of programming that employ cutter compensation there are

Dr. R. Jill Urbanic 22


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

three modes or sequences of blocks that must be programmed: they are the start up block,
subsequent machining blocks, and the cancel block.
ALWAYS CANCEL THE CUTTER COMPENSATION WHEN FINISHED.

Following are some illustrations (using G42) how the tool paths are generated when
employing cutter compensation. The controller may generate “intermediate” tool path
motions internally. You must be aware of the potential tool path variations to ensure that
the tool motion programmed will yield the desired results. The tool paths for G41 AND
G40 are similar in nature.

  180

r
3
2

1 G42

Figure 2.3: Linear Moves,   180 for G42 Compensation


Solid Line Programmed Moves, Dashed Line Tool Motion

Figure 2.4: Linear Moves, 90   < 180 for G42 Compensation


Solid Line Programmed Moves, Dashed Line Tool Motion

Dr. R. Jill Urbanic 23


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

Figure 2.5: Linear Moves,  < 90 for G42 Compensation


Solid Line Programmed Moves, Dashed Line Tool Motion

Always select the start position of the cutter away from the contour,
in a clear area.

Always apply the cutter radius offset together with a tool motion.

Notes: In order for the controller to determine the offset vectors, it may employ a look
ahead operation reading two blocks ahead of the current block being executed (which is
how you can get screwed up if you are mixing metric and inch systems!). If this is the
case (older controllers do not have two block look ahead) as a result, the controller
imposes the restriction that when cutter compensation is in effect two consecutive
program blocks in which no motion is programmed (in the compensated plane) is NOT
ALLOWED. If you do not follow this practice, unexpected results may occur.

Consider the tool motion for the following block: N21 G01 G41 X0 D01 F17.0
N22 M08 (coolant on)
N6 G41 X0 D01 F15.0 N23 G04 P1000 (dwell 1 sec.)
N24 Y 2.5
What happens? Example of 2 no motion codes will
create problems
It depends.
If the controller cannot compute a
On what? compensation mode, compensation
will not be turned on.
The NEXT move 
If the next move is a Y +ve move, the cutter moves to the left of the X axis.
If the next move is a Y –ve move, the cutter moves to the right of the X axis.

Dr. R. Jill Urbanic 24


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

The controller must look ahead to properly apply the compensation mode.

G41 G41

D01 D01
X0 X0

Figure 2.6: Compensation and Look Ahead

Arc commands (G02 & G03) are not allowed in the cutter compensation start up
and cancel blocks.

The start up and cancel blocks are often used to position the cutter and in such a case no
actual machining takes place in these blocks (i.e. move the cutter to a safety zone).

Make certain that the plane selection G code is active and that the required D code is
programmed.

Preventing Scrap:

(1) Ensure the cutter radius is smaller than smallest inside radius of the part
contour.

(2) Ideal conditions are rare. You can use tool wear offsets to change the effective
radius of the cutting tool. The goal is to create some temporary settings that
will leave residual stock, and allow you to make adjustments before
performing the final cut.

External cut  make the part intentionally larger  positive offset value to
increase radius
Internal cut  make the part intentionally smaller  negative offset value to
decrease radius

Measure the part to determine the effective diameter size, adjust the offsets
again, and then recut to the right size.

Dr. R. Jill Urbanic 25


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

Reference Points
Machine Reference Point – machine zero or the home position for each axis
Program Reference Point – program zero point
Part Reference Point – part datum
Tool Reference Point – tool tip

All of these reference points interact. The Machine Reference Point is the origin of the
machine coordinate system. This point will vary between machine manufacturers, and the
various machine configurations. The part is located in a work fixture. The location of this
device is critical  you must check for angular alignment in all 3 planes. [Note: the
spindle must be square as well]. The program zero should take into consideration
practical restrictions:
o part datum points and feature relationships
o convenience of setup and operation
o safety of the working conditions

There may be multiple datum points on a part – i.e. casting datum points, machining
datum points, feature datum points, and so forth. A datum is selected on the basis of its
geometric relationship to other features and the functional requirements of the design. A
part datum may NOT be the best point for a program zero. The part drawing must be
carefully analysed to determine the best program zero.

Figure 2.7: Datum Points, Planes

The relationship between the machine zero point and the workpiece zero is established
using a work offset. The relationship between tool, part and the machine is established
using a tool offset.

Dr. R. Jill Urbanic 26


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

Figure 2. 8: Multiple Program / Part Zero Reference Points

Work Offsets
The coordinate system used for machining is called the work coordinate system. Up to 6
different work coordinate systems can be specified in a Fanuc controller. With the newer
Fanuc controllers, even more coordinate systems can be specified. A work coordinate
system is established by measuring the program zero datum points relative to the machine
zero point, and storing the values in the appropriate workpiece offset table. The G codes
representing the work offsets are modal.

G54 Workpiece Coordinate System 1


G55 Workpiece Coordinate System 2 Establish the part datum
G56 Workpiece Coordinate System 3 points using an edge
G57 Workpiece Coordinate System 4 finder or similar device.
G58 Workpiece Coordinate System 5
G59 Workpiece Coordinate System 6

Dr. R. Jill Urbanic 27


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

G54 G55 G56 G57

Offset Offset
P02 P03
Offset Offset
P01 P04

Machine Zero

Figure 2.9: Work Offsets

The Z offset interacts with the tool length offset, which is discussed in the next section. A
Z offset is used when there are several parts with variable height, within the same setup.
If there is only one part to be considered, set the Z offset to Z=0, and utilize the tool
length offset.
z
Use this surface to
establish tool offsets Z25

Z0 x
-Z10
G56
G54 G55
Table

G54 X-100. Y30.0 Z0


G55 X-10. Y30.0 –Z10
G56 X100. Y30.0 Z25

Figure 2.10: Work Offsets and Z

There are 6 work offset tables in the Fanuc controller. If this is not sufficient, the work
offset vector can be programmed directly in the main program using the following
notation:
G10 Program parameter input

G10 L2P## X__ Y__ Z__

P varies from 1 to 6, which corresponds to the individual G5x offsets


X, Y, Z are the offset values for the respective axes

Tool Offsets
Realistically, all tools are of different lengths and we would like to simplify our
programming by ignoring this fact. Most CNC machine tools provide a mechanism by

Dr. R. Jill Urbanic 28


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

which the tools can be measured and their relative lengths or OFFSETS stored so that
when a particular tool is called up, the controller will automatically compensate for these
differences in length. There are length offsets (H code address notation – lecture 1) and
radius offsets (D code). Typically there are two parameters associated with a tool offset
 one for geometry, and one for wear. The amount of tool length offset that is to be
compensated for each tool is stored in the tool length offset table. For example, if tool 1
were being used, H01 would be the required H code. Correlate the tool numbers, H
and D codes.

Various points can be selected on a tool you must understand the repercussions of the
reference point selection. For example, if you have the offset the extreme tip of the drill,
the depth of the hole must take the drill tip geometry (depth) into consideration. Note:
CAM software will take care of these issues automatically.

Flat End Drill Ball Nosed


mill End mill

Care must be
taken with the
tool position
or final part
program
geometry

Figure 2.11: Tool Reference Points

Tool Length Compensation


The value stored in the tool length compensation offset table added to (G43) or subtracted
from (G44) the absolute value of the programmed Z coordinate (work offset value in Z).

G43 Tool Length Compensation (Plus)


G44 Tool Length Compensation (Minus) Not commonly used
G49 Tool Length Compensation Cancel

N## G43 Z__ H__

The logic is simple: the stored tool length value is added (G43) or subtracted (G44) from
the absolute value of the programmed Z coordinate (work offset).

There are two methods of establishing the tool offsets:


(1) On Machine Tool Setting: The tool is advanced to the part. Positioning a piece
of paper on the part under which the tool will touch, you slowly advance the tool

Dr. R. Jill Urbanic 29


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

until the paper cannot move under the tool. Then you push the offset button on the
controller to establish the offset length. The offset value is the travel distance
between the machine zero PLUS the tip of the tool and the touch off surface
(program zero). This value will be a negative number. You use a G43 to add this
value to the absolute Z coordinate, which is Z0 in this case. (This method induces
non – productive time on the machine).

Gauge
Line

H01 H02
part

Figure 2.12: On-Machine Tool Offsets

(2) Off Machine Tool Setting: Some users prefer to preset the tools away from the
machine, which eliminates non-productive setup time. The actual value for the
tool length is stored in the offset table, and is a positive number. Z does not equal
0 for the work offset value. Presetting equipment and trained personnel is
expensive.

Gauge
Line

H01
H02
G54

part

Figure 2.13: Off-Machine Tool Offsets

At the end of the program, cancel the tool length offset using a G49.

Lathe Tool Nose Radius Offset


Milling cutters are always round in the top view; hence, the work offset strategy is
simple. All of the above discussion applies to lathe programming, but because the turning

Dr. R. Jill Urbanic 30


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

tools have a different design, there are some unique programming considerations for a
lathe. There are centreline tools such as drills, reamers and taps, but boring, facing, and
other turning operations have offset tool positions. As well, inserts are commonly used,
which have different configurations, and the cutting edge has a small corner radius.
Therefore, a complementary method for tool setting is used for a lathe. Both the work and
tool offsets are tied in together.

Centreline tools are always measured from the centre of the tool to the centreline of the
spindle along the X axis, and from the tool tip to the program zero along the Z axis.

Turret
@ home

T01

(X)

(Z)

Figure 2.14: Lathe Centreline Tool / Work Offsets

Once the X and Z values are established, the tool / work offsets are set.

For turning / boring tools, the situation is different. The tool nose reference point is a
virtual or imaginary point.

T01

(X)

(Z)

Figure 2.15: Lathe turning Tool / Work Offsets

There are many insert styles used in turning / boring, as shown in Figure 2.17. The
X+Z+ orientation is used for OD turning, the X-Z+ orientation is used for ID boring. It is

Dr. R. Jill Urbanic 31


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

difficult to determine the actual radius periphery. When establishing the work offset, you
touch off on the furthest points on the insert in X and Z, and create an imaginary
intersection point in space.

to Z0 to Z0
X+ Z+

to X0 X- Z+ to X0
Reference
Pt
How do we find the centre of the
insert radius? (green)
We cannot easily – but we can
find the reference point (red).

Figure 2.16: Lathe Imaginary Reference Points

The theoretical sharp point created from the work offset is established. However, this is
not correct. Compensation is applied to create an offset to generate the correct tool path.
An offset is used which is based on the nose radius, and the X Z distances from the centre
of the tool to the reference point.

Figure 2.17: Theoretical Sharp Corner Programming

Dr. R. Jill Urbanic 32


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

Dwell
The time for a dwell, or a pause in the machining program is in milliseconds. The P or X
code is used with a G04 command. The structure is G04 P1000 for a 1 second pause.
G04 Dwell

This command is not modal. The dwell function is used to break up chips when drilling,
grooving, parting off, and so forth. It may also be used when tapping, between feeding in
and out of the hole. It is also used for non-cutting applications after certain miscellaneous
functions such as moving the tailstock, a bar feeder, etc.

NEVER use a dwell function to perform manual operations on a machine.

Canned Cycles
Canned cycles or fixed cycles are pre-programmed cycles within the controller that
reduces repetitive programming for common features. The G codes are listed below. The
general format for these fixed cycles is a series of parameter values specified by a unique
address. The general format is

N## G## G@@ X.. Y.. R.. Z.. P.. Q.. I.. J.. F.. L.. K..

N – line number

G## - G98 or G99


G98 Set Initial Plane default
G99 Return to Retract (Rapid) Plane

G@@ - canned cycle number (from next table)

G73 High-Speed Peck Drilling Cycle


G74 Counter tapping cycle
G75 User canned cycle
G76 Fine boring cycle
G77 User canned cycle
G78 User canned cycle
G79 User canned cycle
G80 Cancel Canned Cycles
G81 Drilling Cycle
G82 Counter Boring Cycle
G83 Deep Hole Drilling Cycle
G84 Tapping cycle
G85 Boring Cycle

Dr. R. Jill Urbanic 33


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

G86 Boring Cycle


G87 Back Boring Cycle
G88 Boring Cycle
G89 Boring Cycle

X – hole position X
Y – hole position Y
R – z axis start position (R level)
Z – z axis end position (Z depth)
P – dwell time
Q – G73 or G83
Depth of each peck cycle
Q – G76 or G87
Amount of shift for boring
I – Amount of X axis shift for boring G76 or G87
J – Amount of Y axis shift for boring G76 or G87
F – feedrate specification
L or K – number of cycle repetitions

_______________________________________________________________________

Initial level
1
point
rapid
2 6 feed
Rapid
plane Z0
3 5

4
Bottom of hole

Figure 2.18: Generic Canned Cycle Showing Initial and R Levels

G98 Set Initial Plane default


G99 Return to Retract (Rapid) Plane

Dr. R. Jill Urbanic 34


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

The tool can retract to either a programmed initial level or rapid level. Absolute or
incremental programming can be used with canned cycles. Common cycles are
summarized below:

G81 – drilling cycle mainly used for drilling and centre drilling

G98 (G99) G81 X.. Y.. R.. Z.. F..

G82 – spot drilling / counter boring / spot facing cycle uses a dwell at the bottom of
the hole to create a smooth finish

G98 (G99) G82 X.. Y.. R.. Z.. P .. F..

G83 – peck (deep hole) drilling cycle used to break up and clear the chips when
drilling deep holes (note: the depth of rapid motion between pecks is set using a system
parameter)

G98 (G99) G83 X.. Y.. R.. Z.. Q .. F..

Initial level rapid


point feed
Rapid
plane Z0
Q

Bottom of hole

Figure 2.19: Pecking Cycle

G73 – High speed peck (deep hole) drilling cycle same as above, but the tool never
clears the hole between pecks (note: the depth of rapid motion between pecks is set using
a system parameter)

G98 (G99) G73 X.. Y.. R.. Z.. Q .. F..

The best peck depth is based on the design of the cutting tool, the machinability of the
material, the depth of the hole, and the fixturing.

Dr. R. Jill Urbanic 35


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

G84 – normal tapping cycle using M03  the spindle turns CW when the tool is
feeding in, and then turns CCW when feeding out

G98 (G99) G84 X.. Y.. R.. Z.. F..

G74 – reverse tapping cycle using M04 the spindle turns CCW when the tool is
feeding in, and then turns CW when feeding out

G98 (G99) G84 X.. Y.. R.. Z.. F..

_______________________________________________________________________

Fixed Cycle Repetition

When a selected fixed cycle is programmed for many holes, it is processed only once
unless the L or K address is used. This can be used in absolute or incremental modes to
repeat the canned cycle at other XY locations. The following examples provide the
equivalent results

N33 G90 G99


N34 G81 X17.0 Y20.0 R0.15 Z-2.4 F12.0 L1 (K1)
N35 X22.0 L1 (K1)
N36 X27.0 L1 (K1)
N37 X32.0 L1 (K1)
N38 G80

N33 G90 G99


N34 G81 X17.0 Y20.0 R0.15 Z-2.4 F12.0 L1 (K1)
N35 G91 X5.0 L3 (K1)
N36 G80

Y20.0

X17.0 X22.0 X27.0 X32.0

Figure 2.20: Repetition

Dr. R. Jill Urbanic 36


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

Coordinate Rotation
The two rectangles below are identical except that the bottom rectangle has been rotated
30 °. It is much easier to program the top rectangle than the bottom. Instead of
determining what the end coordinates are for the rectangle with the angular rotation, the
controller can do so if the coordinate rotation feature is used.

Figure 2.21: Coordinate Rotation

G68 Coordinate system rotation ON


G69 Coordinate system rotation OFF

Three items are required to define a rotated part:


o Centre of rotation
o Angle of rotation
o The tool path to rotate

G68 X…. Y …. R….

X – absolute x coordinate of the centre of rotation


Y – absolute x coordinate of the centre of rotation
R – angle of rotation

The XY coordinates are the pivot point (XZ for G18, YZ for G19). The plane selection
command must be entered before the coordinate rotation command. R can be positive
(CW) or negative (CCW).

When is this feature used?


(1) If the work envelope is small, and the part must be located at an angle in order to
fit the machine.
(2) Features that are easily programmed orthogonally are at an angle.

Dr. R. Jill Urbanic 37


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

35

10

Figure 2.22: Feature Coordinate Rotation Example

Miscellaneous Operations – M Codes


Miscellaneous or M-codes are used to start and stop the coolant, and spindle, execute a
tool or pallet change, stop the program, perform material handling operations and other
miscellaneous functions. The miscellaneous functions are machine manufacturer, type
and configuration dependent. A partial list of common M codes follows.

Milling Turning
M00 Compulsory program stop M00 Compulsory program stop
M01 Optional program stop M01 Optional program stop
M02 End of program (reset no rewind) M02 End of program
M03 Spindle rotation normal (CW) M03 Spindle rotation normal (CW)

M04 Spindle rotation reverse (CCW) M04 Spindle rotation reverse (CCW)
M05 Spindle stop M05 Spindle stop
M06 Automatic Tool Change M06
M07 Coolant mist ON M07 Coolant mist ON
M08 Coolant ON (pump motor ON) M08 Coolant ON (pump motor ON)
M09 Coolant OFF (pump motor OFF) M09 Coolant OFF (pump motor OFF)
M10 . M10 Chuck open
M11 . M11 Chuck closed
M12 . M12 Tailstock quill IN
M13 Spindle ON CW + coolant ON M13 Tailstock quill OUT
M14 Spindle ON CCW + coolant ON M14 .
M15 Spindle OFF + coolant OFF M15 .
M16 . M16 .

Dr. R. Jill Urbanic 38


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

M17 . M17 Turret indexing forward


M18 . M18 Turret indexing reverse
M19 Spindle Orientation M19 .
M20 . M20 .
M21 . M21 Tailstock forward
M22 . M22 Tailstock backward
M30 Program end (reset & rewind) M30 Program end
M40 . M40 .
M41 . M41 Low Gear Selection
M42 . M42 Medium Gear Selection 1
M43 . M43 Medium Gear Selection 2
M44 . M44 High Gear Selection
M48 Feedrate override cancel OFF M48 Feedrate override cancel OFF
M49 Feedrate override cancel ON M49 Feedrate override cancel ON
M60 Automatic Pallet Change M60 .
M98 Subprogram call M98 Subprogram call
M99 Subprogram end M99 Subprogram end

M functions activated at the start of a block


M03 Spindle rotation normal (CW)

M04 Spindle rotation reverse (CCW)


M06 Automatic Tool Change
M07 Coolant mist ON
M08 Coolant ON (pump motor ON)

M functions activated at the end of a block


M00 Compulsory program stop
M01 Optional program stop
M02 End of program
M05 Spindle stop

M09 Coolant OFF (pump motor OFF)


M30 Program end
M60 Automatic Pallet Change

Dr. R. Jill Urbanic 39


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

M functions ACTIVE until CANCELED or ALTERED


M03 Spindle rotation normal (CW)

M04 Spindle rotation reverse (CCW)


M06 Automatic Tool Change
M07 Coolant mist ON
M08 Coolant ON (pump motor ON)
M09 Coolant OFF (pump motor OFF)

M functions COMPLETED in one block


M00 Compulsory program stop
M01 Optional program stop
M02 End of program
M05 Spindle stop
M30 Program end
M60 Automatic Pallet Change

Only one M code can be programmed in a single block.

M00 – program is stopped, and the spindle and coolant turned off. When the cycle start
button is pressed on the console, the program is resumed.

M01- if the optional stop on the console is on, the M01 function is identical to the M00
function, else it is ignored.

M03 / M04 – turn the spindle on CW or CCW respectively. The rpm must be
previously defined by the spindle speed command (S).

M05 – stops the spindle irrespective of the direction

M30 – this indicates the end of the program. The spindle and coolant are turned off, and
the program reset to the beginning.

Tool Function Txx

Machining Centres (both mill and lathe) have a multiple tool storage in a tool magazine
(machining centre) or a turret (lathe) and the ability to change tooling automatically  a
feature called automatic tool change. Each pocket has a number associated with it; hence,
when tool 1 is chosen, the tool loaded in pocket 1 will be placed in the spindle or rotated
into position if using a lathe.

Programming a tool change is easy. For a machining centre, to bring tool in pocket four
into the spindle, one programs:

N## T04 M06 or N## M06 T04

Dr. R. Jill Urbanic 40


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

To load a tool into a waiting position (to reduce waiting time on the machine), on the next
line, program the address of the next tool to be used.

N## T04 M06;


N## T06; The tool magazine will rotate T06 into a waiting position

For a lathe, you use the T function in a standalone manner.

N ## TXXYY
XX – turret position and work offset number
YY – wear offset number

You cannot pre-stage a lathe tool unless it has a tool carrousel.

Program Structure
Program Number
Comments to describe the program, part, and other critical information such as revisions.
Start up block
Comment for tool 1
Program cutting motions for tool 1
Comment for tool 2
Program cutting motions for tool 2
.
.
Clear / cancel all settings
End of program
Stop code

O####
(COMMENT TO DESCRIBE THE PROGRAM SUCH AS MACHINE,
CONTROLLER, UNITS, JOB NUMBER, …)
(PART DESCRIPTION SUCH AS STOCK MAT’L, PROGRAM DATUM POINT)
(PROGRAMMER / DATE / REVISIONS………………)
N1 G17 G21 G40 G49 G54 G64 G80 G90 G94; (start up block)
N2 (½ INCH HSS DRILL)
N2 T01 M06;
N3 G00 X.. Y.. Z.. S.. M03 T02; (select a spindle speed, start up spindle, setup tool 2 to
be ready for tool change)
N4 G43 Z2.0 H01; (use tool length offset for tool 1)
.
.
N## cancel settings
N## M30;
%

Dr. R. Jill Urbanic 41


Computer Aided Manufacturing and Measurements 91-590-21/92-590-11 Winter 2016

Sample Program:

%
O0000
(PROGRAM NAME - MACHINE_GROUP_1_COMPG42 )
N1 G21
N2 G0 G17 G40 G49 G80 G90
( 8. FLAT ENDMILL TOOL - 8 DIA. OFF. - 8 LEN. - 8 DIA. - 8. )
( 3 flute endmill )
N3 T8 M6
N4 G0 G90 G54 X16. Y17. A0. S537 M3
N5 G43 H8 Z50.
N6 Z10.5
N7 G1 Z-13. F4.
N8 G42 D8 X8. F8.1
N9 G2 X0. Y25. R8.
N10 G1 Y50.
N11 X100.
N12 Y0.
N13 X0.
N14 Y25.
N15 G2 X8. Y33. R8.
N16 G1 G40 X16.
N17 Z-3. F4.
N18 G0 Z50.
N19 M5
N20 G91 G28 Z0.
N21 G28 X0. Y0. A0.
N22 M30
%

Dr. R. Jill Urbanic 42

You might also like