You are on page 1of 36

PART PROGRAMMING FOR CNC MACHINES

Numerical control codes — standards — Manual Programming — canned cycles and subroutines —
computer Assisted programming — CAD/CAM approach to NC part programming — APT language,
machining from 3D models.

A part program is a set of instruction providing x, y and z coordinates and other details to perform the
desired machining operations. It directs how the tool should move with respect to work piece (or) vice
versa. A part program consists of all information necessary to complete the machining of a component.
In olden days, the part programs are coded on the punched tape: Nowadays, the punched tapes are replaced
by floppy disk and CDs. The punched tape is prepared according to the part program manuscript.
The punched tapes are 1 inch wide (25.4 mm). It was standardized by the Electronics industries
Association (EIA). The sample punched tape is shown in fig. The punched tape is fed through the tape
reader once for each component.

There are eight columns of holes as shown in fig. There is one column of sprocket holes in between 3’ and
4 columns to feed the tape.
The coding of the tape is obtained by either the presence (or) absence of a hole in the various positions.
This coding system uses the binary digit.
A binary digit is called a bit. It has a value 0 (or) 1 to represent absence (or) presence of a hole in a
particular row and column position of the tape. The columns of] holes run lengthwise along the tape. Row
positions run across the tape.
In the row of bits, a character is formed. A character is a combination of bits Representing a letter, number
and symbol: A word is. a collection of characters forming part of instruction. The collection of words forms
a block. A block of words gives one set of instruction. Each block of information is separated by End-of-
block (EOB) symbol in the column.
The part program is denoted by the symbol %. It defines the sequence of ONC machining operation. Each
block contains the following, types of words to perform a movement and functions.
1. Sequence Number (N—word (or) N codes)
2; Preparatory functions (G’-words (or) G code)
3. Coordinate words (X, Y, Z words) (or) Dimension words.
4. Speed rate (S word (or) S code)
Feed rate (F word (or) F code)
Tool selection (T word (or) T code)
Miscellaneous function (M word (or) M code) End of Block (EOB/*)
1. Block Number (or) Sequence Number (N words)
This sequence number is used to identify the sequence of block of data. It is usually given in ascending
order. This is useful for the operator to know which sequence of block, is performed by the tool. It consists
of alphabet N followed by ‘0’ to ‘999’.
(Eg) N5, N Ni50....
2. Preparatory functions (G—words (or) G codes)
G words are used to prepare the MCU to be ready to perform a specific operation.
These .words are used to prepare the machine to perform a particular function like positioning, contouring,
thread ‘cutting and machining. The following are the codes of various preparatory functions.
Example 1: Refer the following Fig. Using absolute dimensioning mode and metric units write the part
program only for positioning; First of all, position the tool to PT1, PT2, PT3 then and finally PT4.
Example 2: Write the part program for the following figure only for positioning the tool; Position the tool
PT1, at first then Ff2 and finally PT3. Locate the part reference point in absolute dimensioning and use
incremental dimensioning mode for other dimensions of the part.
Miscellaneous (or) Auxiliary Function (M Code)
The functions like coolant on (or) off, spindle rotation start etc are ‘known as miscellaneous functions.
The following are important M codes for various miscellaneous functions.

Dimension words (X, Y, & Z words) (or) coordinate words


Ø Linear dimension words.
Ø X, Y, and Z are used for primary motion.
Ø U, V, W are used for secondary motion parallel to X, Y and Z axes respectively.
Ø p, q, r are used for another - type of motion parallel to X, Y and Z respectively.
(ii) Angular Dimension words:

Ø a, b, and c (or A, B, and C) are used for rotary motion about X, Y, and Z axes respectively.
-
Ø I, J, K is used for position of- arc centre, thread lead parallel to X, Y, Z axes in case of thread
cutting.
The decimal point is not allowed in this word. So 5.675 mm in X direction will be represented as X 05675.
The last three digits of X05675 are used for the decimal part of the number. Some machines a X5675 by
omitting leading Zeros.

Feed Rate Word (F word (or) F Code)


The rate at which the cutting tool (or) cutter travels through the material is expressed in mm/mm (or)
mm/rev. The F word is used to program the proper Feed rate. This word is mostly used for contouring
system (or) straight line system F200 means a feed rate of 200 mm/mm
Spindle Speed (or) Culling speed word (S word (or) $ code)
This word indicates the spindle rpm (or) the constant cutting speed in m/min
S1000 indicates that sp rotates at 1000 rpm .Thus this code is represented by S followed by the three digit
number
Tool selection word (T word (or) T code)
This code is represented by ‘T’ followed by maximum five digit number. Different cutting tools arc
indicated by different numbers. The Automatic Tool Changers (or) turrets select the appropriate tool when
‘T’ word calls out a particular tool that has to be used for cutting.
D—word
This• word is used for cutter nose radius compensation and cutter length compensation.
Standards in Programming Format:
The following are the standard formats used for programming.
1. Word Address Format
2. Tab Sequential Format
3. Feed block Format
Word Address Format
In this format, alphabets are called address. The alphabets N, G, XYZ, S, F, T and M are separate addresses
giving standard meanings. The MCU, uses these alphabets for addressing a memory location on it. In this
format, the block of instruction may be of any length. And the words can be placed in any sequence since
the letter address will search and identify the corresponding word.
The sample word address format is shown here.

Tab sequential Format


In this tab sequential Format; the words are given in sequential order.
For example, the following block of instruction

can be given an follows:

The MCU reads first Tab and stores the data in the address corresponding to sequence number. Then the
second word is recognized as preparatory function. Similarly, all the words are read and stored in particular
addresses.
If next block contains same X and Y words and other words are changed, then the format become

So, only changed words can be given and other unchanged words need not be repeated.
Fixed Block Format
In this fixed block format, -the instructions are given in a standard sequence and the block contains a fixed
number of characters: There are no letter addresses (or) Tab codes and no words are omitted. Even if any
data remains same as in previous block, it should be repeated in the next block also. A sample fitted block
format is shown below:

In this format, the first three digits represent the sequence number, the next two digits represent preparatory
function, next three consecutive 5 digits represent X, Y, and Z coordinates respectively, next three digits —
Feed rate, next four digits — speed, Next two for tool number, next two digits tool compensation, next two
digit miscellaneous function and last digit for EOB. Different CNC machines have different fixed formats.
For example, an CNC lathe has only X and Z word and it does not have Y word.
Manual Part Programming
The programming consists of the following procedure.

Preparing CNC coordinate drawings


To write the program, first to all, we have to convert the Engineering drawing (or)
shop drawing into CNC coordinate drawing. This can be done by using any one of the
following dimension system.

and Incremental dimensioning


The above dimensioning systems have been studied in the last chapter
Process Planning:
The second step. is to plan the sequence of operations. If so many machining operations have to
be performed on a particular component, then the programmer has to decide the sequence of operations and
the machines. By this decision he can make a route sheet. The route sheet will give information whether the
milling should be done first (or) drilling should be done first.. The shortest and most efficient path can be
found and followed by preparing route sheet.
Past programming and manuscript:
By using route sheet, the programmer can prepare a ‘program manuscript’ manually to give all machining
instruction. Now, all addresses are added to the sequence of operations. The feed rate, spindle speed and
miscellaneous functions are also added.
The sample program manuscript is shown below:
Preparation of punched tape (or) preparing floppy (or) CD
In olden days, using manuscript, a pinched tape in prepared with the help of teletypewriter. Nowadays, the
program is typed L a computer using key board and the file is saved as a file in hard disk, floppy and also in
CD.
Verification
By using the prepared program, we can i the machine and do the operations on wooden block and we can
check the accuracy of the program. By analysing- the completed wooden work part, we .can decide whether
the part machined is acceptable or not.

In another method, a pen plotter i used to draw the path of the cutter, movement of table on a paper and also
to locate the centre of holes to be drilled and reamed. The plotter drawing will be compared with the
original drawing for deviation.
Production of components
The last step is to produce the actual parts.
Part programming for PTJ’ (Point to Point) machining:
In this PTP, the cutting tool, (or) workpieee moves fast from one point to another point for drilling (or)
boring or teaming etc. Once the point is located, the drilithg yperation gets started as per part program. As
soon a drilling is over, the drill comes out of the hole and goes to next poiat in rapid traverse since there is
no machining in between two points.
Example 3: Write the part program for the following figure. The Z position is zero at 100 mm above the
table surface.

Procedure
1. First of all, the work piece should be aligned so that the edge AX coincides with I axis. AY
coincides with Y axis of the machine.

2. Set the tool tip at origin B (0, 0, 0) at a height of 60 mm above the work piece corner A.
3. For drilling first hole P the tool should travel through 25 mm in X and 30 mm in Y direction and
—83 mm in Z direction (i.e. 60 + 20 + 3). The extra 3 mm is to ensure through hole in the plate,
‘—‘sign for downward direction. Part Program (To avoid confusion, x, y, z values can be given
without decimal part).
NO! G92 XQ YO FO <EOB>
Set the position ‘A’ of the plate (work piece) under the drill at point B. 092 for position
preset (or) Datum preset.
N02 G71. G90 G94 <EOB
071 for Metric, 090 for Absolute dimensioning, 094 for Feed rate in mm
NO3 MO3 F16O S1200 <EOB>
M03—Spindle start—clockwise, F160—Feed rate 160 mm/m and S 1200 — Spindle
speed at 1200 rpm
N04 COO X25 Y30 Z-58 <EOB>
000 for rapid traverse to point P 30, — 58)
N05 G01 Z—83 <EOB>
Drill the hole at point P (i.e. 60 + 20 + 3 = 83 for drill tip)
001 for linear traverse

NOB COO Z-58 <EOB>


000 for rapid traverse to 2 mm above the plate

N07 COO X50 Y80 <EOB>


Move the tool with rapid traverse to point P 80)

N08 G01 Z—83 <EOB>


Drill the hole at point P The tool tip is in 60 + 20 + 3 + = 83 mm)

N09 GOO Z—58 <EOB>


Move the tool with 2 mm above the plate

MO GOO X100 Y110 <EOB>


Move the tool with rapid traverse to point P (100, 110)

Nil C01 Z-A3 <EOB>


Drill the hole at point P

N12 GOO Z-58 <EOB>


Move in rapid traverse to 2 mm above the plate

N13 GOO X8O Y20 EOB>


Move the tool worth rapid traverse to point P

N14 G01l Z-83 <EOB>


Drill the hole at P point

N GOO Z-58 <EOB


Position tool in rapid traverse to 2 mm above the plate

N16 COO XO YO ZO <EOB>


Move the tool with rapid traverse to the position B (0, 0, 0)

N17 M02 <EOB>


M02 for
End of Program
The values I, J and K can be measured from the centre of the arc with respect to the datum in incremental
mode. The distance of center point of arc from the starting point S will be taken in tennis of I, J and K it I
for X-axis, J for Y axis and K for Z axis. For turning operations, there are only two axes X and Z. So I and
K will be present in program.
Example 4: - Write program for preparing the part as shown in fig. Use incremental mode. Given rod dia is
4r 20 and length is 40 mm.
Part programming for machining along curved surface

NO! G91 <EOB>


G91 for incremental dimensioning system
N02 GOO 3 7 <EOB
Set the tool in starting position.
N03 G01 X-10 F100 <EOB>
Facing operation . The tool moves towards centre of the job.

N04 G02 X10 Z—10 10 K— <EOB>


G02 for circular interpolation clockwise.
The calculation is as -follows X= 10mm
(Maximum width of movement in X direction)
I = 0 Vertical distance of centre from previous position. (— 10, 0)
K =-10 Horizontal distance of centre from previous position (— 10, 0)
N05 COO Z1O <EOB>

N05 COO Z1O <EOB>


Rapid travel of tool to initial point A (0, 0) by giving Z = 10mm from the previous position
N06 M02 <EOB>
M02 for the end of program
Note: The values of I and K arc found as follows:
The horizontal and vertical distances of centre of arc with respect to datum point in incremental mode are
given below. ,

The horizontal and vertical distances of centre of arc with respect to datum point
in incremental mode are given below.
Coordinates of the starting point S is (X —.10, Z 0). The centre of arc C, is located at C (X —10, Z —10).
So the vertical distance in’ X direction (i.e. from S to C) is 0. So I = 0 [ I is the vertical distance from S
(starting point) to C (centre of arc)]

And the horizontal distance in Z direction (i.e. from S to C) is —10. So K=—10mm.


[ . K is the horizontal distance from S (starting point) to C (centre of arc)]

Part programming for milling operations:


In CNC milling X axis, Y axis arid Z axis as machine, the motion is occurred shown in the following fig.
in three axes
The movement of tool in upward vice versa direction (i.e. away from job) is taken as +Z and vice versa.

In this milling operation, the cutter radius compensation should be taken care of.

A suitable dia of cutter is selected and the part program should be written for centre line of the cutter.

The cutter radius compensation will be calculated - by taking difference between programmed cutter
diameter and the actual cutter diameter and it should be entered into the control system. Then the control
system will generate a new cutter path.

It is necessary to specify whether the cutter compensation is to the right (or) to the left of the tool while
machining. The G codes G40, 041 and 042 are used for this purpose.

Example 9: Write a part program to give a finished job as shown in fig using milling operation.
Speed 1200 rpm; • Feed 125 mm Depth of • cut =3 mm; Thickness of plate = 3 mm
Note: The cutter radius compensation is stored in D02. The top surface of the plate is taken as Z = 0. G42
Compensation is applied to shift the programmed cutter path to the right. G40 is to cancel the cutter radius
compensation.
Subroutines (Macros) (L code)
When a repetitive drilling (or) any machining operations have to be done in different places, the subroutine
is used to reduce the effort of writing a detailed program for each machining operation.

The subroutine program will be stored in the memory as a separate program so that it can be called by the
main program whenever needed. When the last block in the subroutine (M17) is executed, the control will
return automatically to the main program. The subroutine is usually placed at the end of the main program.
Example: Using subroutine, write a part program to get the finished part as shown in fig.10
N1 G90 G71 G17 <EOB>
Absolute dimensioning: Metric units: XY plane
N2 GO0 X20 Y25 Z5 <EOB>
Rapidly Move the tool to point A and 5 mm above the plate surface.
N3 L20
Call the subroutine programmed to machine the first slot.
N4 G00 X100 Y25 <EOB>
Move the tool rapidly to the second slot i.e. to point B
N8 GOO X20 Y100 <EOB>
Move the tool rapidly to the 4th slot i.e. to point D.
N9 L20 <EOB>
Call subroutine program to machine 4th slot starting from D.

N1O GOO Z30 <EOB>


Rapid travel upwards by 30mm above the plate
N11 M02 <EOB>

End of program
L20 <EOB>
Subroutine program
N1 G91 <EOB>
Incremental dimensioning system
N8 G90 EOB>
Convert to absolute dimensioning mode
N9 M17 <EOB>
M17 is for end of subroutine and return to main program
Example 11: Write a part program for the finished - component as shown in figure. The point A is taken as
reference point (0, 0, 0). Take cutter diameter in 20 mm

N1 G92 X0 Y0 Z0 *
[ is given instead of <EOB>]
Position preset (or) Datum preset
N2 G90 *
Absolute dimensions
N3 GO0 X40 Y30 Z2 TO! S3000 M03 - *
Rapid traverse to B with clearance Z = 2 mm above the plate
N4 G01 Z5 F120 *
Tool goes down with depth of 5 mm straight cutting and end milling.
N5 * - -
Tool proceeds to C— straight cutting end milling
NO X80 *
Tool proceeds to E— straight cutting end milling
N7 G02 Y30 10 eJ—30 *
G02 Circular interpolation clockwise
I = 0 .The distance of centre D from E in X direction J = — 30 The distance of centre
from E in Y direction.
Now, the cutter moves through curved profile and reaches F.
N8 X30 *
Proceeds to B
N9 Z2 *
Tool moves 2 mm above the plate surface
N10 G00 Z50 M05 *
Rapid travel of tool upwards 50 mm above plate surface and spindle stops.
N11 X0 Y0 *
Rapid travel to reference point (0, 0)
N12 M02
End of program

Canned Cycles: [Fixed cycle (or) Standardized cycle]


A canned cycle is used to define a series of machining sequences for drilling (or) boring (or) tapping etc.
We have seen that a series of motions are repeated a number of times, many of which are common to all the
positions. For example, in case of drilling operation, the drill has to be positioned a little above the hole in
rapid traverse, then drill to the required depth with the given feed rate and then the tool has to return to the
top of the hole with some clearance as shown in fig.
The same instructions have to be repeated for each hole. So, for each hole, three ONC blocks have to be
written for the following actions.

(i) Positioning the drill to the hole location


(ii) Lower the tool at programmed feed rate
(iii) Lift the tool rapidly to the start p6sition.

The above three actions have to be repeated for drilling other holes also. Therefore, it is necessary to define
a canned cycle (or) fixed cycle to repeat all these motions without repeating (writing) same information for
each hole. Refer the following figures:
In both figures, -the following actions, Position the drill to the hole location,
(ii) Lower the drill at programmed feed rate,
(iii) Lift the drill rapidly to start position

are same. The only difference is in the depth of cut. In first case, it is 30 mm and in 2nd case it is 10 mm.
Hence, the canned cycle requires a new hole location, depth of cut, feed rate and spindle speed.
The canned cycles G81 to G89 ate useful for this purposes and they are stored a subroutines. The R
parameters are necessary to define the variable values necessary to execute canned cycle. The canned cycle
G8i to G89 can be cancelled by G80.
The following are the important R parameters used in canned cycles.

R01i First depth advance


R02 Reference plane (absolute) (or) start position
R03 final depth (or) Z d
R02 is the Reference plane up to which the tool advances rapidly prior to contacting the part surface (or)
R02 is the plane up to which the tool returns rapidly after completing the cycle. .
R02 can be known as gauge height.

The advantage of the canned cycle can be sensed by writing program without canned
cycle and with canned cycle for the finished component in the following example.
Example 12: Write the part program for the finished component shown in fig. without using canned cycle
and with canned cycle.
• means end of block

Pan program for drilling 3 holes without using canned cycle.


Ni G90 GOO X20 Y40 Z2 *
Rapid travel of tool to position X = 20 mm: Y 40 mm
And Z = 2 mm above the plate surface
G90 for absolute dimensioning
N2 GO1 Z—i8 F125 *
Straight drilling with depth of cut Z = 18 mm downward to ensure through hole is drilled in 15 mm thick
plate. (i.e.) Z = 2 mm clearance + 15 mm thick plate + 1 mm extra
N3 G00 Z2 *
Rapid travel of tool to position 2 mm above plate surface
N4 X60 Y80 *
Rapid travel of tool to the second hole position
N5 G01 Z—18 F125
Drilling with depth of cut Z=-18mm
N6 G00 Z2 *
Move the tool rapidly to 2 mm above surface
7 X100 Y12 *
Move the tool rapidly to the third hole position
N8 G01 Z18 F125
Drilling with depth of cut Z = —18 mm
N9 G00 Z2 *
Move the tool rapidly to 2 mm above the plate surface.
N10 X0 Y0 Z50 *
Move the tool rapidly to (0, 0, 50) position
Part program for drilling 3 holes with canned cycles
Ni G8i X20 Y40 Z—l8 R2 Fi25 *
G18 for canned cycle which will repeat 3 times. X= 20 mm, Y = 40 mm for first hole position
Z- 18 for depth of cut for drilling.
R2 means clearance plane is 2 mm above the plate surface F125 feed rate is mm/min
N2 X60 Y80
X = 60mm; Y =80mm for 2 hole position
X = 100 mm; Y = 120mm for 3” hole position
N4 G80 X0 YO Z50 *

Cancel the canned cycle and move the tool to a position (0, 0, 50).
Using caned cycle, 10 blocks are reduced to .4 blocks in CNC programming. So canned cycle prevents
boredom in writing repeated instruction. It avoids mistakes and errors in writing program.
The standard canned cycles approved by ISO are giving it below.
Example 13: Write the program using canned cycles for drilling four holes as shown in fig. Drill diameter 6
mm; Reference plane, is 2.5 mm above the plate, surface.

Ni G81 X12.5 Y12.5 R2.5 Z—17 ‘83000


G81 for canned Cycle
X = 12.5 mm; Y = 12.5mm for first hole.
It = 2.5 mm means clearance plane is ‘2 mm above the plate surface
Z = —17mm Depth of cut is 17 mm to drill bit through holes M. 12.5 thick plate. Note
is already 2.5 mm above the plate surface ‘ so
Drill hole at X’= 12.5 and Y = 75 m (2nd hole)
N3 X75 ‘
Drill hole at X = 75 and Y = 75 (i.e. 3 hole)
N4 Y—75 *
Drill hole at X = 75 and Y —75 (hole)
N5 GS0 X0’Y *
Go to initial position by canceling canned cycle.
N6 M02 End of program
F125
T01 M03*
that drill
2;5 ÷ 12.5 + 2 mm clearance = 17mm
N2 Y75 *
Non-standarised Fixed cycles
In some particular job, some portions of program have to be repeated and it can not be fitted into the
standardized canned cycle category. The following are the non-standardized cycles.
1. Do-Loops
2. Parametric subroutines
3. Macros
Do-Loops are used for turning and milling operations. When a raw material is to be reduced in size by
giving a series of rough cuts and then finishing cuts, the ‘Do-loops’ are used.
Do-Loop is a number of similar operations repeated over a number of times giving increment in each step.
It is nothing but a Do-Loop in computer programming.
The general format for Db-Loop is as follows:
(a) Do n
(b) X/Y/Z I (c) END Do
Do is the command used to repeat the operations specified in (b). n is the number of times the operation
have to be repeated. X/Y/Z is the information about coordinates for Loop.
I is the incremental value for each step.
END DO is the end of ‘Do-Loop’ after ‘if number of times the operations are repeated.
Parametric Subroutines
Parametric subroutine is similar to subroutine only difference is that the job size is different. Refer the
following component.
Each slot can be machined using same coordinate values according to their sizes.
subroutine program by giving various

The components which are similar in shapes but different in. sizes are machined using parametric
subroutine program.
This parametric subroutine is also a portion of a programmer, complete in itself, which is stored in the
computer memory. It is called with required data when required again in a program. It is usually placed at
the end of a programmed.
Difference between canned cycles and subroutines
The canned cycles are more of fixed type and they are used for easy programming of machine features that
are often needed. So canned cycles are more suitable for general situations.
But if a part needs some pattern which is to be repeated a number of times, then a subroutine is very much
useful. -
The parametric subroutine is useful for turning, rough cuts, threat cuts, key way milling, drilling etc. where
a sequence of motions are involved.
Since the parametric subroutines allow to intake their own cycles with different parametric dimensions at
different locations, it is known as ‘user defined canned cycles’
Difference between ‘Do-loops’ and ‘Subroutine’
The Do-loops are used to repeat some motions (operations) On a component for a fixed number of times.
The subroutines are used to repeat some motions (operations) on a component for a variable number of
times.
Macros are also known as ‘parametric subroutines: They are stored in memory (or) macro file used for
machining a complete component. A macro has either fixed dimensions
Macros
(or) parametric variables. These macros are very much useful to program for family of parts having same
shape but variable size as shown in the figure.
Mirroring
When the part geometries are symmetric in nature, then part program can be written to make use of such
symmetry. For doing this, the part programmer has to identify the symmetric axis and write only for half of
part geometry.
Then the part program will be repeated by using appropriate mirror imaging codes. The mirroring of image
can be obtained about X axis, Y axis (or) X and Y. axis.
In Macho programming language, the G code 73 is used for mirroring and G code 72 is used to cancel
mirroring.
The above part is syminetrical about. X axis. So the part programmer can program for upper part alone and
for machining lower part, just write
Ni G73 ex. L..
Then all X coordinates vi1l be reversed and the loiter part will be machined.
WriteProgramming
Computer Assisted Programming (CAP)
In manual part programming, very simple parts are machined, since, it requires a very few number of
instruction (or) sequence .of operations. But, most of the complex parts can not be machined by manual part
programming since they require lengthy and tedious calculations. So it is necessary to make use of
computer for part programming repetitive and complex calculations involved in mathematically defined
curves and other complicated geometrical shapes. So the complex programs can be generated by computer
Assisted Programming (CAP). The part programmer need not learn about the specific coding formats used
in different NC machine tools. Instead, he can learn only high level programming languages like APT,
ADAPT, AU.TOMAP, EXAPT, PROMPT. etc which are all ‘English like statements’.
The reliability of program is enhanced since the computer makes all calculations. Besides, the computers
have facilities for error detection to assist part programmer to produce better part program. The part
program thing time ‘is greatly reduced by as much as 75%.
With the arrival of Computer Assisted Programming (CAP), the programmer is relieved off great burden
and he has to do only the following activities.
(i) Define the geometry of the work piece from part drawing
(ii) Define the sequence of operations and tool path

(iii) Write APT program [ = Automatically Programmed Tools]


(iv) Feed (Type) the program to the computer The computer’s in CAP consists of the following:
1. Input translation
2. Arithmetic Calculation
3. Cutter offset compensation
4. Post processor.
The important Computer Assisted Programming (CAP) languages are given below.
1. APT [Programmed Tools]
APT is a product of MIT (Massachusetts Institute of Technology in US) developmental work. It is’ the most
widely used language. It can be used for both positioning as well as contouring programming in up to 5
axes. The different version of APT is APTURN for turning operations, APTMIL for milling and drilling
operations and APTPOINT for Point to Point operations.
2. ADAPT
It is n ‘Adoption of APT’. Most of these programming languages are based directly on the APT program.
This can be used in smaller computer. It was developed by IBM under Air Force contract. It is not as much
powerful as APT.
3. EXAPT
It is the ‘Extended subset of APT’. It is also based on APT and was developed in Germany. EXAPT I is
designed for drilling and straight cut milling operations.
EXAPT II is designed for turning operations.
EXAPT III is designed for limited contouring operations.
It has facility to compute optimum feeds and speeds automatically.
Similarly the other software’s are given below. UNIAPT, SPLIT, COMPACT II PROMF and CINTURN II
But, most widely used CNC part programming language is APT wit its derivatives ADAPT, EXAPT,
UNIAPT etc
APT Language is the language for computer assisted part programming. APT is like English statements.
APT commands the cutting tool through a sequence of machining operations. ft performs all calculations to
generate cutter positions. It is used to control up to five axes.

APT can be used to control a variety of different machining operations. APT uses more than 400 words.
There are tour types of APT statements
1. Geometry Statements -
Geometry statements define the geometric pattern of the work part
These are also called Definitions statements.
2. Motion Statements
Motion statements are used to define the path taken by the cutting tool.
3. Post processor statements
Post processor statements are used in pacific machine tool and control system. They are used to provide
data for feeds and speeds. They are also used to actuate other features of the machine.
4. Aux Statements
Auxiliary statements are used to identify’ the part and tool to specify the tolerances and to operate coolant
N (or) OFF and so on. These are also known as miscellaneous
Statements
Let us see all the above statements one by one in detail.
Geometry statement
First of all, the component geometry must be defined to program in APT. The geometry statements define
the path and locate the points through which the tool has to trace. The geometry statement should be given
before the motion statement.
The format for geometry statement is
Symbol = GebmetryType/Descriptive Data
Example = Point / 2, 4, 7
Explanation: The symbol. P1 is defined as ‘POINT’ having coordinates
X=2;Y=4andZ=7
So the geometric statements comprise of three sections the first section is symbol. The symbol is used to
identify the geometric element. A symbol is combination
of alphabets and numerical. The maximum character should be six. At least one of the
six should be an alphabet. Very important thing is the symbol should not be one of the
APT vocabulary words.
3. By two points and perpendicular to other plane
PL5 = PLANE/PERPTO, PL4,P1, P2
PL5 is a plane perpendicular to plane PL4 passing through P1 and P2.
Motion statements
Motion statements have a general format as given below
Motion command Descriptive Data
GOTO / P2
The above statement consists of two sections.
The first section (GOTO) tells tool what to do. The second section (P2) tells, tool where to go. By this
motion statement, the tool is ordered to go to point 2 (P2) which should have defined already in the
geometry statement.
The following are three types of motion commands
1. Setup commands
2. Point-to-Point motion commands
Setup command
The tool must be given a starting point at the very beginning of the motion.
The starting point is- known as target point where the operator positions the too at the a part of the job.
The setup motion command is
FROM / TARG
The ‘TARG’ is the target (or) starting point from which others will be referred.
FROM / -4, -3, 0
I.e. The tool should start from X=—4; Y—3; Z=O. Another way to make statement - FROM / SETPT
where SETPT is the Starting point.
3. Continuous path (contouring) motion commands
Another way to make this statement is

Point—to—Point Motion Command


(1) (XJTOIPJ
The motion statement is used to position the tool at a particular point P1 (Eg positions the drill above a hole
to be drilled)
(ii) GOTOI5, 6, 3
This motion statements tells the tool to go to point X = 5 Y = 6 and Z = 3
(iii) GODJ
This motion statement gives incremental instruction to move the tool in specified direction (in X, on Y (or)
Z direction) from its current position. The GODLTA command specifies an incremental move for the tool.
In the following example.
GODLTA/4, 8, 0,
The tool is ordered to move from its current position 4 mm in X direction, 8 mm in Y direction and no
change in Z direction.
.The GODLTA motion command is very much useful in drilling and related operations
So, GOTO statement is used to direct the tool to a particular hole location.
And GODLTA statement is used to drill the hole as given in the following example.

Contouring Motion Statement


Contouring motion commands are more complicated because the tool’s position should be continuously
controlled throughout its motion. ‘To accomplish this control, the tool is directed along two intersecting
surfaces namely ‘Drive Surface’ and ‘Part Surface’ and the tool motion is stopped by the surface namely
‘check surface’ as shown in fig.
Drive Surface
Drive surface is used to guide the side of the cutter.
Part Surface: The bottom of the cutter rides on the part surface. The part surface may or may not be the
actual surface of the workpart. The part surface should be defined along with the drive surface to maintain
the continuous path control of the tool.
Check Surface
This check surface stops the movement of the tool in its current direction. i.e. The forward movement of the
tool is stopped by this surface.
The APT contour motion statement commands the tool to move along the drive surface and over the part
surface and the movement ends when the tool is at the äheck surface.
The six contour motion commands are given below

TO ON PAST and figure.


These six commands are mostly used along with one of the four modifiers to define the check surface, drive
surface (or) part surface. The foig modifiers are given below
TANTO
The usage of four modifiers with respect to check surface is shown in following
‘TO’ moves the tool until the tool touches the check surface. ‘ON’ moves the tool until the tool centre is on
check surface. ‘PAST’ moves the tool just beyond the check surface. ‘TANTO’ moves the tool upto the
point of tangency between two surfaces, atleast one of which is circular.
‘TANTO’ is used for check surface being tangent to the Drive Surface. The format for using modifiers is
given below –

Any of the surface can be omitted and it is optional.


Motion word!Drive surface, modifier, check surface
Example: GORGTJL1, PAST, L2
Meaning: Move on the ri along Li until Past L2 (i.e. until L2 is passed)
feed,
given
Postprocessor Statements -
These postprocessor statements are used to control the operation of the spindle, the and qther features of the
machine tool. Some of the postprocessor statements are below.
COOLNTION and COOLNTIOFF for switching coolant. ON and OFF.
RAPID for rapid traverse for positioning the tool
ENI to shut down the CNC. machine.
FEDRAT—It is used for giving feed rate.
SPINDJJ2OdO, CLW means spindile speed is 2000 rpm clockwise.
Auxiliary statement Auxiliary statements aie used for cutter size definition, part identification and tool
change etc Some of the auxiliary statements are given below
CUflERJ13 means the diameter of the cutter is 13 mm.
FINI means it is adyising the computer to terminate the program.
PARTNO is used to identify the workpart.
Example 14: Write a program in APT for the finished pan shown in fig.

Solution: The geometry statements &e given beIos by referring the diagram.
$$ All points are th here.
SETPT = POINT/O, 35, 2
P1 = POINT/40,35,0
P2 = POINT/4Q, 170,0
P3 = POINT/90, 140,0
P4 = POINT/120, 60, 0
P5 = POINT/60, 35, 0
$$ Define the top and bottom surfaces.
TOPSRF = PLMTE/P1, P2, P5
BOtSRF = PLANEIPARLEL, TOPSRF, Z LARGE, —25
$ [ is a surface parallel to top surface parallel to top surface and bn the lar side of
2 y 25 downward)]
$$ Define the circles and lines
CR1 = CIRCLE/CENTER, PS, RADIUS, 30
L2 LINEIP2, LEfl, TPsNTO, CR1 1 CR2]
$$ [ The line L2 passes from point P2 and is tangent on the lef*side of arc e

L3 = LINE/P4, RIGHT, TANTO, CR1


$$ [ The line L3 passes from point P4 and is tangent on the right side of circle CR1]
L4 = LIE/P4,P5
L5 = LINE/P5,P1
$$ Define the tool, feed and speed.
LOADTL/i $$ [ tool No. 1]
CUTPERJ2O
$$ CU?YER dia is 20 mm
FEDRAT/60, MMPM $$ [ rate is 60 thm/min]
SPINDL/2500, CLW $$ [ Spindle speed is 2500 rpm cloekwise]
$$ Give the motion statements.
FROM/SETPT [ Position the tool to initial position]
GO/TO, Li, TO, BOTSRF, TO L5
$$ [ is the Drive surface along which the tool moves. BOTSRF is the part surface at which the tool end face
will be placed throughout the operation and Lfr is the Check surface for this position]
GOLFTIL1,PAST,L2
[ Move the tool in the left along the line Li until the line L2 is passed.
GO RGT/L2, TANTO, C
$$ Move the tool in the right direction along the line L2 until it touches the point of tangency of circle CR1.
GO FWD/CR1, TANTO, L3
$$ Move the tool in forward direction (in the direction of motion) along, the circle CR1 until the line L3
becomes tangent to’ it.
GO FWDIL3, PAST, I
$$ Move the tool along the line L3 until it passes line L4
GO RGT/L4, PAST, L
GO RGT/L5, PAST, Li
GOTO/SETPT
FINI
END.

Example 15: Write a part program for the finished part shown in figure
* Use the milling cuter alid drill. Assume the thickness of the plate is 20 mm. Setpt is at (0, 20, 3) and Z = 0
at the surface of the job.
Solution: The dlre of motion is defined in the figure and also all points and lines are shown here.

$$ Defining• all points:


SETPT = POINT/0, 20,3
P1 = POINT/40, 20, 0
P2= POINT/70, 8, 0
P3 = POINT/100, 20, 0
$$ Defining two surfaces:
TOPSRF = PLANE/Pi, P P3
BOTSEF = PLANE/PAIRLEL, TOPSRF, Z LARGE, 20
$$ Defining the three part of circles:
CR1 = CIRCLE/CENTER, P1, RADIUS, 10
CR2 = CIRCLE/CENTER,P2, RADIUS, 10
CR3 = CIRCLE/CENTER,P3, RADIUS, 10
$ Defining lines Li, L2, and L3
Li = LINE/LEFT,TANTO, CR1, LEFT, TANTO, CR2
L2 LINEIRIGHT,TANTO CR2, RIGHT, TANTO, CR3
L3 = LINEILEFT,TANTO, CR3, RIGHT, TANTO, CR1
$$ Giving Feed and Speed statements:
LOADTIJ1
CUflER
FEDRAT/70, MMPM
SPINDL’3000, CLW
$$ Giving Motion Statements:
FROM/SETPT
$$ Define Line Li as Drive surface, BOTTOM SURFACE as pa*tsurface
GO/TO, Li, TO, BOTSRF, TANTO, CR1
GO LVr/L1, TANTO, CR2
GO FWD/CR2, TANTO, L2
GO FWD/L2, TANTO, CR3
GO FWD/CR3,TANTO,L3
GO FWD/LS, TANTO, CR1
GO FWD/CR1, TANTO, Li
GO TO/SETPT
$ Drilling operation
LOADTL/2
CUTFERJ5
FEDRAT/50, MMPM
SPINDL(2500, CLW
$$ Drilling first hole
GOTO/Pi
GO DOWN/PAST, BOTSRF
GO UP/PAST, TOPSRF
$$ Drilling second hole
GO TO/P2
GO DOWN/PAST, EOTSRF
GO UP/PAST, TOPSRF
$$ Drilling third hole
GO TO/PS
GO DOWN/PAST, BOTSRF
GO UP/PAST, TOPSRF
$$ End of job
GOTO/SETPT
FIN!
END.
MACRO STATEMENT IN APT
The sequence of similar (or) identical statements which have to be repeated more often in a part program
are best referred by a MACRO Statement in APT so that the lengthy part program is reduced. It is sImilar to
a SUBROUTINE in FORTRAN and other Computer Programming languages.

You might also like