Computer Aided Part
Programming
Dr. Gangadharudu Talla
Assistant Professor
National Institute of Technology Warangal
Introduction
• Why CAP?
• Complex geometries
• Advantages of CAP
• Less errors
• Universal language akin to English
Concept of CAP
• Identical for all machine-tool controllers
• Considerable reduction in part programming time (~75 %)
• Machining time estimation
• APT (Automatically Programmed Tools) language
• Originated at the servomechanism laboratory of MIT
• Consists of a specially structured set of vocabulary, symbols,
rules and conventions
CAD/CAM Principles and Applications, PN Rao, TMH 2
Concept of CAP
• Processor
• Converts the input information into a generalised set of cutter
location (CL) data and the relevant machine motions
• Independent of the CNC machine tool
• Post processor
Concept of CAP
• Converts CLDATA into
the actual part
program
• Specific to the CNC
machine tool
CAD/CAM Principles and Applications, PN Rao, TMH 3
Functions of Post processor
• Converting the CLDATA to the machine tool co-ordinate
system.
• Converting the CLDATA to the control unit
understandable NC blocks taking care of the following
machine tool functions:
Concept of CAP
• Maximum table or spindle traverses,
• Available feeds and speeds,
• Available preparatory, miscellaneous and other functions,
• Straight line and circular interpolations,
• Acceleration and decelerations of slides taking care of the
overshoot of corners, and other machine tool control unit
system requirements such as tape reader time, servo setting
time, etc.
CAD/CAM Principles and Applications, PN Rao, TMH 4
Functions of Post processor
• Provide output
• Required control tape.
• Diagnostic listing on line printer, and
• Other operator/programmer instructions.
Concept of CAP
CAD/CAM Principles and Applications, PN Rao, TMH 5
APT Language Structure
• Letters ABCDEFGHIJKLMNOPQRSTUVWXYZ
• Numerals 0123456789
• Punctuation marks
| A slash divides a statement into two sections. To the left of the slash are the
MAJOR words, and to the right are the words, symbols and/or scalars that modify
APT Language
the word on the left of the slash so as to give it a complete and precise meaning or
definition, e.g., GO/PAST, LN, TO, CS.
, A comma is used as a separator between the elements in a statement generally to
the right of the slash.
= An equals is used for assigning an entity to a symbolic name, e.g., CI = CIRCLE/25,
50, 30.
) A closing parenthesis is used as a statement label separator
() The parentheses are used for enclosing the nested statements.
$ A single dollar sign when placed at the end of a line in the part program indicates
that the statement continues in the following line.
$$ The APT processor does not act upon any strings contained to the right of a
double-dollar sign. As such, it is preferable to sprinkle as many comments as
possible in the part program so as to make it more readable.
CAD/CAM Principles and Applications, PN Rao, TMH 6
APT Language Structure
• Blank character
• has no meaning in the part program except in strings
• could be employed to improve the readability of a part
program
• Words
• used in the statements
APT Language
• built up from one to six letters or numerals with the first one
being a letter
• No special character in words
• Symbols
• used as substitutes for geometrical definitions and numerical
values
• first character must be a letter
• A symbol must be defined before it is referenced in a
subsequent partprogram statement,
• e.g., L4, LIN32, CIRC23
CAD/CAM Principles and Applications, PN Rao, TMH 7
APT Language
• Keywords
• Have fixed meaning
• cannot be used for any other purpose
• may be replaced by another name using a SYN statement
• consist of between two and six letters, without any numerals.
The keywords
APT Language
• divided into two classes: MAJOR keywords, define the type of
statement, and MINOR keywords, give the required
parameters and modifiers
• E.g: CIRCLE, MATRIX, LEFT, TANTO
• Labels
• used to reference a statement so that control can be
transferred to that statement changing the usual linear-
execution sequence.
• identical to the words. But, all the characters can be numerals
• must be terminated by a right parenthesis
CAD/CAM Principles and Applications, PN Rao, TMH 8
APT Language Structure
• Numbers
• often referred to as scalars
• If a number is unsigned, the positive sign is assumed
• No distinction is made between integer and real numbers. The
APT processor treats all scalars as real numbers
• Following are valid numbers: –37624, 259.0, 0.145
APT Language
• maximum digits in a number should be 15 excluding the sign
CAD/CAM Principles and Applications, PN Rao, TMH 9
APT Language Structure
• Angles
• quoted as degrees and decimal fractions of a degree, e.g.,
13°42’ would be 13.70
• positive when measured in an anticlockwise direction from
the positive X-axis
• Structure of statements in APT
APT Language
CAD/CAM Principles and Applications, PN Rao, TMH 10
APT Language Structure
• Arithmetic APT
Addition +
Subtraction –
Multiplication *
Division /
Exponentiation **
APT Language
• The character ‘=’ is used in arithmetic statements but may not
have the same meaning as in algebra. In part-program
arithmetic it should be read as ‘is replaced by’ or ‘is given the
value of’
• B = B + 4, which means the variable B is assigned the value of
B+4
• The implied multiplication feature in algebra is not allowed
CAD/CAM Principles and Applications, PN Rao, TMH 11
APT Language Structure
• Arithmetic APT
• A = 5(4 + 2) should be written as A = 5 * (4 + 2)
• B = 23 should be written as B = 2 ** 3
• Library functions
ABS Absolute value
APT Language
SQRT Square root
SIN Sine of the angle in degrees
COS Cosine of the angle in degrees
TAN Tangent of the angle in degrees
ASIN Angle of the sine in degrees
ACOS Angle of the cosine in degrees
ATAN Angle of the tangent in degrees
EXP Exponential, the value of the e to the power
LOG Natural logarithm
CAD/CAM Principles and Applications, PN Rao, TMH 12
Types of Statements in APT
• Geometry
• Motion
• Postprocessor
• Compilation control
APT Language
CAD/CAM Principles and Applications, PN Rao, TMH 13
Geometry Commands
• Part geometry is normally broken into a number of
surface elements
• POINT, LINE, CIRCLE, PLANE, VECTOR, PATERN, SPHERE,
GCONIC, TABCYL, etc.
Geometry Commands
• Rules for defining general form of surface elements
• a symbol in lower-case letters underlined represents the
surface type specified,
• a symbol in lower-case letters without underline represents a
scalar,
• the words shown in the upper-case letters are the MINOR
keywords, and
• all possible modifiers are presented one below the other
enclosed by an opening brace from among which only one
appropriate for the definition is to be selected
CAD/CAM Principles and Applications, PN Rao, TMH 14
Geometry Commands
• Nesting
• The geometrical definitions or arithmetic computations can be
nested, wherever necessary. e.g.,
PL2 = PLANE/ P1, P2, P3
Geometry Commands
ZSURF/ PL2
• The above two statements could be combined into a single
statement as
ZSURF/ (PL2 = PLANE/ P1, P2, P3)
• Arithmetic computations can also be nested, e.g.,
P2 = POINT/ (25 + 12 * COS(35)), (12 – 6 * SIN (35))
• ZSURF
• Specifies a plane which is to be used to provide a Z value.
• All point definitions, which have no Z value specified, are given
a Z value equal to zero
CAD/CAM Principles and Applications, PN Rao, TMH 15
Point Definitions
• The point has three coordinates along X, Y and Z-axes
• The Z coordinate when not specified is taken as either
zero or the prevailing Z surface definition
• By Rectangular Coordinates
Geometry Commands
<symbol> = POINT/ x, y, z
P1 = POINT/75.0, 70.0
P1A = POINT/55.0, 70.0, 85.0
CAD/CAM Principles and Applications, PN Rao, TMH 16
Point Definitions
• By the Intersection of two lines
<symbol> = POINT/ INTOF, line1, line2
Keyword INTOF refers to the intersection
P2 = POINT/INTOF, LN1, LN2
Geometry Commands
• By the Intersection of Line and Circle
𝑋𝑆𝑀𝐴𝐿𝐿
𝑋𝐿𝐴𝑅𝐺𝐸
<symbol> = POINT/ , INTOF, line1, circle1
𝑌𝑆𝑀𝐴𝐿𝐿
𝑌𝐿𝐴𝑅𝐺𝐸
In the definition, the line symbol is specified first
followed by the circle symbol.
The modifiers XSMALL, XLARGE, signify the point, which
has an algebraically small or large coordinate when
projected onto that axis.
P3B = POINT/ XSMALL, INTOF, LN3, CR1
P3A = POINT/ XLARGE, INTOF, LN3, CR1
CAD/CAM Principles and Applications, PN Rao, TMH 17
Point Definitions
• By the Intersection of Two Circles
<symbol>=POINT/INTOF, circle1, circle2
P4A = POINT/XSMALL, INTOF, CR2, CR3
P4B = POINT/XLARGE, INTOF, CR2, CR3
Geometry Commands
• Polar Coordinates in a Coordinate Plane
𝑋𝑌𝑃𝐿𝐴𝑁
<symbol>= POINT/RTHETA, 𝑌𝑍𝑃𝐿𝐴𝑁 , radius, angle
𝑍𝑋𝑃𝐿𝐴𝑁
𝑋𝑌𝑃𝐿𝐴𝑁
<symbol>= POINT/THETAR, 𝑌𝑍𝑃𝐿𝐴𝑁 , angle, radius
𝑍𝑋𝑃𝐿𝐴𝑁
P5 = POINT/RTHETA, XYPLAN, 107, 36
The radius must not be a negative value.
The modifiers XYPLAN, etc., specify the plane in which the point is lying
CAD/CAM Principles and Applications, PN Rao, TMH 18
Point Definitions
• On a Circle at an Angle with the X-axis
<symbol> = POINT/ circle1, ATANGL, angle1
P6 = POINT/CR1, ATANGL, 26
Geometry Commands
• By the Centre of a Circle
<symbol> = POINT/CENTER, circle1
P7 = POINT/CENTER, CR2
CAD/CAM Principles and Applications, PN Rao, TMH 19
Line Definitions
• Considered to be of infinite length and do not have a
direction
• By Two Point Symbols or Rectangular Coordinates of
Points
Geometry Commands
<symbol> = LINE x1, y1, z1, x2, y2, z2
<symbol> = LINE/ point I, point2
The two points should not be the same or they should
not have the same coordinates
L1 = LINE/ 45, 60, 94, 91
• By a Point and a Parallel Line
<symbol> = LINE/ point1, PARLEL, line2
L2 = LINE/PAB, PARLEL, LAB
CAD/CAM Principles and Applications, PN Rao, TMH 20
Line Definitions
• As One of the Coordinate Axis
𝑋𝐴𝑋𝐼𝑆
<symbol>= LINE/
𝑌𝐴𝑋𝐼𝑆
L3 = LINE/ XAXIS
Geometry Commands
• By a Point and a Perpendicular Line
<symbol> = LINE/point1, PERPTO, line2
L4 = LINE/PABC, PERPTO, LABC
CAD/CAM Principles and Applications, PN Rao, TMH 21
Line Definitions
• By a Parallel Line at a Distance
𝑋𝑆𝑀𝐴𝐿𝐿
𝑋𝐿𝐴𝑅𝐺𝐸
<symbol> = LINE/PARLEL, line2, , distance
𝑌𝑆𝑀𝐴𝐿𝐿
𝑌𝐿𝐴𝑅𝐺𝐸
Geometry Commands
L5 = LINE/PARLEL, LA1, YSMALL, 40
• By a Point and Angle made with a Line
𝑙𝑖𝑛𝑒1
<symbol> = LINE/point, ATANGL, angle1, 𝑋𝐴𝑋𝐼𝑆
𝑌𝐴𝑋𝐼𝑆
L6 = LINE/PNT1, ATANGL, 37, LAB
When the line is not specified XAXIS assumed
CAD/CAM Principles and Applications, PN Rao, TMH 22
Line Definitions
• By a Point and a Tangential Circle
𝐿𝐸𝐹𝑇
<symbol>=LINE/point, , TANTO, circle1
𝑅𝐼𝐺𝐻𝑇
RIGHT and LEFT is established looking from the point towards
the centre of the circle.
Geometry Commands
The point must not be inside the circle.
L7A = LINE/PABC, LEFT, TANTO,CIR3
L7B = LINE/PABC, RIGHT, TANTO, CIR3
• Tangential to Two Circles
𝐿𝐸𝐹𝑇 𝐿𝐸𝐹𝑇
<symbol> = LINE/ , TANTO, circle1, , TANTO,
𝑅𝐼𝐺𝐻𝑇 𝑅𝐼𝐺𝐻𝑇
circle 2
RIGHT and LEFT is established looking from the centre of the
first circle specified in the definition towards the centre of the
other circle.
One circle must not be completely inside the other circle.
L8A = LINE/ LEFF, TANTO, CIR1, LEFT, TANTO, CIR2
L8B = LINE/ RIGHT, TANTO, CIR1 , RIGHT, TANTO, CIR2
L8C = LINE/ LEFT, TANTO, CIR1, RIGHT, TANTO, CIR2
L8D = LINE/ RIGHT, TANTO, CIR1, LEFT, TANTO, CIR2
CAD/CAM Principles and Applications, PN Rao, TMH 23
Circle Definitions
• By the Centre and Radius
<symbol> = CIRCLE/ x1, y1, radius 1
<symbol> = CIRCLE/ x1, y1, z1, radius 1
<symbol> = CIRCLE/CENTER. point 1, RADIUS, radius1
The centre can be specified by a symbol or by its
Geometry Commands
coordinate values.
C1 = CIRCLE/61, 62, 37
• By the Centre and Tangential Line
<symbol> = CIRCLE/CENTER, point1, TANTO, line1
C2 = CIRCLE/ CENTER, PT1, TANTO, LN1
CAD/CAM Principles and Applications, PN Rao, TMH 24
Circle Definitions
• By Three Points on the Circumferences
<symbol> = CIRCLE/ point 1, point2, point3
No two points should coincide.
The three points must not be collinear.
Geometry Commands
C3 = CIRCLE/ PT4, PT2, PT3
• By the Centre and a Tangential Circle
<symbol> = CIRCLE/ CENTER, point 1,
𝐿𝐴𝑅𝐺𝐸
, TANTO, circle1
𝑆𝑀𝐴𝐿𝐿
The point should not coincide with the centre of
the given circle.
C4A = CIRCLE/ CENTER, PT1, LARGE, TANTO, CIR
C4B = CIRCLE/ CENTER, PT1, SMALL, TANTO, CIR
CAD/CAM Principles and Applications, PN Rao, TMH 25
Circle Definitions
• By Two Tangential Lines and Radius
𝑋𝑆𝑀𝐴𝐿𝐿 𝑋𝑆𝑀𝐴𝐿𝐿
𝑋𝐿𝐴𝑅𝐺𝐸 𝑋𝐿𝐴𝑅𝐺𝐸
<symbol>= CIRCLE/ , line1, , line2, RADIUS, radius1
𝑌𝑆𝑀𝐴𝐿𝐿 𝑌𝑆𝑀𝐴𝐿𝐿
𝑌𝐿𝐴𝑅𝐺𝐸 𝑌𝐿𝐴𝑅𝐺𝐸
Geometry Commands
These modifiers specify the choice of the circle whose
centre has algebraically larger or smaller X or Y
coordinate with reference to the line.
The two lines must not be parallel.
C5A = CIRCLE/ YLARGE, LN2, YLARGE, LN3, RADIUS, 15
C5B = CIRCLE/ XSMALL, LN2, YLARGE, LN3, RADIUS, 15
C5C = CIRCLE/ YSMALL, LN2, YSMALL, LN3, RADIUS, 15
C5D = CIRCLE/ YSMALL, LN3, XLARGE, LN2, RADIUS, 15
CAD/CAM Principles and Applications, PN Rao, TMH 26
Circle Definitions
• By a Tangential Line, a Point on the Circumference and
Radius
𝑋𝑆𝑀𝐴𝐿𝐿
𝑋𝐿𝐴𝑅𝐺𝐸
<symbol>= CIRCLE/TANTO, line1, , point1, RADIUS, radius1
𝑌𝑆𝑀𝐴𝐿𝐿
Geometry Commands
𝑌𝐿𝐴𝑅𝐺𝐸
These modifiers specify the choice of the circle whose
centre has algebraically larger or smaller X or Y
coordinate with reference to the point.
C6A = CIRCLE/ TANTO, LN1, YLARGE, PT1, RADIUS. 16
C6B = CIRCLE/ TANTO, LN1, YSMALL, PT1, RADIUS, 16
C6C = CIRCLE/ TANTO, LN1, XSMALL, PT2, RADIUS, 16
C6D = CIRCLE/ TAN1D, LN1, XLARGE, PT2, RADIUS, 16
CAD/CAM Principles and Applications, PN Rao, TMH 27
Circle Definitions
• By Two Tangential Circles and Radius
𝑋𝑆𝑀𝐴𝐿𝐿
Geometry Commands
𝑋𝐿𝐴𝑅𝐺𝐸 𝐼𝑁 𝐼𝑁
<symbol> = CRCLE/ , , circ1, , circ2, RADIUS, rad1
𝑌𝑆𝑀𝐴𝐿𝐿 𝑂𝑈𝑇 𝑂𝑈𝑇
𝑌𝐿𝐴𝑅𝐺𝐸
IN and OUT allows the selection of the considered circle by indicating the mode
of tangency between the two circles.
C7A = CIRCLE/ YLARGE, OUT, CIR1, IN, CIR2, RADIUS, 10
C7B = CIRCLE/ YLARGE, IN, CIR1, IN, CIR2, RADIUS, 10
C7C = CIRCLE/ YLARGE, OUT, CIR1, OUT, CIR2, RADIUS, 10
C7D = CIRCLE/ YLARGE, IN, CIR1, OUT, CIR2, RADIUS, 10
C7E = CIRCLE/ YSMALL, IN, CIR1, IN, CIR2, RADIUS, 10
C7F = CIRCLE/ YSMALL, OUT, CIR1, IN, CIR2, RADIUS, 10
C7G = CIRCLE/ YSMALL, IN, CIR1, OUT, CIR2, RADIUS, 10
C7H = CIRCLE/ YSMALL, OUT, CIR1, OUT, CIR2, RADIUS, 10
CAD/CAM Principles and Applications, PN Rao, TMH 28
Circle Definitions
• By a tangential line, a tangential circle and radius
Geometry Commands
𝑋𝑆𝑀𝐴𝐿𝐿 𝑋𝑆𝑀𝐴𝐿𝐿
𝑋𝐿𝐴𝑅𝐺𝐸 𝑋𝐿𝐴𝑅𝐺𝐸 𝐼𝑁
<symbol> = CIRCLE/ , line1, , , circ2, RADIUS, radius1
𝑌𝑆𝑀𝐴𝐿𝐿 𝑌𝑆𝑀𝐴𝐿𝐿 𝑂𝑈𝑇
𝑌𝐿𝐴𝑅𝐺𝐸 𝑌𝐿𝐴𝑅𝐺𝐸
C8A = CIRCLE/ YLARGE, LN1, XLARGE, OUT, CIR3, RADIUS, 10
C8B = CIRCLE/ YSMALL, LN1, XLARGE, OUT CIR3, RADIUS, 10
C8C = CIRCLE/ YLARGE, LN1, XLARGE, IN, CIR3, RADIUS, 10
C8D = CIRCLE/ YSMALL, LN1, XLARGE, IN, CIR3, RADIUS, 10
C8E = CIRCLE/YLARGE, LN1, XSMALL, IN, CIR3, RADIUS, 10
C8F = CIRCLEJ YSMALL, LN1, XSMALL, IN, CIR3, RADIUS, 10
C8H = CIRCLE/ YLARGE, LN1, XSMALL, OUT, CIR3, RADIUS, 10
C8G = CIRCLE/ YSMALL, LN1, XSMALL, OUT, CIR3, RADIUS, 10
CAD/CAM Principles and Applications, PN Rao, TMH 29
Vector Definitions
• Both magnitude and direction.
• Often used to specify the direction in geometry
application and the motion of the cutter
• By x, y, z Components
Geometry Commands
<symbol> = VECTOR/ x1, y1, z1
V1 = VECTOR/ 50, 60, 70
This definition generates a vector from the origin of the
coordinate system
• By Two Points
<symbol> = VECTOR/ x1, y1, z1, x2, y2, z2
<symbol> = VECTOR/ point1, point2
V2 = VECTOR/ 30, 30, 20, 60, 50, 90
When a vector is defined by the coordinate values, all the
components need to be mentioned without omission
CAD/CAM Principles and Applications, PN Rao, TMH 30
Plane Definitions
• Planes are surfaces with infinite areas
• Often used to specify the machining surfaces and tool-
end surface location
• By Three Points
Geometry Commands
Syntax is <symbol> = PLANE/ point1, point2, point3
PL1 = PLANE/ PT1, PT2, PT3
• By a Point and a Parallel Plane
<symbol> = PLANE/ point1, PARLEL, plane1
PL2 = PLANE/ PT4, PARLEL, PLN1
CAD/CAM Principles and Applications, PN Rao, TMH 31
Plane Definitions
• By the Coefficient of a Plane Equation aX + bY + cZ = d
<symbol> = PLANE a, b, c, d
PL3 = PLANE/ 0, 0, 0, 27
Geometry Commands
PL3A = PLANE/ 0, 0, 0, 49
CAD/CAM Principles and Applications, PN Rao, TMH 32
Pattern Definitions
• Used for the purpose of grouping of holes that need
identical processing
• Rely on some form of symmetry present in the group
• <symbol> = PATERN/ <parameters>
Geometry Commands
• The Z value of any point used in the pattern definition
is ignored
• The Z levels associated with a pattern are determined
by a CYCLE command during the motion statement by
the postprocessor
CAD/CAM Principles and Applications, PN Rao, TMH 33
Pattern Definitions
• Linear Pattern by the First, Last and Number of Points
<symbol> = PATERN/ LINEAR, point I, point2, number
PAT1 = PATERN/ LINEAR, PT1, PT2, 7
Numbering of the holes in the patterns starts from
Geometry Commands
the start point
• Linear Pattern by the First Point, Vector and Number of
Points
<symbol> = PATERN/ LINEAR, point1, vector1, number
PAT1 = PATERN/ LINEAR, PT3, V2, 6
CAD/CAM Principles and Applications, PN Rao, TMH 34
Pattern Definitions
• Circular Pattern by a Circle, Angular Positions of First
Hole, Last Hole and Number of Points
𝐶𝐿𝑊
<symbol> = PATERN/ ARC, circle1, ang1, ang2, , number
𝐶𝐶𝐿𝑊
Geometry Commands
If the position of the last hole, ang2 is not specified then
it would be treated as the first hole position, ang1.
Angles are measured from the radius parallel to the
positive X-axis direction.
CLW The pattern is produced moving in a clockwise
direction from the starting angle given.
CCLW Same as above in the counter-clockwise direction.
PAT3 = PATERN/ ARC, CIR1, 40, CCLW, 6
PAT4 = PATERN/ ARC, CIR2, 29, -130, CCLW, 9
CAD/CAM Principles and Applications, PN Rao, TMH 35
Pattern Definitions
• Parallelogram Constructed From Two Patterns
<symbol> = PATERN/ PARLEL, patern1, patern2
PATT1 = PATERN/ LINEAR, P1, P2, 4
PATT2 = PATERN/ LINEAR, P4, V5, 3
PAT5 = PATERN/ PARLEL, PATT1, PATT2
Geometry Commands
The sides of the parallel pattern are formed by
moving the second pattern quoted, so that its origin
coincides with the origin of the first pattern given in
the definition. The sequence of the point numbering
is as shown in the example
• Random Strings of Points and Patterns
<symbol> = PATERN/ RANDOM, point1, patern1,
point2, patern2
PAT6 = PATERN/ RANDOM, PATT4, PATT5, PNT1,
PNT2, PNT3
CAD/CAM Principles and Applications, PN Rao, TMH 36
Matrix Definitions
• Useful for the transformations of the cutter coordinates
from one system to another
• Geometry could be defined from a convenient
coordinate system and the same could be transformed
Geometry Commands
into any of the required coordinate frames
• A matrix is a set of twelve parameters. These
parameters are the coefficients of three linear
equations defining the mathematical relationship
between the two coordinate systems
• Nine of the coefficients are the directional cosines and
the other three are the origin of the new coordinate
system.
• <symbol> = MATRIX/ <parameters>
CAD/CAM Principles and Applications, PN Rao, TMH 37
Matrix Definitions
• Translation
<symbol> = MATRIX/ TRANSL, dist1, dist2, dist3
dist1, dist2 and dist3 are the origin of the new
system with its axes parallel to the old system.
Geometry Commands
MAT1 = MATRIX/TRANSL, 40, 52
• Rotation
𝑋𝑌𝑅𝑂𝑇
<symbol> = MATRIX/ 𝑌𝑍𝑅𝑂𝑇 , angle1
𝑍𝑋𝑅𝑂𝑇
The positive sense of the rotation is
defined from the first reffered axis to the
new one in CCW direction
MAT2 = MATRIX/XYROT, 30
CAD/CAM Principles and Applications, PN Rao, TMH 38
Matrix Definitions
• Translation
<symbol> = MATRIX/SCALE, factor1
The factor represents the ratio between a unit
vector in the old system to the corresponding one
Geometry Commands
in the new system.
MAT3 = MATRIX/SCALE, 2
• Mirroring
𝑋𝑍𝑃𝐿𝐴𝑁
𝑋𝑌𝑃𝐿𝐴𝑁
<symbol> = MATRIX/MIRROR, 𝑌𝑍𝑃𝐿𝐴𝑁
𝑙𝑖𝑛𝑒1
𝑝𝑙𝑎𝑛𝑒1
This definition transforms the geometry as if viewed in
a mirror against a surface, which could be a line, plane
or any of the principal coordinate plane.
MAT4 = MATRIX/MIRROR, LM
CAD/CAM Principles and Applications, PN Rao, TMH 39
Matrix Definitions
• Rotation and Translation
𝑋𝑌𝑅𝑂𝑇
<symbol> = MATRIX/ 𝑌𝑍𝑅𝑂𝑇 , angel1, TRANSL, x1, y1, z1
𝑍𝑋𝑅𝑂𝑇
Geometry Commands
This definition first rotates the geometry about the
origin of the part coordinate system and then
translates the rotated geometry.
MAT2 = MATRIX/XYROT, 30, TRANSL, 52, 40, 0
CAD/CAM Principles and Applications, PN Rao, TMH 40
Geometry Commands Example 1 for APT geometry definition
PARTN0/ EXAMPLE 16.1 FIG. 16.24
P2 = POINT/ 20, 20
L1 = LINE/ 20, 20, 20, (20 + 80)
L2 = LINE/ (POINT/ 20, (20 + 80)), ATANGL, 45
P1 = POINT/ (20 + 30 + 40 + 20), 20
C2 = CIRCLE/ CENTER, P1, RADIUS, 20
L4 = LINE/ P1, PERPTO, (LINE/ XAXIS)
C1 = CIRCLE/ (20 + 30 + 40), (20 + 80 + 30 - 20), 20
L3 = LINE/(POINT/(20 + 30),(20 + 80 + 30)),PARLEL,(LINE/ XAXIS)
L5 = LINE/ 20, 20, 90, 20
CAD/CAM Principles and Applications, PN Rao, TMH 41
Geometry Commands Example 2 for APT geometry definition
PARTNO/ EXAMPLE 16.2 FIG. 16.25
L4 = LINE / XAXIS
C1 = CIRCLE/ 24, 20, 12.5
L1 = LINE/ (POINT/ 0,0), ATANGL, 15
L2 = LINE/ PARLEL, L4, YLARGE, 32
L7 = LINE/ YAXIS
L5 = LINE/ PARLEL L7, XLARGE, (24 - 12.5)
L6 = LINE/ PARLEL, L5, XLARGE, (12.5 + 12.5)
L3 = LINE/ PARLEL, L7, XLARGE, 100
CAD/CAM Principles and Applications, PN Rao, TMH 42
Types of Motion commands
• To describe the actual machining sequence making use
of the geometry elements/definitions
• Set-up commands
• Start point
Motion Commands
• Cutter
• Surfaces
• Tolerances
• Point-to-point motion commands
• Goto
• Godlta
• Continuous path motion commands
• Startup
• Action verb
CAD/CAM Principles and Applications, PN Rao, TMH 43
Set-up Commands
• Start Point
• point where the tool will be set with reference to the holding
fixture or component
• to establish the starting point of the cutter when it starts the
first motion, the FROM command is to be used
Motion Commands
FROM/ point
FROM/ x1, y1
FROM/ x1, y1, z1
• When no Z value is specified, it is derived from the current
ZSURF in force
• The first FROM command does not involve any movement of
the tool but simply defines where the tool already is
• In a part program, normally only one FROM may appear and
that should precede the first motion command
• Subsequent FROM commands are treated as GOTO commands
CAD/CAM Principles and Applications, PN Rao, TMH 44
Set-up Commands
• Cutter
CUTTER/ dia
CUTTER/ dia, radius
CUTTER/ dia, radius, e, f, …, h
• Cutter is modal
Motion Commands
• A part program can contain multiple CUTTER statements
• In the absence of full description of the cutter, it would be
treated as cylindrical in calculating the machining path
• The points calculated are represented by the X, Y and Z
coordinates of the tool endpoints
CAD/CAM Principles and Applications, PN Rao, TMH 45
Set-up Commands
• Surfaces
• Desired path of the 3-dimensional cutting tool is described by
means of three intersecting surfaces, which are designated as
drive surface (dsurf), part surface (psurf) and check surface
(csurf)
Motion Commands
• For any motion to be described, all three surfaces are to be
designated either explicitly or otherwise
Part surface: It is in continual contact with
the tool tip and helps in the control of depth
of cut
Drive surface: The tool periphery or tool axis
follows the drive surface. It should always be
explicitly mentioned in any continuous path
motion command
Check surface: limits the given motion
statement CAD/CAM Principles and Applications, PN Rao, TMH 46
Set-up Commands
• Tolerances
• Most CNC machine tools produce curved surfaces by a series
of straightline motions (cut vectors)
• Part programmer specifies a tolerance range so that cut
vectors, generated are close to the required surface
• The format of the tolerance specification is
Motion Commands
INTOL/ dsval, psval, cs1val, cs2val
OUTTOL/ dsval, psval, cs1val, cs2val
TOLER/ dsval, psval, cs1val, cs2val
• In the above definitions, the values refer to the drive surface,
part surface, first check surface and second check surface
respectively
• The last three values are optional. Any value can be omitted
from the right side in which case it is assumed as the one
given for the previous one. For example, if only dsval is
specified, the same tolerance value is used for all the
surfaces.
CAD/CAM Principles and Applications, PN Rao, TMH 47
Set-up Commands
• INTOL specifies the amount by which the cutter can cut into
the workpiece surface, and OUTTOL for the excess material to
be left out
• The tolerance specification should be either or both of INTOL
and OUTTOL or TOLER. If TOLER is specified, OUTTOL is set to
Motion Commands
zero.
• If no tolerance is specified, some default value, which is low,
will be assumed by the processor.
• Tolerance values are modal and can be changed in a part
program at any time.
CAD/CAM Principles and Applications, PN Rao, TMH 48
Point-to-Point Motion Commands
• Used to specify the positioning commands used for
point-to-point applications such as drilling operation
• GODLTA
• specifies the relative movement along the axes specified
Motion Commands
GODLTA/ dx, dy, dz
GODLTA/ dz
GODLTA/ vector
• results in moving dx along the X-axis, dy along the Y-axis and
dz along the Z-axis from the current position
• If only one value is specified, it refers to the Z-axis
CAD/CAM Principles and Applications, PN Rao, TMH 49
Point-to-Point Motion Commands
• GOTO
• absolute movement statement
• used to move the spindle from the current position to the point
specified in the statement
GOTO/ x, y
GOTO/ x, y, z
Motion Commands
GOTO/ point
• When no Z-value is specified, it is taken from ZSURF in force
• can also be utilised for positioning of a series of points that are
already grouped into a pattern in the specified sequence
• GOTO/ pattern
• The type of processing to be done at the points visited by the
spindle is specified by postprocessor commands
• Part programmer has the ability to change the order of point
positions or tool movements by the use of a of pattern modifiers
such as INVERS, OMIT, RETAIN, AVOID, THRU and CONST
CAD/CAM Principles and Applications, PN Rao, TMH 50
Point-to-Point Motion Commands
• use of modifiers does not change the order of points in the
pattern defined, but only changes the way the tool reaches
these points
INVERS reverses the order in which the tool visits the locations
OMIT tool will not visit the specified points
Motion Commands
RETAIN tool will visit only the specified points
• tool moves at rapid rate in a clearance plane (close to the
workpiece top surface), when positioning is done in a pattern
• If any work-holding clamp or other obstruction is present then
the tool has to clear them by moving to a higher plane than
the clearance plane. This is achieved by using the AVOID
modifier
GOTO/patern, AVOID, 15, 2, 4
• Above statement causes the tool to be raised 15 units at point
2 and 4 and lowered at points 3 and 5 respectively
CAD/CAM Principles and Applications, PN Rao, TMH 51
Motion Commands Point-to-Point Motion Commands
THRU Establishes the sequence of locations rather than specifying
all points for modifiers OMIT, RETAIN and AVOID
• Output order of the points is the order in which the GOTO
statement specifies the points
• If INVERS is used then the numbering order also reverses. To
maintain the numbering order the same as that in the
definition the modifier CONST may be used
GOTO/ patern, INVERS, CONST, OMIT, 9, THRU, 4
CAD/CAM Principles and Applications, PN Rao, TMH 52
Motion Commands Point-to-Point Motion Commands
CAD/CAM Principles and Applications, PN Rao, TMH 53
Continuous-Path Motion Commands
• Used to specify continuous path motion involving
milling and turning operations
• Part Surface
• in continual contact with tool tip
Motion Commands
• helps in the control of depth of cut
• can be explicitly specified by,
PSIS/ps Part surface is
AUTOPS Automatic part surface (current Z level)
NOPS No part surface
• Start-up Command
• to establish the contact between cutting tool and part and
drive surface within the specified tolerance limits
CAD/CAM Principles and Applications, PN Rao, TMH 54
Continuous-Path Motion Commands
𝑇𝑂
𝑇𝑂 𝑇𝑂
𝑂𝑁
GO/ 𝑂𝑁 , ds, 𝑂𝑁 , ps, , cs
𝑃𝐴𝑆𝑇
𝑃𝐴𝑆𝑇 𝑃𝐴𝑆𝑇
𝑇𝐴𝑁𝑇𝑂
• The modifier TO affects the relationship of the tool with
reference to the drive, part or check surface, ON, PAST or
Motion Commands
TANTO used with that particular surface.
• If no modifier is specified, TO is assumed
CAD/CAM Principles and Applications, PN Rao, TMH 55
Continuous-Path Motion Commands
• When a three-surface start-up is used, the tool will be
correctly positioned at the drive surface
GO/TO, DSURF, TO, PSURF, TO,CSURF
Motion Commands
CAD/CAM Principles and Applications, PN Rao, TMH 56
Continuous-Path Motion Commands
• Continuous Motion Commands
• To continue the motion using the action verbs to specify the
direction in which the tool needs to move
GOLFT/ ds, TO, cs Contour motion command to go left
GORGT/ ds, TO, cs Contour motion command to go right
Motion Commands
GOFWD/ ds, TO, cs Contour motion command to go forward
GOBACK/ ds, TO, cs Contour motion command to go back
GOUP/ ds, TO, cs Contour motion command to go up
GODOWN/ ds, TO, cs Contour motion command to go down
CAD/CAM Principles and Applications, PN Rao, TMH 57
Continuous-Path Motion Commands
• APT allows the action verbs to be valid over a large range (to
be precise up to 88° on either side of validity)
• GORGT is valid at any angle at 176° from the forward direction
• Other action verbs also have similar validity
• There is an overlap of 86° where either GOFWD or GORGT is
Motion Commands
valid
CAD/CAM Principles and Applications, PN Rao, TMH 58
Continuous-Path Motion Commands
• Applications
𝑇𝑂
𝑂𝑁
GOLFT/ ds, , cs
𝑃𝐴𝑆𝑇
𝑇𝐴𝑁𝑇𝑂
𝑇𝑂
Motion Commands
𝑂𝑁
GOLFT/ ds, , n, INTOF, cs
𝑃𝐴𝑆𝑇
𝑇𝐴𝑁𝑇𝑂
CAD/CAM Principles and Applications, PN Rao, TMH 59
Continuous-Path Motion Commands
• When a continuous motion command is given, the check
surface for the present motion becomes the drive surface for
the next motion
• Necessary to specify the check surface explicitly, except the
last motion command
Motion Commands
FROM/ SETPT
GO/ L1, PS, L4
GOLFT/ L1, PAST, L2
GORGT/ L2, PAST, L3
GORGT/ L3, PAST, L4
GORGT/ L4, PAST, L1
GOTO/SETPT
CAD/CAM Principles and Applications, PN Rao, TMH 60
Motion example1
PARTNO/ EXAMPLE 16.1 FIG. 16.24
FROM/ 0, 0, 50
CUTTER/ 20
TOLER/ 0.01
GO/L1, (PL1 = PLANE/ 0, 0, 1, 3), L5
Motion Commands
AUTOPS
GODLTA/ -8
TLLFT, GOLFT/ L1, PAST, L2
GORGT/ L2, PAST, L3
GORGT/ L3, TANTO, C1
GOFWD/ C1, TANTO, L4
GOFWD/ L4, PAST, 1, INTOF, C2
GORGT/ C2, PAST, L5
GORGT/ L5, PAST, L1
GODLTA/ 8
GOTO/ 0, 0, 50
CAD/CAM Principles and Applications, PN Rao, TMH 61
Post Processor Commands
• To specify the machine-tool functions
• Supposed to be acted upon by the postprocessor
identified earlier in the part program
Post processor commands
𝑂𝑁
𝑂𝐹𝐹
COOLNT/ 𝑀𝐼𝑆𝑇
𝐹𝐿𝑂𝑂𝐷
𝑇𝐴𝑃𝐾𝑈𝐿
Specifies the type of cutting fluid application to be used and when to start or stop
𝐷𝑅𝐼𝐿𝐿
𝐼𝑃𝑀
𝐹𝐴𝐶𝐸
𝐼𝑃𝑅
CYCLE/ 𝑇𝐴𝑃 , Z, , feed, rapid_p1
𝑀𝑀𝑃𝑀
𝐵𝑂𝑅𝐸
𝑀𝑀𝑃𝑅
𝑅𝐸𝐴𝑀
IPM Inch per minute
IPR Inch per revolution
MMPM mm per minute
MMPR mm per revolution
CAD/CAM Principles and Applications, PN Rao, TMH 63
Post Processor Commands
Specifies the generation of a fixed sequence of motions similar to the canned cycles - z is
the depth through the work material, which the tool has to travel with f, the feed rate
given in the units specified.
The rapid_pl specifies the position of the rapid plane above the point where the cycle
will be effective
Post processor commands
𝐼𝑃𝑀
𝐼𝑃𝑅
FEDRAT/ , feed
𝑀𝑀𝑃𝑀
𝑀𝑀𝑃𝑅
Specifies the rate at which the slides move in appropriate units as designated.
LOADTL/ toolno, magpos
Indicates the loading of the tool number, which is loaded in the tool magazine position.
REWIND
Inserted to rewind the control tape to a known tape mark, which is generally the start of
the tape (part program)
𝑆𝐹𝑀
𝐶𝐿𝑊
SPINDL/ 𝑅𝑃𝑀 , n,
𝐶𝐶𝐿𝑊
𝑆𝑀𝑀
SFM Surface feet per minute
RPM Revolutions per minute
SMM Surface metres per minute
Signifies the selection of spindle speed in appropriate units mentioned in the statement.
CAD/CAM Principles and Applications, PN Rao, TMH 64
Compilation Control Commands
• Covers statements that normally prepare the computer
for accepting the part program
• Improve the readability of the part program
Compilation control commands
• Control the output of the computer
• PARTNO
PARTNO/ <literal string>
• used as identification for the part program
• should be the very first statement
• in a given line, PARTNO should appear in the first six character
positions without any blanks
• length of <Literal string> will depend on the particular
implementation, e.g., PARTNO/LEVER 138C
CAD/CAM Principles and Applications, PN Rao, TMH 65
Compilation Control Commands
• FINI
• It is the physical end of a part program
• should always be present at the end of any part program
Compilation control commands
• MACHIN
MACHIN/name, <parameters>
• Identifies the postprocessor to be used for outputting the
necessary NC blocks
• name signifies the name of the particular post processor
identification name in literal strings, e.g., EXPOST,
• <parameters> initializes various flags in the postprocessor
program. The number of such parameters depends upon a
particular implementation
• NOPOST
• When no postprocessing of CLDATA is required
• suppresses the postprocessing
CAD/CAM Principles and Applications, PN Rao, TMH 66
Compilation Control Commands
• REMARK
REMARK/GEOMETRICAL DEFINITIONS
• ignored by the processor and as such, is identical to a $$ in
Compilation control commands
usage
• present only in the first six character positions of a line
CAD/CAM Principles and Applications, PN Rao, TMH 67
Repetitive Programming
• Just as DO loop, subroutines and macros are used in
manual part programming
• Looping
• part program is executed sequentially starting from a PARTNO
Repetitive Programming
statement to the FINI statement
• possible to change this sequential execution by means of the
transfer statements available in APT
JUMPTO/ lbl1 unconditional transfer
IF (< expression>) lb11, lb12, lb13 conditional transfer
• When the numerical value of the <expression> is negative,
zero or positive, then control is transferred to the statement
referenced by lb11, lb12, or lb13 respectively
• always necessary to label the statement that follows the IF
statement
• <expression> could be a variable or an arithmetic expression
CAD/CAM Principles and Applications, PN Rao, TMH 68
Repetitive Programming
X= 0
LB0) YVAL = 20
LB1) GOTO/X, YVAL, 0
GODLTA/-10
GODLTA/10
Repetitive Programming
YVAL = YVAL+30
IF (500 -YVAL) LB2, LB1, LB1
LB2) X=X + 50
IF (500 -X) LB3, LB, LB0
LB3) -----------
• MACRO
• Sequence of similar or identical statements which need to be
referred more often
<name >= MACRO/<parameters>
-----------
-----------
TERMAC
CAD/CAM Principles and Applications, PN Rao, TMH 69
Repetitive Programming
• All the statements that are enclosed between a MACRO
statement and a TERMAC statement are to be executed
whenever this macro is called by
CALL/name, <parameters>
• Should always end with TERMAC
Repetitive Programming
• Should always precede the first calling of that MACRO
• Should not contain another MACRO definition but can call
another MACRO which is already defined
• Maximum number of parameters in a given MACRO definition
depends on the type of implementation
• Parameters of a MACRO can be assigned values at the time of
calling or can be initialised (i.e., the default values) in the
definition itself
• FINI is not allowed in a MACRO definition
• Not allowed to label the first statement in the MACRO
definition which defines the name of the MACRO
CAD/CAM Principles and Applications, PN Rao, TMH 70
Repetitive Programming
• TRACUT
• To TRAnspose the CUTter locations only without actually
altering the original geometrical definitions
• Useful particularly for repetitive geometries
Repetitive Programming
TRACUT/matrix
--------------
--------------
TRACUT/NOMORE
• Not accumulative
• TRACUT/NOMORE cancels the present TRACUT
• Second TRACUT statement without NOMORE would also
cancel a previous transformation matrix
• Preferable to have an explicit NOMORE
• Care should be exercised in locating the cutter while moving
through a number of TRACUT statements
CAD/CAM Principles and Applications, PN Rao, TMH 71
APT program with geometry and motion statements
• Write a complete part program for the following
component shown using an end mill cutter of diameter
20 mm. Clearly show the axes system chosen with a
APT part program - Example
sketch and the direction of the cutter for the motion
statements.
CAD/CAM Principles and Applications, PN Rao, TMH 72
APT part program - Example Example 10
CAD/CAM Principles and Applications, PN Rao, TMH 73
Complete APT program
• Write a complete APT Program (geometric and motion
commands) to machine the outline of the geometry as
shown in figure. The component is 5 mm tick. The
APT part program - Example
milling tool used is 5 mm in diameter.
CAD/CAM Principles and Applications, PN Rao, TMH 74
APT part program - Example Complete APT program
CAD/CAM Principles and Applications, PN Rao, TMH 75
Bibliography
• P.N. Rao, "CAD/CAM Principles and Applications”, 3rd
Edition, Tata McGraw Hill, New Delhi, 2010
CAD/CAM Principles and Applications, PN Rao, TMH 76