4 Computer Aided Part Programming
4 Computer Aided Part Programming
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
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:
• Maximum table or spindle traverses,
Concept of CAP
4
Functions of Post processor
• Provide output
• Required control tape.
• Diagnostic listing on line printer, and
• Other operator/programmer instructions.
Concept of CAP
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
APT Language
right are the words, symbols and/or scalars that modify the word on the left of the slash. 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., C1 = 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.
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
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
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
APT Language
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
10
APT Language Structure
• Arithmetic APT
Addition +
Subtraction –
Multiplication *
Division /
APT Language
Exponentiation **
• 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
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
13
Geometry Commands
• Part geometry is normally broken into a number of surface elements
• POINT, LINE, CIRCLE, PLANE, VECTOR, PATERN, SPHERE, GCONIC, TABCYL, etc.
• Rules for defining general form of surface elements
Geometry Commands
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
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
Geometry Commands
• By Rectangular Coordinates
<symbol> = POINT/ x, y, z
P1 = POINT/75.0, 70.0
P1A = POINT/55.0, 70.0, 85.0
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
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
19
Line Definitions
• Considered to be of infinite length and do not have a direction
• By Two Point Symbols or Rectangular Coordinates of Points
<symbol> = LINE/ x1, y1, z1, x2, y2, z2
Geometry Commands
20
Line Definitions
• As One of the Coordinate Axis
𝑋𝐴𝑋𝐼𝑆
<symbol>= LINE/
𝑌𝐴𝑋𝐼𝑆
L3 = LINE/ XAXIS
Geometry Commands
21
Line Definitions
• By a Parallel Line at a Distance
𝑋𝑆𝑀𝐴𝐿𝐿
𝑋𝐿𝐴𝑅𝐺𝐸
<symbol> = LINE/PARLEL, line2, , distance
𝑌𝑆𝑀𝐴𝐿𝐿
Geometry Commands
𝑌𝐿𝐴𝑅𝐺𝐸
L5 = LINE/PARLEL, LA1, YSMALL, 40
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
24
Circle Definitions
• By Three Points on the Circumferences
<symbol> = CIRCLE/ point1, point2, point3
No two points should coincide
The three points must not be collinear
Geometry Commands
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
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
27
Circle Definitions
• By Two Tangential Circles and Radius
𝑋𝑆𝑀𝐴𝐿𝐿
𝑋𝐿𝐴𝑅𝐺𝐸 𝐼𝑁 𝐼𝑁
<symbol> = CRCLE/ , , circ1, , circ2, RADIUS, rad1
𝑌𝑆𝑀𝐴𝐿𝐿 𝑂𝑈𝑇 𝑂𝑈𝑇
Geometry Commands
𝑌𝐿𝐴𝑅𝐺𝐸
IN and OUT allows the selection of the considered circle by indicating the mode of tangency
between the two circles.
𝑌𝐿𝐴𝑅𝐺𝐸 𝑌𝐿𝐴𝑅𝐺𝐸
29
Vector Definitions
• Both magnitude and direction
• Often used to specify the direction in geometry application and the motion
of the cutter
Geometry Commands
• By x, y, z Componentes
<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
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
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
PL3A = PLANE/ 0, 0, 0, 49
Geometry Commands
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
33
Pattern Definitions
• Linear Pattern by the First, Last and Number of
Points
<symbol> = PATERN/ LINEAR, point1, point2, number
PAT1 = PATERN/ LINEAR, PT1, PT2, 7
Geometry Commands
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
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
Geometry Commands
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
Geometry Commands
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
• 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
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 in the new system.
Geometry Commands
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
39
Matrix Definitions
• Rotation and Translation
𝑋𝑌𝑅𝑂𝑇
<symbol> = MATRIX/ 𝑌𝑍𝑅𝑂𝑇 , angel1,
𝑍𝑋𝑅𝑂𝑇
Geometry Commands
40
Example 1 for APT geometry definition
PARTNO/ EXAMPLE 16.1 FIG. 16.24
P2 = POINT/ 20, 20
L1 = LINE/ 20, 20, 20, (20 + 80)
Geometry Commands
41
Example 2 for APT geometry definition
PARTNO/ EXAMPLE 16.2 FIG. 16.25
L4 = LINE / XAXIS
C1 = CIRCLE/ 24, 20, 12.5
Geometry Commands