```

Chapter 12

ENHANCEMENTS TO APT4

This chapter describes enhancements made to the APT4 system in versions
SSR2, SSV2, SSR3 and SSV3.

Without changing the existing Conditional Transfer the following

12.1.1 The Logical IF Statement

General form:

IF (logical expression) APT_statement

where S is any executable APT statement except a DO statement or
another IF statement.

The logical IF statement is used to evaluate the logical expression and
to execute or skip statement S depending on whether the value of the
expression is true or false, respectively.

A logical expression consists of:

a)  a single logical variable.

Logical variables are defined and remain logical when the value
.true. or .false. is assigned to.

Assignment:     LV =.TRUE.    or  	 LV = .FALSE.

IF - example:   IF (LV) APT-statement

b)  two arithmetic expressions combined with a relational operator

Relational Operator    Definition

.GT.	       greater than (>)
.GE.	       greater than or equal to (>)
.LT.	       less than (<)
.LE.	       less than or equal to (<)
.EQ.	       equal to (=)
.NE.	       not equal to (=/)

Relational operators may be used to compare two arithmetic
expressions.  The comparison can be either true or false.

Examples:

Assume that the variables A, B and C are of real type.

IF ((A-1.).GT.(2*B)) APT-Statement
IF (A.EQ.B)	  APT-Statement
IF(1.55.LT.(C**2.))  APT-Statement
IF(C.EQ.2.75.E-2)	  APT-Statement

c)  one or more logical expressions (logical variables, or
expressions containing relational operators; in the following
represented by A and B) combined with a logical operator.

Value of
Logical Operator       Use	A	B	Expression

.NOT.		       .NOT.A	TRUE	-	FALSE
FALSE	-	TRUE

.AND.		       A.AND.B	TRUE	TRUE	TRUE
TRUE	FALSE	FALSE
FALSE	TRUE	FALSE
FALSE	FALSE	FALSE

.OR.		       A.OR.B	TRUE	TRUE	TRUE
TRUE	FALSE	TRUE
FALSE	TRUE	TRUE
FALSE	FALSE	FALSE

The only valid sequences of two logical operators are
.AND..NOT. and .OR..NOT. ;

Examples:

Assume that the variables A, B and C are of real type and U,
V and W of logical type.

IF((A-1.).GT.B .OR.U.AND.V) 	APT-Statement
IF(U.OR.V.OR..NOT.W)   		APT-Statement
IF(C.GT.10.AND.B.EQ.(A-10))	APT-Statement

Order of Computations in Logical Expressions.

Operation	       			Hierarchy

Exponentiation (**)    			1st (highest)
Multiplication and division (* and/)	2nd
Addition and subtraction    (+ and-)	3rd
Relationals (.GT.,.GE.,.LT.,.EQ.,.NE.)	4th
.NOT.		       			5th
.AND.		       			6th
.OR.		       			7th

For example, the expression:

A.GT.D**B.AND..NOT.L.OR.N

is effectively evaluated in the following order:

1) D**B	     Call the result	 W    (exponentiation)
2) A.GT.W    Call the result	 X    (relational operator)
3) .NOT.L    Call the result	 Y    (highest logical
operator)
4) X.AND.Y   Call the result 	 Z    (2nd highest logical
operator)
5) Z.OR.N    Final operation

12.1.2 Use of logical IF in APT programs.

In the example of looping in chapter 6.4 of Volume 1 the radius R2 = 6.5
replaces radius R1 = 5 if A1 is equal to 10, 30 or 50.

(01)      R1 = 5
(02)      R2 = 6.5
(03)      A1 = 0
(04) ID1) RR = R1
(05)      IF(A1.EQ.10.OR.A1.EQ.30.OR.A1.EQ.50) RR = R2
(06)      X1 = RR*COSF(A1)
(07)      Y1 = RR*SINF(A1)
(08)      GOTO/X1,Y1,0
(09)      A1 = A1+10
(10)      IF(A1.LT.60)JUMPTO/ID1
(11)      GOTO/P2

An equivalent manner of writing of the statements (04), (05) and (10)
is:

(04) ID1) RR = R2
(05)      IF(A1.NE.10.AND.A1.NE.30.AND.A1.NE.50) RR =R1
(10)      IF(60.GT.A1)JUMPTO/ID1

12.1.3 The computed JUMPTO statement (new format)

General form:

JUMPTO/lb1,lb2,lb3,,,,,lbn,jmp

Where:

lbi are labels of executable statements in the program containing
the computed JUMPTO statement.

jmp is an integer variable which must be given a value before the
JUMPTO statement is executed.

This statement causes control to be transferred in the statement signed
(LB1), LB2), LB3,....., or LBN), depending on whether the current value
of JMP is 1, 2, 3, ........, or N, respectively.

If the value of JMP is outside the range 1 < JMP < N, the next statement
is executed

Restriction: The maximum of labels in a statement is 46, the minimum 2.

Example:
JUMPTO/LB,15,ID2,15,VBL
L11)	 A =7.5
.....
.....
15)	 A = B**2+A
.....
.....
LB)	 B= A-10
.....
.....
ID2)	 B = 10.3D-01

Explanation:

In this example statement LB) will be executed next, if the value of the
integer variable VBL is 1.  If VBL is equal to 2 or 4 statement 15) is
executed next, etc.  If VBL is less than 1 or greater than 4, statement
L11) is executed next.

12.2.1 The DO Statement (new format)

General form:

DO / lb1, index = v1,v2,v3

Where:

lbl   is the label of an executable statement appearing after the
DO statement in the program containing the DO.  It defines
the end of the DO LOOP.

index is an integer variable called the DO variable.

v1    Initial value assigned to INDEX at the start of the DO LOOP.

v2    Test value.  If INDEX exceeds the test value the DO LOOP is
finished.

v3    Increment to increase or decrease INDEX at each passage of
the loop.  V3 is optional.  If it is omitted (together with
the preceding comma) its value is assumed to be 1.

v1, v2 and v3 are integer constants or integer variables, the values of
which sould not exceed 2**31-1 or -2**31.

The example of looping in chapter 6.4 can now be written in the
following way:

R1 = 5		       R1 = 5
DO/ID1,A1=0,60,10	       DO/ID1,A1=0,60,10
X1 = R1*COSF(A1)	       X1 = R1*COSF(A1)
Y1 = R1*SINF(A1)	       Y1 = R1*SINF(A1)
ID1) GOTO/X1,Y1,0	       GOTO/X1,Y1,0
ID1) CONTIN

12.2.2 The CONTIN-Statement (new format)

CONTIN   ->   dummy statement

CONTIN (abbreviation of continue) is a statement that may be placed
anywhere in the part program without affecting the sequence of
execution.  It may be used to avoid ending the DO loop with a JUMPTO,
arithmetic IF, another DO statement or a logical IF statement.

12.2.3 Considerations and Restrictions in using a DO Loop

o   The indexing parameters of a DO statement (index,v1, v2, v3)
should not be changed by a statement within the range of the DO
loop.

o   There may be other DO statements within the range of a DO
statement.  All statements in the range of an inner DO must be
in the range of each outer DO.  A set of DO statements
satisfying this rule is called a nest of DO's.  It is possible
to nest maximally 10 DO loops.

DO/LB1,I=1,5,2 *------   -----*    DO/LB1,I=1,5,2
.............. 	       		 ...............
DO/LB1,J=1,10  +------   -----+	 DO/LB2,J=1,10
.............  	       		 ...............
.............  	       -----+ LB2)X=X+1
.............  	       		 ...............
LB1)CONTIN	     *+-----   -----* LB1)CONTIN

* range of outer DO      + range of inner DO

o   A transfer out of the range of any DO loop is permissible.

o   The extended range of a DO is defined as those statements that
are executed between the transfer out of the innermost DO of a
set of completely nested DO's and the transfer back into the
range of this innermost DO.

DO/LB1,I=1,5,2
..............
DO/LB1,J=1,10
IF(I.EQ.J)JUMPTO/OUT      ----->	 OUT)............
..............  	       		     ..............
IN) .............   	       <-----	     JUMPTO/IN
.............
LB1) CONTIN

o   Transfer into the range of a DO is permitted only if such a
transfer is from the extended range of a DO.
The indexing parameters (index,v1,v2,v3) cannot be changed in
the extended range of a DO.

o   A statement that is the end of the range of more than one DO
statement is within the innermost DO.

o   The last statement in the range of a DO loop must be an
executable statement or CONTIN.  It cannot be a JUMPTO
statement of any form, an arithmetic IF statement, another DO
statement or a logical IF statement.

12.3 Additional Arithmetic and Vector Expressions

12.3.1 Extended Number Definition

A FORTRAN-like definition of real numbers using E and D exponents is
included.

Example:

P1 = POINT/ .3D1,6.0E-01,-25.D-2

12.3.2 Vector Expressions

With two new operators for the vector dot product (.) and the vector
cross product (*) vector and points can be used in arithmetic
expressions or in new available vector expressions.

Examples:

R1 = V1 (.) V2
V3 = V1 (*) V2
V4 = R2  *  V3

with       Ri as real variables or constants and Vi as vector variables

ON
CANON/
OFF

CANON/ON causes the suppression of the TRANSLAT warning diagnostic 50
"GEOMETRIC VARIABLE BEING USED HAS BEEN PREVIOUSLY DEFINED WITH THE SAME
MODE.  FIRST DEFINITION DEFINITION OVERRIDDEN".

CANON/OFF cancels command CANON/ON and resores the initial setting.

The extended output (EXFILE) manipulation consists of
o   Output specification for various ARELEM output
o   Specification of EXFILE segments
o   Extraction of segment point count
o   Extraction of segment data for reuse in the same part program
o   Use of EXFILE segment data in the isoparametric milling with
GOLOFT.

The old CLDAT statement to switch APT3 or APT4 CLTAPE output ON or OFF.

3   ON
CLDAT/ x, 1, { , {
4   OFF

and to read previously created APT4 CLTAPE information

11
CLDAT/{  , 2,4 ›, rec1, rec2!
12

remain unchanged.

12.5.1 EXFILE output CLDAT definitions

CLDAT allows to specify which data is to be included in EXFILE for each
cutter location.

The available data types are:

TP	       x, y, z	 of   tool point
TA	       i, j, k	 of   tool axis
TV	       i, j, k	 of   tool travelling vector
PDS       x, y, z	 of   drive surface point
NDS       i, j, k	 of   drive surface normal
PPS       x, y, z	 of   part surface point
NPS       i, j, k	 of   part surface normal
UVPDS     u, v, p	      drive surface parametric values
UVPPS     u, v, p	      part surface parametric values

The TP and TA datatypes are identical with the existing CLDATA output
(TA in MULTAX/ON case).  These two types are the only ones which are
written onto APT-CLTAPEs.

TV, PDS, NDS, PPS and NPS can be used together with motion commands
which produce these informations.  UVPDS and PVPPS only have a meaning
if the surfaces involved are parametric.

The format of the output control CLDAT statement is the following:

CLDAT/ datatypes

All nine datatypes defined above are allowed in deliberate order.

CLDAT/NORMAL

switches back to the normal tool point and tool axis (MULTAX) output.

Nested datatype definitions are not allowed, i.e. a new definition can
only be given after CLDAT/NOMORE has been issued.

The additional output specification cannot be transformed to the
APT3-CLDATA format for postprocessing.  Therefore the APT3 output has to
be switched coding the following statement:

CLDAT/ 0,1,3, OFF

Using the APT4 CLTAPE standard for postprocessing these additional data
can be used.

12.5.2 EXFILE output segments

For retrieving EXFILE data from one or more cut sequences at any later
place in the part program the following segment definition statement can
be used:

START, id ›,datatypes!
CLDAT/
NOMORE, id

The resulting data from motion components between a CLDAT/START,.... and
a CLDAT/NOMORE statement can be retrieved later by using the identifier
'id' (see sections 12.5.3, 12.5.4).

'id' can be any number, real variable or real expression.

Nested segment definitions are not allowed.  Datatypes can be defined
optionally if they have not been defined before.

The CLDAT/START,... statement enhances the existing data extraction
feature which only allows to extract TP and TA from the most recent cut
sequence.

12.5.3 Additional CLDATA location count extraction

The format for determining the number of cutter location generated by
all motion statements within the identified CLDAT section is:

Variable name =NUMF(CLDATA,id)

where id is the identifier for one of the CLDAT sections previously
defined.  The statement may appear anywhere after the CLDAT/NOMORE,id
statement of the referenced section.  See example in chapter 12.5.5.
The NUMF (CLDATA) function to retrieve the location count of the most
recent cutter path is still available.

12.5.4 Additional Part Program Definitions with EXFILE Data

According to the datatypes described in 12.5.1 all EXFILE data can be
used for geometric and scalar assignments.

The format for defining a point with coordinates identical to a
specified cutter location or to a specified point on the drive or part
surface and generated within an indentical CLDAT section is:

TP
Variable name = POINT/CLDATA, id, PDS, n
PPS

where:
id	   integer identifier of the CLDAT section
TP	   point identical to cutter location
PDS	   point identical to point on drive surface
PPS	   point identical to point on part surface
n	   cutter location sequence number

The format for defining a vector with components identical to a
specified tool axis orientation, or motion vector or identical to a
specified normal of the drive or part surface and generated within an
identified CLDAT section is:

TA
Variable name = VECTOR/CLDATA, id, TV, n
NDS
NPS

where:
id	   integer identifier of the CLDAT section
TA	   vector identical to tool orientation vector
TV	   vector identical to tool motion vector
NDS	   vector identical to normal of drive surface
NPS	   vector identical to normal of part surface
n	   cutter location sequence number

The format for defining a scalar identical to a specified u - parameter,
v - parameter or patch number of a drive or a part surface within a
identified CLDAT section is:

UDS
Variable name = CLDAT(id, VDS, n)
PDS
UPS
VPS
PPS

where:

id	   integer identifier of the CLDAT section
UDS	   scalar identical to u-value of drive surface
VDS	   scalar identical to v-value of drive surface
PDS	   scalar identical to patch nr. of drive surface
UPS	   scalar identical to u-value of part surface
VPS	   scalar identical to v-value of part surface
PPS	   scalar identical to patch nr. of part surface
n	   cutter locations sequence number

12.5.5 Programming Example

PARTNO CLDAT TEST
......
(22)	   CLDAT/0,1,3,off
(23)	   CLDAT/START,100,PPS,TP,PDS	 \$\$ ONLY POINTS DEFINED
(24)	      TLRGT,GORGT/PLY,PLX	 \$\$ BLOCK 1
(25)	         N25=NUMF(CLDATA)
(26)	      GORGT/PLY,ON,PLZ
(27)	         N27=NUMF(CLDATA)
(28)	      TLON,GORGT/PLZ,ON,PLXX
(29)	         N29=NUMF(CLDATA)
(30)	   CLDAT/NOMORE,100
(31)	   CLDAT/0,1,3,OFF
......
(44)	   CLDAT/START,200,NDS,TV,NPS,TA \$\$ ONLY VECTORS DEFINED
(45)	       GOLFT/LBON,TO,JPL	 \$\$ BLOCK 2
(46)	       GOLFT/JPL,RBON
(47)	       GORGT/RBON,PLN
(48)	       GORGT/PLN,LBON
(49)	   CLDAT/NOMORE,200
......
(66)	   CLDAT/START,300,UVPPS,UVDPS	 \$\$ ONLY SCALARS DEFINED
(67)	      GO/C,S,Z			 \$\$ BLOCK 3
(68)	      GOUP/C,PAST,Z1
(69)	   CLDAT/NOMORE,300
(70)	      GOTO/SETPT
......
(105)	         N100=NUMF(CLDATA,100)	 \$\$ DATA RETRIEVING
(106)	         N200=NUMF(CLDATA,200)
(107)	         N300=NUMF(CLDATA,300)
(108)	   P1 = POINT/CLDATA,100,TP,1
(109)	   P2 = POINT/CLDATA,100,PDS,N100/2
(110)	   P3 = POINT/CLDATA,100,PPS,n100
(111)	         V1 =VECTOR/CLDATA,200,TA,1
(112)	         V2 =VECTOR/CLDATA,200,TA,N200
(113)	         V3 =VECTOR/CLDATA,200,NDS,2
(114)	         V4 =VECTOR/CLDATA,200,NPS,N200-1
(115)	   S1 = CLDATF(300,UDS,1)
(116)	   S2 = CLDATF(300,UPS,2)
(117)	   S3 = CLDATF(300,VDS,3)
(118)	   S4 = CLDATF(300,VPS,N300-2)
(119)	   S5 = CLDATF(300,PDS,N300-1)
(120)	   36 = CLDATF(300,PPS,N300)
......
FINI

To provide compatability with APT3 and to allow new features, the TLAXIS
statement has been enhanced as follows:

12.6.1 Existing /36OAPT and APT-AC language (APT3)

a,b,c
TLAXIS/
vector

NORMPS
TLAXIS/
NORMDS

TLAXIS/   1

1
TLAXIS/   PARLEL,
2

1       vector
TLAXIS/   ATANGL, ,alpha,
2       CUTANG,beta

12.6.2   Existing APT4 Language

TLAXIS/   a,b,c

NORMPS
TLAXIS/
NORMDS

1
TLAXIS/   PARLEL, ›,ra,hi!
2

x,y,z
TLAXIS/   a,b,ra,hi,gamma,     ,delta
i,j,k

12.6.3 New TLAXIS Language

All APT3 and APT4 formats are allowed together with the following

12.6.3.1 Additional Switch to 3-axis Mode

To maintain the last calculated cutter axis for all following motions
(3-axis)

TLAXIS/LAST

can be coded.

This statement has the same meaning as TLAXIS/1.

12.6.3.2 Additional Ruled Surface TLAXIS Definition

To define the ruled surface TLAXIS the following can be coded:

PS ›,ra,hi!
TLAXIS/PARLEL,

o PS and DS means part or drive surface control
o The radius and height information are optional and define a disk
cutter if a CUTTER statement has been issued before.  If only a
RADIUS,ra or HIGHT,hi information is given, the parameter which is not
given is calculated from the given CUTTER statement.

The full 4- and 5-axis TLAXIS statement can be coded as follows:

PS
DS

›  PERPTO,vector
ş
ş  	  plane
ş  PARLEL,
ş  	  line
ş,
ş  MOTDIR
ş
ş  	  › LAG	 › beta
ş  CUTANG ş,	 ş,

o ATANGL introduces the angle which the tool axis has to maintain with
the PS or DS geometry.
Note that the angle alpha is equal (180 - gamma) of the APT4-TLAXIS
statement (see 12.6.2).

o PS and DS means part and drive surface control.

o The radius and height information is optional and has the same meaning
as under 12.6.3.2.

o PERPTO,vector , PARLEL,line or PARLEL,plane signal a 4-axis case where
the tool axis has to maintain a 90 degree relation to a vector
(explicitly given vector or the plane-and line-nornal).

o MOTDIR means that the cutter axis has to be perpendicular to the
present motion direction.

o The CUTANG specifies the tool axis has to be perpendicular to the
motion direction.

If LEAD and LAG are omitted, the sign of beta is responsible for the
leaning direction of the tool axis:

Negative:	The tool axis leans to the motion direction;
Positive:	The tool axis leans back from the motion direction or, in
other words, the tool axis maintains an angle of (90+beta)
degrees with the motion direction.

LEAD and LAG can be coded to express the same tool axis constraint in
respect to a positive anlge beta.

AUTO is added for some not yet existing collision-related tool axis
control.