CNC Notes

Download as pdf or txt
Download as pdf or txt
You are on page 1of 55

Module II

PART PROGRAMMING
Part program is a set of instructions which instruct the machine tool about the processing
steps to be performed for the manufacture of a part. The shape and size of the finished
component is totally dependent on how well the program has been prepared. CNC code
consists of blocks, each of which contains an individual command for a movement or
specific action. Just as with conventional machines, one movement is made before the
next one. That’s why CNC codes are listed sequentially in numbered blocks.
Machining involves an important aspect of relative movement between cutting tool and
work piece. In machine tools this is accomplished by either moving the tool with respect
to work piece or vice versa. In order to define relative motion of two objects, reference
directions are required to be defined. A program defining motion of tool / work piece in
this coordinate system is known as a part program. The part program is a sequence of
instructions, which describe the work, which has to be done on a part, in the form required
by a computer. NC part programming comprises the collection of all data required to
produce the part, the calculation of a tool path along which the machine operations will be
performed and the arrangement of those given and calculated data in a standard format
that can be read and processed by the MCU.

While making the part program for a component, the programmer first studies the drawing and
decide upon the sequence of operations, the cutting tools, the path of cutter/tool, speeds and
feeds at various points, other necessary information like starting and stopping of machine etc.
The information is entered in a program sheet in a particular format acceptable by the machine
tool-control unit combination.
1
Page

Department of Mechanical Engineering SSET


Steps in part programming
The programmer has to do only following things:
A. Define the work part geometry.
B. Specifying the operation sequence.
a. Extraction of dimensional data from part drawings and data regarding
surface quality requirements on the machined component.
b. Select the tool and determine the tool offset.
c. Set up the zero position for the work piece.
d. Select the speed and rotation of the spindle.
e. Set up the tool motions according to the profile required.
f. Return the cutting tool to the reference point after completion of work.
g. End the program by stopping the spindle and coolant.
Two ways to program for numerical control
1) Manual part programming
2) Computer aided part programming.
3) Part programming using CAD/CAM
Manual Part Programming
In manual programming, the machining instructions are prepared on a document called a
part program manuscript in a standard format. Basically, the manuscripts is a listing of
the relative cutting tool/ work piece positions which must be followed in order to machine
the work piece. A punched tape is then prepared directly from the part programmer
manuscript. After the program is typed, the punched tape is prepared on the flexo writer.
Complex shaped components require tedious calculations.
The part programming contains the list of coordinate values along the X, Y and Z
directions of the entire tool path to finish the component. The program should also contain
information, such as feed and speed. Each of the necessary instructions for a particular
operation given in the part program is known as an NC word. A group of such NC words
constitutes a complete NC instruction, known as block. The commonly used words are N,
G, F, S, T, and M.

Computer Aided Part Programming


Manual part programming can be time consuming, tedious. and subject to errors for parts
possessing complex geometries or requiring many machining operations. In these cases,
and even for simpler jobs, it is advantageous to use computer-assisted part programming.
In computer-assisted part programming, the machining instructions are written in English
like statements that are subsequently translated by the computer into the low-level
machine code that can be interpreted and executed by the machine tool controller. If the
2

complex-shaped component requires calculations to produce the component are done by


Page

the programming software contained in the computer.

Department of Mechanical Engineering SSET


There are various programming languages developed in the recent past, such as APT,
ADAPT, AUTOSPOT, COMPAT-II is used for writing a computer programme, which
has English like statements. A translator known as compiler program is used to translate it
in a form acceptable to MCU.
Part programming using CAD/CAM
With the development of the CAD/CAM system, interactive graphic system is integrated
with the NC part programming. Built in tool motion commands can assist the part
programmer to calculate the tool paths automatically. It greatly enhances the speed and
accuracy in tool path generation.

3
Page

Department of Mechanical Engineering SSET


NC COORDINATE SYSTEM
In order for the part programmer to plan the sequence of position and movements of the
cutting tool relative to the work piece, it is necessary to establish a standard axis system
by which relative position can be specified.
Two axes X and Y are defined in the plane of the table. The Z axis is defined in the plane
perpendicular to the table and the movement in the z direction is controlled by the vertical
motion of the spindle. The positive and negative directions of motion of the cutting tools
are relative to the table along these axes. However, in addition to the three linear axes,
these machines may possess the capacity to control one or more rotational axes. Three
rotational axes are defined in NC: A, B, and C axes.

Machining of a work piece by an NC program in the NC lathe centers require a


‘coordinate system’ to be applied to the machine tool. The Z axis is always parallel to the
main spindle of the machine. The x axis is at right angle to the Z axis and parallel to the
work holding surface.

4
Page

Department of Mechanical Engineering SSET


Reference Points
A reference point is a fixed or selected arbitrary location on the machine, on the tool and on
the part. A fixed reference point is a precise location along two or more axes, designed
during manufacturing or setup. Three reference points are either set by manufacturer or
user.
Machine Origin-Machine Zero Point
The machine origin is a fixed point set by the machine tool builder. Usually it cannot be
changed. Any tool movement is measured from this point. The controller always remembers
tool distance from the machine origin.
Program Origin
It is also called home position of the tool. Program origin is point from where the tool starts
for its motion while executing a program and returns back at the end of the cycle. This can
be any point within the workspace of the tool which is sufficiently away from the part. In
case of CNC lathe it is a point where tool change is carried out.
Part Origin- Work piece zero point
This point determines the work piece co- ordinate system in relation to the CNC system
when setting up the machine. Usually part origin needs to be defined for each new setup.

Reference points on a lathe and milling machine.


5
Page

Department of Mechanical Engineering SSET


Tape Programming Format
The CNC machine uses a set of rules to enter, edit, receive and output data. These rules
are known as CNC Syntax, Programming format, or tape format. The format specifies the
order and arrangement of information entered. There are rules for the maximum and
minimum numerical values and word lengths and can be entered, and the arrangement of
the characters and word is important. The most common CNC format is the word address
format and the other two formats are fixed sequential block address format and tab
sequential format, which are obsolete. The instruction block consists of one or more
words. A word consists of an address followed by numerals. For the address, one of the
letters from A to Z is used.
Word Address Format
This type of tape format uses alphabets called address, identifying the function of
numerical data followed. This format is used by most of the NC machines, also called
variable block format. The MCU uses this alphabet for addressing a memory location in
it.
A typical instruction block will be as below:
N20 G00 X1.200 Y.100 F325 S1000 T03 M09 <EOB>
or
N20 G00 X1.200 Y.100 F325 S1000 T03 M09;
Tab Sequential Format
Here the alphabets are replaced by a Tab code, which is inserted between two words. The
MCU reads the first Tab and stores the data in the first location then the second word is
recognized by reading the record Tab. A typical Tab sequential instruction block will be as
below:
>20 >00 >1.200 >.100 >325 >1000 >03 >09
Fixed Block Format
In fixed block format no letter address of Tab code are used and none of words can be
omitted. The main advantage of this format is that the whole instruction block can be read
at the same instant, instead of reading character by character. This format can only be
used for positioning work only. A typical fixed block instruction block will be as below:
20 00 1.200 .100 325 1000 03 09 <EOB> 6
Page

NC Programming format / tape format

Department of Mechanical Engineering SSET


1. Sequence Number (N word)
Sequence Numbers are words that begin with letter “N” followed by numbers. These are
normally first word in every block of the program. These are used to identify and
sequence each block of information so that it can be distinguished from the rest. Sequence
number starts with any number and usually incremented in steps of 5 or 10s. Sequence
numbers are very useful when it is necessary to edit or make revisions to the program.
2. Preparatory functions (G word)
In CNC the preparatory function prepares or initiates different actions to occur on the
machine. It is a two-digit number (0 – 99) preceded by the word address letter “G”.
There are four main groups of G codes.
 To select a movement system (rapid movement or at a programmed feed rate)
 To select measurement system (metric or inch system)
 To program for compensation and differences in tool lengths and diameters
 To select a preset sequence of events known as canned cycles or fixed cycles.
3. Dimensional information words (X, Y, Z)
The desired work tool position is programmed using the address for the particular axis.
The coordinate information may be expressed using X, Y, Z. To specify angular positions
around the three coordinate axes used. Also the words I, J, K are used to specify the
position of arc centre in case of circular interpolation. With dimensional words it is
essential to enter a negative sign if required; if there is no sign the number is assumed to
be positive.
4. Feed function (F word)
Feed is the amount that the cutting tool advances into the work. It generally controls the
amount and rate of material removal for a particular tool and depends on the type of work
piece material to be machined. These are programmed in mm per minute or mm per
revolution of the spindle. Appropriate G codes must be used to specify whether the feed is
in mm per minute (G94) or mm per revolution (G95). To machine a part in 50mm/min the
feed will be specified as F50.
5. Spindle speed function (S-word)
Spindle speed measured in revolutions per minute (RPM), indicates the number of
revolutions that the spindle makes in one minute. The letter address S indicates spindle
speed and may be followed up to 5 digits. If the machine is required to run at 2000 rpm,
then the speed will be specified as S2000.
6. Tool selection function (T word)
The T word is needed only for the machines which have programmable tool turret or
automatic tool changer, which enables the tool loading and unloading in a very few
seconds. Thus the ratio of cutting time to total machine time is considerably increased.
7
Page

Each tool pocket in a turret or automatic tool changer has a distinct tool number. The T
word followed by two or three digits specifies which tool must be used for the operation.

Department of Mechanical Engineering SSET


For example, T12 means the tool number 12 (i.e. tool located in the position 12 of the
magazine) is to be loaded in the spindle for the cutting operation.
7. Miscellaneous function (M word)
Codes used for initiating machine tool functions like starting and stopping of the spindle,
on/off control of coolant flow and optional stop. Some of the miscellaneous functions are
modal (M03) and some are non-modal. The modal functions stay effective in successive
blocks until replaced by another function code. In addition to these coded functions,
spindle speeds, feeds and the required tool numbers to perform machining in a desired
sequence are also given.
G- Code description
G00 – Rapid traverse
The G00 code executes a non-cutting movement, at a rapid feed rate, to a specific co-
ordinate position in the working area. G00 command is written in the following format
G00 X_ _ _ _Y_ _ _ _ Z_ _ _ _
Here X, Y and Z denote the location of the ending position of the tool. The tool moves
from starting point to the ending point in maximum possible speed. The path taken by the
tool may not be linear, but it will be the quickest.

G01 Linear interpolation


The G01 code executes a cutting movement following a straight line, at a set feed rate.
G01 command is written in the following format.
G01 X_ _ _ _Y_ _ _ _ Z_ _ _ _
If we give the command, G01 X100 Y50 F50
Then, the tool will move from starting point to end point performing cutting motion in a
straight line between them at the specified feed rate (50 mm/min) 8
Page

Department of Mechanical Engineering SSET


G02 AND G03 Circular interpolation
The G02 code executes a cutting movement following a clockwise circular path, at a set
feed rate. The G03 code executes a cutting movement following a counter clockwise
circular path, at a set feed rate.
“I” relate to the address X and is the incremental value from the start point of the arc in
the X axis to the arc centre. J relates to the address Y and is the incremental value from
the start point of the arc in the Y axis to the arc centre.

G20 AND G21 – Imperial/metric data input


The machine controller can be programmed in either Imperial (inch) unit input (G20) or
Metric (milli-metre) unit input (G21). The standard format for a CNC part program is to
write the G20 or G21 code in the first block of the program.
G20 Imperial Inch
G21 Metric Milli-metre
G40 G41 G42 Cutter compensation
In NC machining, if the cutter axis is moving along the programmed path, the dimension
of the work piece obtained will be incorrect since the diameter of the cutter has not be
taken in to account. The use of cutter compensation allows the programmer to use the part
geometry exactly as from the print for programmed coordinates. Without using
compensation, the programmer must always know the cutter size and offset the
programmed coordinates for the geometry by the amount of the radius of cutter. In this
scenario, if a different size cutter is used the part will not be machined correctly.

9
Page

Department of Mechanical Engineering SSET


An added advantage for using cutter compensation is the ability to use any size cutter.
Also it makes moving the cutter closer to the corner part where the tool offset is different
due to radius of tool.
Compensation can be done in advance, by writing G codes that place the cutter closer to
the part on diagonal and arc moves by including the G41 and/or G42 codes in the G code
program. It allows the machine controller to produce very accurate arcs and tapers by
compensating for the tool radius. An added advantage for using cutter compensation is the
ability to use any size cutter as long as the offset amount is input accurately into the offset
register. The use of cutter compensation allows the programmer to use the part geometry
exactly as from the print for programmed coordinates.
G40 Cancel movement along programmed path
G41 Left hand movement on the left hand side of the programmed path
G42 Right hand movement on the right hand side of the programmed path

G40 = Cutter Compensation Cancel


G41 = Cutter Compensation Left
G42 = Cutter Compensation Right

Advantages of cutter compensation


1. The mathematical computations for determining a tool path are greatly simplified.
2. Because the geometry and not the tool center are programmed, the same program can be
used for a variety of different cutter diameters.
3. When using cutter compensation, you are then able to control and adjust for part
dimensions using your cutter diameter/radius offsets register.
4. The same program path can be used for the roughing passes as well as finishing cuts by
using different cutter offset numbers.
10
Page

Department of Mechanical Engineering SSET


G80 G81 CANNED CYCLE – DRILLING
A canned cycle is a way of conveniently performing repetitive CNC machine operations.
Canned cycles automate certain machining functions such as drilling, boring, threading,
pocketing, etc. A canned cycle is used to simplify programming of a part. Once selected, a
canned cycle is active until cancelled with the G80 code.
G80 Canned cycle stop and G81 for canned Drilling Cycle Start.
G98/G99 G81 X _ _ _ Y _ _ _ Z _ _ _ R _ _ _ F _ _ _

When the G81 cycle is activated, in a


single command, the following
operations takes place
Sequence of moves:
 Op1 Rapid position to X, Y
and Z (the Initial level)
 Op 2 Rapid traverse to R
point level
 Op 3 Feed to Z depth
 Op 4 Rapid traverse to Initial
level (G98) or R point level
(G99)

 G98 (default) will cause Z-axis to return to the initial starting point,
 G99 will return Z-axis to the R (reference) plane after a cycle has been executed
and positions to a new location to execute another cycle.
11
Page

Department of Mechanical Engineering SSET


M00 - Program Stop
When the machine controller reads the code M00 within a block, it halts the program. The
[CYCLE START] key must be pressed to allow the program to continue.
M01 - Optional Stop
The M01 code performs the same function as the M00 code, except the machine controller
only recognises the signal to halt the program if the optional [STOP] input key is
activated.
M02 - Program Reset
This code indicates the end of a program and performs a general reset function on the
machine controller, ie, the CNC reverts to its initial state. The code also acts as an M05.
M03 - Spindle Forward (Clockwise).
The clockwise direction of the spindle is determined by viewing from the back of the
machine headstock, along the Z axis towards the tailstock.
M04 - Spindle Reverse (Counter Clockwise)
An M04 code acts in the same way as an M03 code, only the spindle rotates in the
opposite direction.
M05* - Spindle Stop.
The M05 code, to stop the spindle rotating, is activated at the end of the block in which it
is programmed, ie , after any axis movement.
M06 - Automatic Tool Change
This code activates the machine turret and is followed by the code T_ _ _ _, instructing it
to move to the stated tool number.
For example: M06 T0303;
This command change automatically from the current tool number to tool number 3.
M08 - Coolant On
This code switches the coolant pump on.
M09* - Coolant Off
This code switches the coolant pump off.
M98 - Sub Program Call
This code will cause the machine controller to jump across from the main program to read
a different program in its memory (called a sub program).
M99 - Sub Program End and Return
On the last line of a sub program, the code M99 is entered. This reverts control back to the
12

main program. If an M99 code is programmed at the end of a main program, a continuous
loop will be established. If an M99 code is followed by a block number, P_ _ _ _ , control
Page

will return to the program line with the same number as stated in P_ _ _ _.

SSET Department of Mechanical Engineering


G-Codes
G00 - Positioning at rapid speed; Mill and Lathe
G01 - Linear interpolation (machining a straight line); Mill and Lathe
G02 - Circular interpolation clockwise (machining arcs); Mill and Lathe
G03 - Circular interpolation, counter clockwise; Mill and Lathe
G04 - Mill and Lathe, Dwell
G09 - Mill and Lathe, Exact stop
G10 - Setting offsets in the program; Mill and Lathe
G12 - Circular pocket milling, clockwise; Mill
G13 - Circular pocket milling, counter clockwise; Mill
G17 - X-Y plane for arc machining; Mill and Lathe with live tooling
G18 - Z-X plane for arc machining; Mill and Lathe with live tooling
G19 - Z-Y plane for arc machining; Mill and Lathe with live tooling
G20 - Inch units; Mill and Lathe
G21 - Metric units; Mill and Lathe
G27 - Reference return check; Mill and Lathe
G28 - Automatic return through reference point; Mill and Lathe
G29 - Move to location through reference point;
G31 - Skip function; Mill and Lathe
G32 - Thread cutting; Lathe
G33 - Thread cutting; Mill
G40 - Cancel diameter offset; Mill. Cancel tool nose offset; Lathe
G41 - Cutter compensation left; Mill. Tool nose radius compensation left
G42 - Cutter compensation right; Mill. Tool nose radius compensation right
G43 - Tool length compensation; Mill
G44 - Tool length compensation cancel; Mill (sometimes G49)
G50 - Set coordinate system and maximum RPM; Lathe
G52 - Local coordinate system setting; Mill and Lathe
G53 - Machine coordinate system setting; Mill and Lathe
13

G54~G59 – Work piece coordinate system settings #1 t0 #6; Mill and Lathe
Page

G61 - Exact stop check; Mill and Lathe

SSET Department of Mechanical Engineering


G65 - Custom macro call; Mill and Lathe
G70 - Finish cycle; Lathe
G71 - Rough turning cycle; Lathe
G72 - Rough facing cycle; Lathe
G73 - Irregular rough turning cycle; Lathe
G73 - Chip break drilling cycle; Mill
G74 - Left hand tapping; Mill
G74 - Face grooving or chip break drilling; Lathe
G75 - OD groove pecking; Lathe
G76 - Fine boring cycle; Mill
G76 - Threading cycle; Lathe
G80 - Cancel cycles; Mill and Lathe
G81 - Drill cycle; Mill and Lathe
G82 - Drill cycle with dwell; Mill
G83 - Peck drilling cycle; Mill
G84 - Tapping cycle; Mill and Lathe
G85 - Bore in, bore out; Mill and Lathe
G86 - Bore in, rapid out; Mill and Lathe
G87 - Back boring cycle; Mill
G90 - Absolute programming
G91 - Incremental programming
G92 - Reposition origin point; Mill
G92 - Thread cutting cycle; Lathe
G94 - Per minute feed; Mill
G95 - Per revolution feed; Mill
G96 - Constant surface speed control; Lathe
G97 - Constant surface speed cancel
G98 - Per minute feed; Lathe
G99 - Per revolution feed; Lathe
14
Page

SSET Department of Mechanical Engineering


M Codes
M00 - Program stop;
M01 - Optional program stop;
M02 - Program end;
M03 - Spindle on clockwise;
M04 - Spindle on counter-clockwise;
M05 - Spindle off;
M06 – Tool change;
M08 - Coolant on;
M09 - Coolant off;
M10 - Chuck or rotary table clamp;
M11 - Chuck or rotary table clamp off;
M19 - Orient spindle;
M30 - Program end, return to start;
M97 - Local sub-routine call;
M98 - Sub-program call;
M99 - End of sub program;

15
Page

SSET Department of Mechanical Engineering


Computer-Assisted Part Programming
The different types of NC programming are:
1. Manual Part Programming (G-Code)
2. Computer Assisted Part Programming (APT)
3. Part Programming Using CAD/CAM
Manual programming
In manual programming the programming instruction are laid down on a manuscript in a
standard format. The manuscript is a planning chart or list of instructions which describes the
operations necessary to produce the part. Manuscript contains information about the relative
position of the tool and work piece, preparatory commands, miscellaneous instructions, speed
and feed data and other control instruction needed to operate the machine tool. After the
program is typed, the punched tape is prepared on the flexo writer. Complex shaped
components require tedious calculations. This method is used for simple parts.
Computer assisted part programming
Most of the parts machined in NC machine are complex and require complicated point to point
and contouring operations and in such cases, it is desirable to use computers to assist part
programmer. This saves time, more accurate and more efficient programme. In APT, the
machining instructions are written in English- like statements that are subsequently translated
by the computer. Using such language requires that part programme be divided into two parts
1. Defining the geometry of work part
2. Specifying the tool path.
Automatically Programmed Tooling (APT)
APT or Automatically Programmed Tool is a high-level computer programming language most
commonly used to generate instructions for numerically controlled machine tools.
APT is a three-dimensional NC programming system. APT is not only a language; it is also the
computer program that processes the APT statements to calculate the corresponding cutter
positions and generate the machine tool control commands. In APT, the machining instructions
are written in English- like statements that are subsequently translated by the computer into the
low-level machine code that can be interpreted and executed by the machine tool controller.
In APT part programming languages, the two main tasks of the programmer are:
1. Define the part geometry
2. Specify the tool path and Operation Sequence
Other functions in APT
a. Specifying the speed and feed rate
b. Specifying cutter size and tool offset
16

c. Specifying the tolerance


d. Naming the program
Page

e. Identifying the machine tool

SSET Department of Mechanical Engineering


In APT language, each part geometry is considered to be made of basic elements such as
line, point, planes, cylinders and other mathematically defined surfaces. It is the task of
the part programmer to specify these basics elements. In APT, the programmer talks to the
computer via keyboard in a computer language designed specifically for NC machining.
APT requires a processor & a post-processor.
Post-processor generates the appropriate NC program for a particular CNC machine tool. The
data normally passed onto an APT post processor which produces an NC tape for a
specific machine tool. The postprocessor is a separate computer program that has been
written to prepare the punched tape for a specific machine tool.

APT processor is a very large programme which runs on mainframe computer and gives the
output called Cutter location Data (CLDATA).
The APT system consists of three parts namely
1. APT part programme –written in APT language (English statement)
2. APT programme processor- converts into cutter location file (CLDATA)
3. APT post processor-produces NC tape from cutter location data
You first write a program in APT, software converts it into a series of tool coordinates called
Cutter Location Data (CLD). Another piece of software, a translator called a Postprocessor, then
17

converts the CLD into an NC program (the G and M code program) that is understood by the
machine. You feed the NC program into the machine and cut the part.
Page

SSET Department of Mechanical Engineering


Four basic types of statements in the APT language
1. Geometry statements, also called definition statements; are used to define the geometry
elements that comprise the part.
2. Motion commands; are used to specify the tool path.
3. Postprocessor statements; control the machine tool operation, for example, to specify
speeds and feeds, set tolerance values for circular interpolation, and actuate other
capabilities of the machine tool.
4. Auxiliary statements; a group of miscellaneous statements used to name the part
program, insert comments in the program and accomplish similar functions.

Structure of APT Program


 Initial statements
 Definition of geometric entities – Part surfaces
 Motion statements
 Definition of machining conditions – Cutter specifications, tolerance, Spindle
speed, coolant, etc.
 Termination.
Computer Tasks in Computer-Assisted Part Programming
1. Input translation – converts the coded instructions in the part program into computer
usable form
2. Arithmetic and cutter offset computations – performs the mathematical computations to
define the part surface and generate the tool path, including cutter offset compensation
(CLFILE)
3. Editing – provides readable data on cutter locations and machine tool operating
commands (CLDATA)
4. Post processing – converts CLDATA into low-level code that can be interpreted by the
MCU
18
Page

SSET Department of Mechanical Engineering


Geometry statements
The points, lines, and surfaces must be defined in the program prior to specifying the motion
statements. The general form of an APT geometry statement is the following:
SYMBOL = GEOMETRY TYPE/descriptive data
A symbol can be any combination of six or fewer alphabetical and numerical characters,
at least one of which must be alphabetical.
Examples of part geometry definitions:
P4 = POINT/35, 90,0
L1 = LINE/P1, P2
C1 = CIRCLE/CENTER, P8, RADIUS, 30.0
Points: Specification of a point can be accomplished by the following:
 Designating its x-, y-, and z-coordinates;
P1 = POINT/15.0, 10.0, 25.0
 As the intersection of two intersecting lines;
P2 = POINT/INTOF, L1, L2
L1 and L2 are two previously defined lines.
Lines: A line in APT is considered to be of infinite length in both directions. Specification of a
line can be accomplished by the following:
 Two points through which it passes;
L1 = LINE/P3, P4
P3 and P4 are two previously defined points.
 Passes through point (P5) and parallel to another line (L3) that has been previously
defined;
L2 = LINE/P5, PARLEL, L3
Planes: In APT, a plane extends indefinitely. A plane can be defined by the following:
 Three points through which It passes;
PL1 = PLANE/P1, P2, P3
P1, P2 and P3 must be non-collinear.
 Passes through point (P2) and parallel to another plane (PL1) that has been previously
defined;
PL2 = PLANE/P2, PARLEL, PL1
Circles: In APT, a circle is considered to be a cylindrical surface that is perpendicular to the x-y
plane and extends to infinity in the z-direction. A circle can be defined by the following:
 Center and radius;
C1 = CIRCLE/CENTER, P1, RADIUS, 25.0
19

 Three points through which it passes;


Page

C2 = CIRCLE/P4, P5, P6
The three points must not be collinear.

SSET Department of Mechanical Engineering


MOTION COMMANDS
All APT motion statements follow a common format, just as geometry statements have their
own format. The general form of an APT motion command is:
MOTION COMMAND/descriptive data
At the beginning of the sequence of motion statements, the tool must be given a starting point.
This is likely to be the target point, the location where the operator has positioned the tool at
the start of the job. The part programmer keys into this starting position with the following
statement:
FROM/STARTPT
Where FROM is an APT vocabulary word indicating that this is the initial point from which all
others will be referenced; and STARTPT is the symbol assigned to the starting point. Another
way to make this statement is the following:
FROM/-20.0, -20.0, 0
The FROM statement occurs only at the start of the motion sequence.
Point-to-point motions
There are two commands; GOTO and GODLTA.
The GOTO statement instructs the tool to go to a particular point location specified in the
descriptive data.
GOTO/P2
GOTO/25.0, 40.0,0
The GODLTA command specifies an incremental move for the tool. To illustrate, the following
statement instruct the tool to move from its present position by a distance of 50 mm in x-
direction, 120 mm in y-direction, and 40 mm in z-direction;
GODLTA/50.0, 120.0, 40.0
The GODLTA statement is useful in drilling and related machining operations. The tool can be
directed to go to a given hole location; then the GODLTA command can be used to drill the
hole, as in the following sequence;
GOTO/P2
GODLTA/0, 0, -50.0
GODLTA/0, 0, 50.0
20
Page

SSET Department of Mechanical Engineering


Contouring motions
These are more complicated than PTP commands are because the tool’s position must be
continuously controlled throughout the move. The tool is directed along two intersecting
surfaces until it reaches a third surface.
1. Drive surface; the surface that guides the side of the cutter. It is pictured as a plane
2. Part surface; on which the bottom or nose of the tool is guided.
3. Check surface; the surface that stops the forward motion of the tool in the execution of the
current command. This surface “checks” the advance of the tool.

There are several ways in which the check surface can be used. Four APT modifier words in the
descriptive data of the motion statement words are TO, ON, PAST, and TANTO is used. As
depicted in Figure, the word TO positions the leading edge of the tool in contact with the check
surface; ON positions the center of the tool on the check surface; and PAST puts the tool beyond
the check surface, so that its trailing edge is in contact with the check surface. The fourth
modifier word TANTO is used when the drive surface is tangent to a circular check surface, as
in Figure, TANTO moves the cutting tool to the point of tangency with the circular surface.

After the tool reaches the check surface in the preceding move, does the next move involve a
right turn or left turn or what? The answer to this question is determined by one of the following
six motion words, whose interpretation are illustrated in figure below
GOLFT commands the tool to make a left turn relative to the last move
21

GORGT commands the tool to make a right turn relative to the last move
Page

GOFWD commands the tool to move forward relative to the last move
GOBACK commands the tool to move in reverse direction relative to last move

SSET Department of Mechanical Engineering


GOUP commands the tool to move upward relative to the last move
GODOWN commands the tool to move down relative to the last move

Note that GO/TO is not the same as the GOTO command. GOTO is used only for PTP motions.
The GO/ command is used to initialize a sequence of contouring motions and may take
alternative forms such as GO/ON, GO/TO, or GO/PAST.
In engineering drawing, the sides of the part appear as lines, although they are three-dimensional
surfaces on the physical part. In cases like this, it is more convenient for the programmer to
define the part profile in terms of lines and circles rather than planes and cylinders. APT
language system allows this because in APT, lines are treated as planes and circles are treated as
cylinders, which are both perpendicular to the x-y plane. Hence, the planes around the part
outline can be replaced by lines (L1, L3, and L4). The commands can be replaced by the
following;

FROM/PTARG
GO/TO, L1, TO, PL2, TO, L3
GORGT/L3, PAST, L4
Plane PL2 has not been converted to a line. As the “part surface” in the motion statement, it
22

must maintain its status as a plane parallel to the x- and y-axes. It is not necessary to redefine the
Page

part surface in every motion command after it has been initially defined as long as it remains the same
in subsequent commands;

SSET Department of Mechanical Engineering


Postprocessor statements
Postprocessor statements control the operation of the machine tool and play a supporting role in
generating the tool path. Such statements are used to define cutter size, specify speeds and
feeds, turn coolant flow on and off, and control other features of the m/c tool. The general form
of the postprocessor statement is:
Postprocessor command/descriptive data
In some commands, the descriptive data is omitted. Some examples of the postprocessor
statements are the following:
1. UNITS/MM indicates that the specified units in the program are INCHES or MM.
2. INTOL/0.02 specifies inward tolerance for circular interpolation
3. SPINDL/1000, CLW specifies spindle rotation speed in revolutions per minute. Either
CLW (clockwise) or CCLW (counter-clockwise) can be specified. (SPINDL/OFF)
4. CUTTER/20 defines cutter diameter for tool path offset calculation
5. DELAY/30 temporarily stops the machine tool for a period specified in seconds.
6. FEDRAT/40, IPM specifies feed rate in mm/min or in/min as specifies in UNITS
statements. (FEDRAT/4, IPR)
7. RAPID engage high feed rate for next moves.
8. COOLNT/FLOOD turns fluid one (COOLNT/MIST)
9. (COOLNT/OFF)
10. LOADTL/01 used with automatic tool changing.

Auxiliary statements
Auxiliary statements are used to identify the part program, specify which postprocessor to use,
insert remarks into the program, and so on. Auxiliary statements have no effect on the
generation of tool path.
 PARTNO is the first statement in an APT program, used to identify the program;
 REMARK is used to insert explanatory comments into the program that are not interpreted
or processed by the APT processor.
 FINI indicates the end of an APT program.

Rules for formulating APT geometry statements:


1. Coordinate data must be specified in the order x, then y, then z.
2. Any symbols used as descriptive data must have been previously defined.
3. A symbol can be used to define only one geometry element.
23

4. Only one symbol can be used to define any given element.


Page

SSET Department of Mechanical Engineering


Comparison and advantages of manual part programming and APT
Manual part programming is time-consuming, tedious, and subject to human errors for complex
jobs. Machining instructions are written in English-like statements that are translated by the
computer into the low-level machine code of the MCU. It is used for more complex jobs.

S.no NC Machine CNC Machine


Here NC stands for Numerical CNC stands for Computer
1.
Control Numerical Control.
It is defined as the machine It is defined as the machine which
which is controlled by the set of is used to control the motions of
instructions in the form of the work piece and tool with the
2.
numbers, letters and symbols. help of prepared program in
The set of computer. The program is written
instructions is called as program. in alphanumeric data.
In CNC machine the programs
In NC machine the programs are are fed directly into the computer
3.
fed into the punch cards. by a small key board similar to
our traditional keyboard.
Modification in the program is Modification in the program is
4.
difficult. very easy.
High skilled operator is
5. Less skilled operator is required.
required.
6. Cost of the machine is less. Cost of the CNC machine is high.
7. Maintenance cost is less Maintenance cost is high.
In CNC machines, the programs
The programs in the NC can be stored in the computer and
8.
machine cannot be stored. can
be used again and again.
It offers less flexibility and It offers additional flexibility and
9.
computational capability. computational capability.
The accuracy is less as
10. It has high accuracy.
compared with the CNC.
It requires more time for the It takes very less time in the
11.
execution of the job. execution of the job.
It is not possible to run it It can be run continuously for 24
12.
continuously. hours of a day.
24
Page

SSET Department of Mechanical Engineering


Economic of NC
1. Reduced nonproduction time: - It accomplishes this decrease in non-productive time by
means of fewer setups, less setup time, reduced work piece handling time, automatic tool
changes on some machines, and so on.
2. Reduced fixturing: - NC requires simpler fixtures because the positioning is done by the
NC program rather than the fixture or jig.
3. Reduced lead time: - Jobs can be set up more quickly with NC.
4. Greater manufacturing flexibility: - NC adapts better to changes in jobs, production
schedules, and so on.
5. Easier to accommodate engineering design changes on the work piece: -
6. Improved accuracy and reduced human error; - NC is ideal for complicated parts where
the chances of human mistakes are high.

Disadvantages
1. Machine cost
2. Programming training
3. Higher maintenance cost
4. Higher skilled workers

Where is CNC most appropriate?


1. Parts are processed frequently and in small to medium lot sizes.
2. Part geometry is complex.
3. Close tolerances must be held on the work part.
4. Many operations must be performed on the part in its processing.
5. Much metal needs to be removed (for machining applications).
6. Engineering design changes are likely.
7. It is an expensive part where mistakes in processing would be costly.
8. Parts require 100% inspection

25
Page

SSET Department of Mechanical Engineering


Interpolation/Interpolator
The most critical and specialized activity in a CNC is axis management, which involves
interpolation, servo control and drive of the motion axes. In a numerical control (NC), an
interpolator is used to co-ordinate the simultaneous movements of the respective axes of a
machine tool such that the relative motion between the tool and work piece follows a specified
path at a given velocity. The interpolator divides the overall movements into individual
displacement along the X and Y axis on the pre-defined feed rate. The locus of the tool is created
through combing the individual displacement for each axis. For paths other than 450 inclined to
axes, driving motors must move at different speeds to attain this.
An interpolator provides two functions
 It computes individual axis velocities to drive the tool along the programmed path at the
given feed rate
 It generates intermediate coordinate positions along the programmed path
The interpolator sends electric pulse signals to individual axis servo controllers. Each pulse
is capable of moving the machine through 1 BLU each and separate pulse for each axis is
provided.
Example
When we want to move the tool at 450 to X and Y axes, points along the path can be
obtained by moving the tool equal distances Δx and Δy along the X and Y directions. When
the distance moved Δx and Δy are made very small, the points along the path will become
much closer and nearly a continuous path is generated along 450 directions. The magnitude
and speed of movement (travel rate or feed) are the parameters to be controlled.
In this example, both Δx and Δy have same value. In the case of paths having different
inclination and curved paths, varying values of coordinates (Δx and Δy) are used.

In numerical control (NC), an interpolator is used to co-ordinate the simultaneous movements of the
respective axes of a machine tool such that the relative motion between the tool and work piece
follows a specified path at a given constant tangential velocity.

Controlling the travel rate in two or more directions, which is proportionate to the distance
26

moved is called interpolation.


Page

If Vf is the desired velocity of tool along the line of motion,

SSET Department of Mechanical Engineering


The velocity along two axes Vx and Vy
∆𝑥
𝑉𝑥 = 𝑉𝑓
√∆𝑥 2 + ∆𝑦 2
∆𝑦
𝑉𝑦 = 𝑉𝑓 𝑤ℎ𝑒𝑟𝑒 ∆𝑥 𝑎𝑛𝑑 ∆𝑦 𝑎𝑟𝑒 𝑑𝑖𝑠𝑝𝑙𝑎𝑐𝑒𝑚𝑒𝑛𝑡 𝑎𝑙𝑜𝑛𝑔 𝑋 𝑎𝑛𝑑 𝑌 𝑎𝑥𝑒𝑠.
√∆𝑥 2 + ∆𝑦 2

DDA
Digital Differential Analyser (DDA) is the simple line generation algorithm. The DDA
generates lines and curves from their differential equations. The DDA is a very popular
interpolator for NC systems. The DDA is basically a digital integrator.
DDA integrator principle
If the area under a graph is divided into very narrow strips, each strip is approximately rectangular
in shape. To perform digital integration of a continuous function, the area below the curve is
approximated by a sum of small rectangular areas.
𝑡 𝑘

∫ 𝑉𝑑𝑡 ≅ ∑ 𝑉𝑖 ∆𝑡 𝑤ℎ𝑒𝑟𝑒 ∆𝑡 𝑠𝑡𝑎𝑛𝑑𝑠 𝑓𝑜𝑟 𝑎𝑛 𝑖𝑡𝑒𝑟𝑎𝑡𝑖𝑜𝑛 𝑡𝑖𝑚𝑒


0 𝑖=0

In the diagram, a "typical rectangle" is shown with width Δt and height V. Its area is VΔt. If
we add all these typical rectangles, starting from t0 and finishing at t, the area is
approximately
Area under the Velocity –time curve gives the distance travelled (S).
𝑡 𝑘

𝑆(𝑡) = ∫ 𝑉𝑑𝑡 ≅ ∑ 𝑉𝑖 ∆𝑡 𝑤ℎ𝑒𝑟𝑒 ∆𝑡 𝑠𝑡𝑎𝑛𝑑𝑠 𝑓𝑜𝑟 𝑎𝑛 𝑖𝑡𝑒𝑟𝑎𝑡𝑖𝑜𝑛 𝑡𝑖𝑚𝑒


0 𝑖=0
The instantaneous values (distance) of the quantities are formed by summing the increments
throughout the whole time.
27
Page

SSET Department of Mechanical Engineering


So the distance travelled kth interval of time which is kΔt is represented as (Sk)
𝑘−1

𝑆𝑘 = ∑ 𝑉𝑖 ∆𝑡 + 𝑉𝑘 ∆𝑡
𝑖=0
Where
𝑆𝑘 = 𝑆𝑘−1 + ∆𝑆𝑘 -- total displacement by summing the displacement at the previous
time unit and the distance increment at the current time unit using equation
∆𝑆𝑘 = 𝑉𝑘 . ∆𝑡 − − − −distance increment at the current time

The value of Vk can in turn be modified by incrementing or decrementing it by ∆V, which is


either 1 or 0.
The DDA can generate pulses at intervals of duration Δt. Each time a pulse (frequency f) is
received, the value in the register is added to the accumulator. When the accumulator
overflows, the overflow bit is output to the motor control counter.
The, three main components of a DDA which are (I) an integrand register, (2) an adder, and (3) a
remainder register

28
Page

SSET Department of Mechanical Engineering


Types of interpolation
1. Straight line motion (also called linear interpolation)
2. Circular motion (also called circular interpolation)
Linear Interpolation
The computer produces a sequence of reference pulses for each axis of motion,
each pulse generating a motion of one BLU. The accumulated number
of pulses represents position, and the pulse frequency is proportional to the axis velocity.

2 axis movement
The interpolator has to provide pulses to each axis at definite rates (a and b pulses per second,
along X and y axes respectively) with respect to time.

The micro-increments of the moving point along X axis and Y axis in Δt are
∆𝑥 = 𝑉𝑥 ∆𝑡
∆𝑦 = 𝑉𝑦 ∆𝑡

The principle of DDA is that X and Y co-ordinates are simultaneously incremented in small
steps proportional to the first derivatives of x and y. The first derivative is the rate of change
of y with x, that is, dy/dx, which is interpreted as the slope and for straight line, it is a
constant. For generating a line, X and Y is incremented by Δx and Δy.
One pulse increments the integrand register contents representing one y increment unit (Δy).
One command pulse to the adder represents one x increment (Δx) and causes the addition of
the current integrand, y, to the remainder. Continual, addition to the remainder causes it to
overflow its register, periodically, at a rate determined by the rate of Δx inputs and by the
magnitude of the integrand y. Over a specific time period, the sum of the overflows
approaches the rectangular approximation, Simpson's rule, of the integrals of y and x with
respect to time.
29
Page

SSET Department of Mechanical Engineering


Circular Interpolation
The advantage of circular interpolation is its ability to generate an arc in a single program
block. The information required for programming a circular interpolation includes:
1. coordinates of the start point and end point,
2. radius of the arc or coordinates of the arc centre
3. direction in which the tool is to proceed (CW or CCW).
An arc AB in a plane XOY in the first quadrant, the radius of arc is R, the tangential velocity
at the moving point is v, and the coordinates of the moving point P is (x, y) is required.

The velocity components Vx and Vy are computed by the circular interpolator and are
supplied as reference inputs to the computer closed loops. Tool path is traced by controlling
and coordinating the axis motors.

Pulse count and BLU


The computer produces a sequence of reference pulses for each axis of motion, each pulse
generating a motion of one BLU

𝐷𝑖𝑠𝑡𝑎𝑛𝑐𝑒
pulse count= 𝐵𝐿𝑈
If the BLU=0.001, for moving the table 5 mm with a feed of 6mm per minute
5
Pulse count=0.001 = 5000 𝑝𝑢𝑙𝑠𝑒𝑠
The accumulated number of pulses represents position,
The pulse frequency is proportional to the axis velocity
30

6/60
𝑝𝑢𝑙𝑠𝑒 𝑟𝑎𝑡𝑒 = = 100 𝑝𝑢𝑙𝑠𝑒/𝑠𝑒𝑠
Page

0.001

SSET Department of Mechanical Engineering


Manual Part program exercises
Turning NC programme
Example 1
Facing and turning operation on CNC lathe

% (Start tag)
:1002; (Program Number)
N10 G90G95G21; (G90-absolute programming, G95 - feed per rev,
G21-metric mode)
N20M06T01; (M06 - tool change, T01 - tool number one)
N30M03S800; (M30 - Spindle ON, clockwise rotation, S800 -spindle
speed is set to 800 rpm)
N40M08; (M08 - Coolant ON)
N50 G00X12.5Z2; (G00 - Rapid motion)
N60 G01 Z0F0.1; Linear interpolation, feed is .01mm/rev
N70 G01 X0F0.1; (Facing operation is performed)
N80 G00Z2; (Tool moves 2 mm away in Z direction)
N90 G00 X7.5;
N100 G01Z-25 F0.1; (Turning operation is performed)
N110 G01 X12.5;
N120 G01 Z-25
N130M05; (Spindle OFF)
N140M09; (Coolant off)
31

N150M30; (Program end and tape rewind)


Page

SSET Department of Mechanical Engineering


Example 2
Program for taper turning operation on NC Lathe
% (Start tag)
:1004; (Program number)
N10 G90G95G21; (G90 absolute programming, G95 feed/rev, G21 metric
mode)
N20M03S1000; (Spindle ON with 1000RPM)
N30M08 ; (Coolant ON)
N50 G00 X0 Z1 (G00 – rapid movement)
N60 G01 X12.5 Z0 F0.1 Facing
N70 G01 Z-50 (Turning with 0.1 mm/rev)
N80G00X7.5 Z0; (Rapid)
N90 G01 X12.5 Z-15; Taper turning
N100M05; (Spindle OFF)
N110M09; (Coolant OFF)
N120M30; (Program end and tape rewind)

Example 3
N20 G01 Z-100; (turning 25 mm dia)
N60 G00 X-4Z01; (Position of cut)
N65 G01 Z-60; (Cutting length)
N70 G01 X-12.5; (cut)
N85 G00 X5 Z5; (Final position of tool)

% 1000; (Main programme) N90 M02; (End of programme)

N01 G54 G90 G71 G94 M03 S800;


N02 G00 X00Z01
32

N05 G01 X-12.5 Z0 F2; (Facing the job)


Page

SSET Department of Mechanical Engineering


Example 4
N15 G00 X10; (Tool clearance from the
centre)
N20 G01 Z-36; (Turning operation)
N25 G01 X5 –Z30; (Taper turning
operation)
N30 G00 X1 Z66; (Final position of
tool)
% 2000; (Main programme)
N35 M02; (End of programme)
N01 G54 G91 G71 G94 M03 S800;
N05 G01 X-15 Z0 F2; (Facing the job)
N10 G00 Z1; (Tool clearance)

Example 5
N05 G94 M06 T0101
N10 G00 X0 Z0 M04 S360
N15 G01 X30 F30
N20 G03 X50 Z-10 R10
N25 G01 Z-40
N30 G02 X70 Z-50 R10
N35 G01 Z-100
N40 G00 X100
N45 G00 Z10
N50 M05
N55 M30

Example 6

N05 G94 M06 T0101


N10 G00 X0 Z0 M04
S600
N15 G01 X50 F30
N20 G01 Z-40
N25 G01 X80
N30 G01 Z-60
N35 G01 X100
N40 G01 Z-100
N45 G00 X120
N50 G00 Z10
33

N55 M05
N60 M30
Page

SSET Department of Mechanical Engineering


\Example 7
%0001
N5 M12
N10 T0101
N15 G0 X100 Z50
N20 M3 S600
N25 M8
N30 G1 X50 Z0 F600
N40 Z-30 F200
N50 X80 Z-20 F150
N60 G0 X100 Z50
N70 T0100
N80 M5
N90 M9
N100 M30
N110 %

Example 8

N0 G90 F0.5 S1200 T0101 M03


N10 G00 X35 Z2
N20 G01 X20 Z0
N30 G01 X20 Z-15
N40 G02 X25 Z-25 R15
N50 G01 X25 Z-40
N60 G03 X30 Z-50 R15
N70 G01 X30 Z-70
N80 M05 M30
34
Page

SSET Department of Mechanical Engineering


Example 9
Program for contouring operation on
CNC Lathe Machine

% (Start tag)
:1004; (Program number)
N10 G90G95G21; (G90 absolute programming, G95 feed /rev, G21 metric
mode)
N20M06T01; (Tool change to tool no1)
N30M03S600; (Spindle ON with 600RPM)
N40M08; (Coolant ON)

N50 G00X0 Z5; (Tool will reach point1)


N60 G01Z0F0.1; (Tool will reach point2)
N70 G03 X10Z-10 R-10; (G03circular interpolation counter clockwise, Tool will
reach point 3)
N80 G02 X19.15Z-20 R-10; (G02 circular interpolation clockwise, Tool will reach point 4)
N90G00X22.5; (Tool will reach point5)
N100 G28X0 Z0; (G28 Go to home position, Tool will reach point6)
N110M05; (Spindle OFF)
N120M09; (Coolant OFF)
N130M30; (Program end and tape rewind)
35
Page

SSET Department of Mechanical Engineering


Drilling operation
Example 10

N1 T1 M06
N2 G90 G00 X.3 Y1.2
N3 S1200 M03
N4 Z1. M08
N5 G81 Z-.6 F10
N6 X1.2 Y.3
N7 G80 G00 Z1. M09
N8 G28 G91 Z0. M05
N9 M30

 N1- Tool change to tool no.1


 N2- Tool rapidly moves to first drilling position X0.3 Y1.2 while taking into
account Zero-offset-no. 1
 N3- Drill starts rotating clockwise with 1200 rpm.
 N4- Drill takes depth Z1. coolant is turned on.
 N5- Drilling cycle parameters, drill depth and cutting feed are given, with this
command first drill is made at current position (X0.3 Y1.2).
 N6- As drilling cycle continues it’s work with every axis movement so next drill is
done at X1.2 Y0.3
 N7- Drilling cycle is cancelled with G80 command, Coolant is turned off.
 N8- As operation for this component is finished, so cutting tool is taken to
reference position, and cutter rotation is stopped.
 N9- CNC part-program is ended.
Example 11
Drilling operation using a CNC machine --- uses Absolute programming (G90)

36
Page

Here all the dimensions are specified with respect to the origin point.

SSET Department of Mechanical Engineering


% (Start tag)
:1007; (Program number)
N10M06T01; (Tool is changed to T01)
N20 G90G95G21; (G90 absolute programming, G95 feed/rev, G21metric
mode)
N30G00Z2; (Tool is given a clearance of 2 mm above work piece)
N40X10Y10; (Tool is brought to position no1)
N50M03S500; (Spindle ON in clockwise direction with speed 500RPM)
N60M08; (Coolant ON)
N70G01Z-12; Straight cutting motion. Tool penetrates the other side.)
N80G00Z2; (The drill bit is retracted in rapid mode)
N90X40; (Tool reaches position no 2 in rapid mode)
N100G01Z-12; (Hole is drilled at position2)
N110G00Z2; (Drill bit is retracted to clearance plane)
N120Y40; (Tool reaches position no 3 in rapid mode)
N130G01Z-12; (Hole is drilled at position3)
N140G00Z2; (Drill bit is retracted to clearance plane)
N150X10; (Tool reaches position no 4 in rapid mode)
N160G01Z-12; (Hole is drilled at position4)
N170G00Z2; (Drill bit is retracted to clearance plane)
N180M05M08; (M05 - Spindle Stop, M08 – Coolant OFF)
N190M30; (End of program and tape rewind)

Incremental programming (G91)


The same machining example is now written using Incremental Programming.
% (Start tag)
:1007; (Program number)
N10M06T01; (Tool is changed to T01)
N20G91G95G21; (G91 incremental programming, G95 feed/rev,G21 Metric mode)
N30G00Z2; (Tool is given a clearance of 2 mm above work )
N40X10Y10; (Tool is brought to position no1)
N50M03S500; (Spindle ON in clockwise direction with 500RPM)
N60M08; (Coolant ON)
N70G01Z-14; (Straight cutting motion. The tool penetrates other side)
N80G00Z14; (The drill bit is retracted to the clearance plane in rapid )
N90 X30; (Tool reaches position no 2 in rapid mode)
N100G01Z-14; (Hole is drilled at position2)
N110G00Z14; (Drill bit is retracted to clearance plane)
N120Y30; (Tool reaches position no 3 in rapid mode)
N130G01Z-14; (Hole is drilled at position3)
N140G00Z14; (Drill bit is retracted to clearance plane)
N150 X-30; (Tool reaches position no 4 in rapid mode)
N160G01Z-14; (Hole is drilled at position4)
37

N170G00Z14; (Drill bit is retracted to clearance plane)


N180M05M08; (M05 - Spindle Stop, M08 - Coolant OFF)
Page

N190M30; (End of program and tape rewind)

SSET Department of Mechanical Engineering


Example 12
Drilling example using Canned Cycle

% (Start tag)
:1004; (Program number)
N10M06T01; (Tool is changed to T01)
N20 G90G95G21; (G90 absolute programming, G95 feed/rev, G21metric)
N30 G00 X50Y100Z50; (Tool is positioned above point 1 in rapid mode)
N40Z10; (Tool is brought to 10 mm above the work , still in position1)
N50M03S500; (Spindle ON in clockwise direction speed 500RPM)
N60M08; (Coolant ON)
N70 G99 G81 Z-20R2.5F50; (G81-Canned drilling cycle code, Z-20 drilling depth,
R2.5 this is the point 2.5mm above the Hole no:1.
This is the point where the tool will come after performing
the drilling operation. G99 denotes that the drilling tool
will return back to the r-level after drilling the hole)
(As the drilling cycle is in progress only give the
of the other six holes to be drilled. Depth, feed and R
have already been mentioned in the previous block N70)
N80X100; (Drilling of hole number 2performed)
N90X150; (Drilling of hole number 3performed)
N100Y50; (Drilling of hole number 4performed)
N110X100; (Drilling of hole number 5performed)
N120X50; (Drilling of hole number 6performed)
N130G80M05; (G80-Stop canned cycle, M05 Spindle OFF)
N140M09; (Coolant OFF)
N150M30; (End of program and tape rewind)
38
Page

SSET Department of Mechanical Engineering


Milling cutter (X,Y and Z axis is present)
Example 13

% 100; (Main programme)


N5 G17 G71 G90 G94 G54; (Parameters Setting)
N10 T2 L90; (Home position)
N15 G00 Z50 M3 S700 X10 Y-25; (Position of tool)
N20 G01 Z-1.5; (Position of cut)
N25 G01 X30 F100 M8; (Cutting slot)
N30 G00 Z100 M9; (Final position of tool)
N35 M30; (Main programme end)

Example:14
The tool path of the figure shown on left side, can be programmed as follows (In absolute
mode, G90):

G01 X100 Y40 F125;


G03 X80 Y60 I-20;
G01 X60;
G02 X40 Y40 I-20;
39
Page

SSET Department of Mechanical Engineering


Example 15
The following part program for a finishing pass shows the recommended method for start-
up and cancellation of cutter compensation:

N0010 G00 X-15 Y-15;


N0020 G41 X0 Y0 F100;
N0030 Y40;
N0040 X30 Y80;
N0050 X60;
N0060 G02 X100 Y40 R40;
N0070 G01 Y30;
N0080 G03 X70 Y0 R30;
N0090 X0;
N0100 X-15 Y-15; (Cancellation Move)

Example 16

%1000
T1 M6
G00 G90 G40 G94 G80
G54 X-75 Y-25 S500 M3 (Start Point)
G43 Z05
G1 Z-20 F100
G1X-50 Y0 M8 (Position 1)
G1X0 Y50 (Position 2)
G1X50 Y0 (Position 3)
G1X0 Y-50 (Position 4)
G1X-50 Y0 (Position 5)
40

G1Y25 X-75 (Position 6)


Page

G0 Z05
M30

SSET Department of Mechanical Engineering


Example 17
A square 2.0 in. x 2.0 in. is to be milled using a 1/2 in. end milling cutter. Write an NC
part program to make the square.
Solution
Let us set up the lower left corner of the square at (6.0,6.0). Using tool-radius
compensation, the square can be produced.

2.000

2.000

(6,6)

Example 18

N05 G00 X10 Y25 Z1 S1250 M3


N10 G01 Z-5 F100
N15 G02 X10 Y25 I20 J0 F125
N20 G00 Z100 M5
N25 X-20
N30 M30
41
Page

SSET Department of Mechanical Engineering


Example 19
Cutter diameter data has been manually entered into offset register 05. At the beginning of
the job, the cutter will be positioned so that its center tip is at a target point located at
x = O. Y = 50, and t; =+10. The program begins with the tool positioned at this location.

Example 20
G90 G03 X140 Y100 I-60 F300
G02 X120 Y60 I-50

G92 X200 Y40 Z0


G90 G03 X140 Y100 R60 F300
42

G02 X120 Y60 R50


Page

Mill Circular Interpolation G02 G03


with I
G92 X200 Y40 Z0

SSET Department of Mechanical Engineering


Drilling code using canned cycle

N0040 M06T01; Tool change


N0050 G90 G00 X10 Y30 Z12 S1000M03; Tool position to initial level
N0060 G99 G81 X10 Y30 Z-17 R2F75; Hole 1 retract R point
N0070Y10; Hole 2 retract R point
N0080X30; Hole 3 retract R point
N0090 G98Y30; Hole 4 retract initial level
N0100 G99X90; Hole 5 retract R point
N0110 Y10; Hole 6 retract R point
N0120X110; Hole 7 retract R point
N0130 G98Y30; Hole 8 retract initial level
N0140 G91 G80 G28 X0 Y0 Z0M05; Home position spindle stop
N0150 M06T02; Tool change
N0160 G90 G00 X60 Y28 Z12 S750M03; Tool position initial level
N0170 G99 G83 X60 Y28 Z-17 Q6 R2F60; Hole 9 retract R point.
N0180 G98Y12; Hole 10 retract initial level
N0190 G91 G80 G28 X0 Y0 Z0M05; Home position spindle stop
N0200M30
; Program stop
43
Page

SSET Department of Mechanical Engineering


Example 21

G21 G94 G91


G28 Z0
G28 X0 Y0
M06 T06
M03 S1300
G90 G00 X0 Y0 Z5
G90 G01 X0 Y0
X30
G03 X54 R12
G01 X79
G02 X105 R13
G01 X120
X80 Y45
X40 Y75
G03 X35 Y80 R5
G01 X20
G03 X0 Y80 R10
G01 Y0
M30

******************************************
44
Page

SSET Department of Mechanical Engineering


Variable Description
A Absolute or incremental position of A axis (rotational axis around X axis)
B Absolute or incremental position of B axis (rotational axis around Y axis)
C Absolute or incremental position of C axis (rotational axis around Z axis)
D Defines diameter or radial offset used for cutter compensation. D is used for
depth of cut on lathes.
E Precision feed rate for threading on lathes
F Defines feed rate
G Address for preparatory commands
H Defines tool length offset; Incremental axis corresponding to C axis
I Defines arc center in X axis for G02 or G03 arc commands.
Also used as a parameter within some fixed cycles.
J Defines arc center in Y axis for G02 or G03 arc commands.
Also used as a parameter within some fixed cycles.
K Defines arc center in Z axis for G02 or G03 arc commands.
Also used as a parameter within some fixed cycles, equal to L address.
L Fixed cycle loop count; Specification of what register to edit using G10
M Miscellaneous function
N Line (block) number in program;
O Program name
P Serves as parameter address for various G and M codes
Q Peck increment in canned cycles
R Defines size of arc radius, or defines retract height in milling canned cycles
S Defines speed, either spindle speed or surface speed depending on mode
T Tool selection
U Incremental axis corresponding to X axis (typically only lathe group A
controls)
Also defines dwell time on some machines (instead of "P" or "X").
V Incremental axis corresponding to Y axis
W Incremental axis corresponding to Z axis (typically only lathe group A
controls)
X Absolute or incremental position of X axis.
Also defines dwell time on some machines (instead of "P" or "U").
Y Absolute or incremental position of Y axis
45

Z Absolute or incremental position of Z axis


Page

SSET Department of Mechanical Engineering


APT Program exercises

EXAMPLE 1 – DRILLING HOLES

PARTNO DRILLING OPERATION labels the program as drilling operation


MACHIN/DRILL,01 Machine Drill no:1 is selected
UNITS/MM The units is set to millimeters
REMARK Geometry Definition
STARTPT=POINT/0, -50, 10
P1=POINT/70, 30,10 Defining the points, lines and curves
P2=POINT/120,30,10
P3=POINT/70,60,10
REMARK Drill bit motion statements
FROM STARTPT Defines the starting point of the tool
RAPID Rapid movement is selected
GOTO/P1 Tool moves and reaches pointP1
SPINDL/1000, CLW Spindle set to 1000rpm in clockwise dir
FEDRAT/.05, IPR Feed rate is set to .05 inches/rev
GODLTA/0,0, -25 Hole is drilled at positionP1
GODLTA/0,0,25 After drilling the drill is retracted
RAPID
GOTO/P2 SPINDL/1000, CLW
FEDRAT/.05, IPR Hole is drilled at location P2
GODLTA/0,0, -25
GODLTA/0,0,25 RAPID GOTO/P3
SPINDL/1000, CLW
FEDRAT/.05, IPR Hole is drilled at location P3
GODLTA/0,0, -25
GODLTA/0,0,25 RAPID
GOTO/STARTPT Drill is taken back to the starting point
SPINDL/OFF Spindle is turned off
46

FINI End of Program


Page

SSET Department of Mechanical Engineering


EXAMPLE 2 – MILLING OPERATION

PARTNO MILLING OPERATION Labels the program as milling operation


MACHIN/MILLING, 02 Milling machine no: 2 is selected
UNITS/MM Units is set to millimeters
CUTTER/20.0 Cutter diameter is defining as 20mm
REMARK Part geometry, Points and Lines are defined 25 mm below part top
surface.
STARTPT = POINT/0, -50.0, 10.0
P1 = POINT/0, 0, -25.0
P2 = POINT/160.0, 0, -25.0
P3 = POINT/160.0, 60.0, -25.0
P4 = POINT/35.0, 90.0, -25.0
P8 = POINT/130.0,60.0, -25.0 The geometry points, lines, circles are
Defined L1 = LINE/P1, P2
L2 = LINE/P2, P3
C1 = CIRCLE/CENTER, P8, RADIUS, 30.0
L3 = LINE/P4, LEFT, TANTO, C1 tangent to left side of circle as seen from P4
L4 = LINE/P4, P1
PL1 = PLANE/P1, P2, P4 Plane defined to denote depth of cut
REMARK Milling cutter motion statements.
FROM/STARTPT Defines the initial position of the tool
SPINDL/1000, CLW Spindle speed set 1000rpm clockwise dir
FEEDRAT/50, IPM Feed rate set to 50 inches per minute
GO/TO, L1, TO, PL1, ON, L4 PL1 determines the depth of cut
GORGT/L1, PAST, L2 Tool moves along L1 till it crossesL2
GOLFT/L2, TANTO, C1 Tool moves till it becomes tangent to circle C1
GOFWD/C1, PAST, L3 Tool moves along C1 till it crossesL3
GOFWD/L3, PAST, L4 Tool moves along L3 till it crossesL4
GOLFT/L4, PAST, L1 Tool moves along L4 till it crossesL1
RAPID Tool is set to rapid mode
47

GOTO/STARTPT Tool is taken back to starting point


Page

SPINDL/OFF Spindle is turned off


FINI End of program

SSET Department of Mechanical Engineering


EXAMPLE 3 - MILLING OPERATION

STARTPT
PARTNOSAMPLEMILLING Labels the program as milling operation
MACNIN/MILL,01 Milling machine no:1 is selected
UNITS/MM Units is set to millimeters
REMARK Geometry Definition
STARTPT=POINT/-1, -1, 0
P1=POINT/6, 1.125,0
P2=POINT/0, 0, 0
P3=POINT/6, 0, 0
P4=POINT/1.75,4.5,0
L1=LINE/P2, P3 Geometry: - points, lines and circles
defined C1=CIRCLE/CENTER, P1, RADIUS, 1.25
L2=LINE/P4, LEFT, TANTO, C1
L3=LINE/P2, P4
PL1=PLANE/P2, P3, P4 Plane define to denote part surface (cut
depth) REMARK Motion Statements
SPINDL/600, CLW Spindle turned on to 600rpm clockwise
direction
FEDRAT/6 feed rate set to 6 inches per minute
COOLNT/ON coolant is turned on
FROM/STARTPT Tool is called from its starting location
GO/TO, L1, TO, PL1, TO, L3 Initializing contouring motion
GORGT/L1, TANTO, C1 Tool moves along L1 till tangent to C1
GOFWD/C1, PAST, L2 Tool moves along C1 till goes past L2
GOFWD/L2, PAST, L3 Tool moves along L2 till it crosses L3
GOLFT/L3, PAST, L1 Tool moves along L3 till it crosses L1
RAPID Tool is set to rapid mode
GOTO/STARTPT Tool is taken back to starting location
COOLNT/OFF Coolant is turned off
48

SPINDL/OFF Spindle is turned off


Page

FINI End of program

SSET Department of Mechanical Engineering


EXAMPLE 4 – MILLING OPERATION

PARTNO SIMPLE MILLING


MACHIN/CNC1
UNITS/MM
REMARK/ Defining Geometry
STARTPT=POINT/0, 0, -20
P1=POINT/50, 50, -20
P2=POINT/100, 50, -20
P3=POINT/100, 100, -20
P4=POINT/50, 150, -20
L1=LINE/P1, P2
C1=CIRCLE/P3, RADIUS, 50
L2=LINE/P4, LEFT, TANTO, C1
L3=LINE/P1, P4
PL1=PLANE/P1, P2, P3
REMARK Defining Motion Statements
CUTTER/10
SPINDL/350
FEDRAT/30
COOLANT/ON
FROM/STARTPT
GO/TO L1, TO, PL1, TO, L3
GORGT/L1, TANTO, C1
GOFWD/C1, TANTO, L2
GOFWD/L2, PAST, L3
GOLFT/L3, PAST, L1
GOTO/STARTPT
COOLNT/OFF
FINI
49
Page

SSET Department of Mechanical Engineering


EXAMPLE 5

50
Page

SSET Department of Mechanical Engineering


UNIVERSITY QUESTIONS
1. Describe briefly the coordinate system used in Numerical Control. (10marks)
2. Explain briefly the tape format available in punched tape. (10 marks)
3. Explain the step involved in manual part programming. (10 marks)
4. Write notes of five important M Codes G codes used in part programming.
5. Discuss the format of a NC statement.
6. Describe about preparatory function. Give at least five examples? (5marks)
7. Explain the different types of tape formats in N.C. systems (10marks)
8. Discuss the most common types of tape coding systems used in the NC industry.
9. What is computer aided part programming? Explain the various steps involved.
10. What are the functions of CNC? Explain briefly.
11. Explain briefly the APT language.
12. Distinguish between manual part programming and computer aided part
programming.
13. Describe the construction and working of machining centre.
14. Discuss the advantages of Computer assisted Part Programming.
15. Discuss different types of offline programming software for CNC machine.
16. Discuss the features and characteristics of different types of tool holding devices
in a CNC machine
17. Discuss different types of commands in an APT language.
18. Discuss the features and characteristics of different types of tools used in CNC
machining.
19. Explain CNC system with neat figure? (10marks)
20. Describe about POINT, LINE, and PLANE geometric expression in APT? (5
marks)
21. What are the different geometry commands used in computer aided part
programme?
22. Explain the working of post process technology? (5marks)

51
Page

SSET Department of Mechanical Engineering


Problems
1. Write an NC programme to generate following profile in a CNC milling machine.

2. Write a programme to generate the following profile from a billet of length=110 mm


and diameter= 22 mm, in a CNC lathe.

3. The outline of the part in the figure is to be profile milled using a 20 mm dia end mill
with two teeth. Cutting speed is 125 m/min and feed is 0.1 mm/tooth. The part is 10
mm thick. Use the lower left corner of the part as the origin in the X-Y axis system.
The two holes in the part have already been drilled and will be used for clamping the
part during milling.
4. Write the manual part program in the word address format. Use absolute
positioning.

5. Write an APT program for profile milling of a part shown in Question 4. (20 marks)
6. Three holes of diameter10mm.each are to be drilled on a mild steel plate of length
200 mm., breadth 120mm. Use the lower left corner of the part as the origin in the
XY system. The co-ordinate positions of the holes with respect to the origin are
(40,25),(100,60) and (160,25) respectively. The cutting speed is 50 m./min. and feed
0.06 mm./rev. Write a manual part program to drill the holes in the word address
52

format. Use absolute positioning. (20 marks)


Page

7. Write an APT part program to perform drilling of three holes on a mild steel plate.
Use the part geometry and machining data given in question 11. (20marks)

SSET Department of Mechanical Engineering


8. Write a manual part program in word address format to machine the component
shown in figure form a rod of 20mm diameter .Assume the suitable machinery
parameter. The work material is MS (10 marks)

9. Write a manual part for the job given in above figure.


10. Write a part program a taper in a billet of 30 mm dia and 40 mm length. The taper
must start from the free end facing acting that end and must have the highest
diameter of 28mm at the free end. Smallest diameter 23mm is at a distance of
28mm and the same diameter should continue for another 8mm. The work material
is mild steel? (5+5=10marks)

*********************************************

53
Page

SSET Department of Mechanical Engineering


Absolute or incremental position of A axis (rotational axis around X axis)
A
B Absolute or incremental position of B axis (rotational axis around Y axis)
C Absolute or incremental position of C axis (rotational axis around Z axis)
D Defines diameter or radial offset used for cutter compensation. D is used
for depth of cut on lathes. It is used for aperture selection and commands
on photo plotters.
E Precision feed rate for threading on lathes
F Defines feed rate
G Address for preparatory commands
H Defines tool length offset;
Incremental axis corresponding to C axis (e.g., on a turn-mill)
I Defines arc center in X axis for G02 or G03 arc commands.
Also used as a parameter within some fixed cycles.
J Defines arc center in Y axis for G02 or G03 arc commands.
Also used as a parameter within some fixed cycles.
K Defines arc center in Z axis for G02 or G03 arc commands.
Also used as a parameter within some fixed cycles, equal to L address.
L Fixed cycle loop count;
Specification of what register to edit using G10
M Miscellaneous function
N Line (block) number in program;
O Program name
P Serves as parameter address for various G and M codes
Q Peck increment in canned cycles
R Defines size of arc radius, or defines retract height in canned cycles
S Defines speed, either spindle speed or surface speed depending on mode
T Tool selection
U Incremental axis corresponding to X axis Also defines dwell time on some
machines (instead of "P" or "X").
V Incremental axis corresponding to Y axis
W Incremental axis corresponding to Z axis
X Absolute or incremental position of X axis.
54

Also defines dwell time on some machines (instead of "P" or "U").


Y Absolute or incremental position of Y axis
Page

Z Absolute or incremental position of Z axis

SSET Department of Mechanical Engineering


55
Page

SSET Department of Mechanical Engineering

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy