CHAPTER 9 OTHER PROGRAMMING FEATURES


This chapter describes a number of programming features, available in the sculptured surfaces system, which have not been covered elsewhere in this volume, or which have only been partially described in earlier chapters. They include, the definition of points and vectors from existing synthetic curves and sculptured surfaces, storing and retrieving canonical forms, selection of printout levels and the many trigonometric, mathematical, geometric and data extraction functions available.

9.1 DEFINITION OF POINTS AND VECTORS FROM PARAMETRIC

CURVES AND SURFACES

Provision is made in the sculptured surfaces processor for the definiton of points and vectors with respect to existing synthetic curves and sculptured surfaces, which can then be used in subsequent geometric definitions or for tool path computation. An example of this latter application is given in Section 7.4. The definitions can be divided into those relating to curves and those relating to surfaces, and into those defined by direct parametric reference and those which result from the intersection of geometric entities with the parametric geometry. These latter two categories are sometimes referred to as intrinsic (by parameter) and extrinsic (resulting from intersection) constructions. 269

9.1.1 BY PARAMETRIC REFERENCE FROM A SYNTHETIC CURVE

A point on a synthetic curve or one of the four associated vectors (TANSPL, CRSSPL, NORMAL or BINORM) at the point can be retrieved from a curve by parametric reference. The definition formats are, pname = POINT/INTOF,scurv,PARAM,u,n FLOW TANSPL vname = VECTOR/INTOF,scurv,PARAM,u,n,CRSSPL ,UNIT! FLOW NORMAL BINORM where pname symbolic name for point. vname symbolic name for vector. scurv symbolic name of a previously defined synthetic curve. PARAM indicates that the parametric values refer to the curve ARC structure, see Chapter 2. FLOW indicates that the parametric values refer to the segment FLOW structure of the curve, refer to Chapter 3. Note that FLOW can only be used if the curve has been defined with a FLOW structure. u parametric value. n integer identifying the arc or segment number. Refer to Chapters 2 and 3 for explanations of values of u and n. TANSPL tangent vector required. CRSSPL cross spline vector required. NORMAL normal vector required. BINORM binormal vector required. UNIT optional modifier indicating that the unit vector is required. 270
The vectors available at a point on a synthetic curve are explained in detail in Chapter 2 and Figure 1.4 shows the tangent, normal and binormal to a curve. The TANSPL and BINORM vectors are usually available at each point of a curve, but the BINORM may not be available if the curve is a straight line segment. The CRSSPL and NORMAL vectors are usually only available at the arc junctions where they have been input. However, for a FLOW structured curve, continuous CRSSPL vectors may be available between junctions at which CRSSPL vector constraints have been input. If there is a discontinuity between curve arcs, care should be taken when extracting the vectors at the junction. It is recommended that the arc number and parameter are explicitly specified in the definition rather than use the global parameter with n=0, in order to ensure that the required vector is obtained. 271
Figure 9.1 272

9.1.2 BY INTERSECTION OF A LINE OR PLANE WITH A

SYNTHETIC CURVE

The point of intersection of a synthetic curve with an APT line or plane can be defined. Also any of the four associated vectors at the point of intersection can be extracted. The definition formats are, pname = POINT/INTOF,aname,scurv,refpt. TANSPL vname = VECTOR/INTOF,aname,scurv,refpt,CRSSPL ,UNIT! NORMAL BINORM where pname symbolic name for point. aname symbolic name of a previously defined APT LINE or PLANE. scurv symbolic name of a previously defined synthetic curve. refpt symbolic name of a reference point near to the required point of intersection. This is used to distinguish between multiple intersections, the point closest to refpt being selected as shown in Figure 9.1. If two or more points satisfy this condition, the point with the lowest parametric value is chosen. A reference point must always be provided, even if only one solution is evident. TANSPL tangent vector. CRSSPL cross spline vector if available. NORMAL normal vector if available. BINORM binormal vector. UNIT unit vector required. 273

9.1.3 BY PARAMETRIC REFERENCE FROM A SCULPTURED SURFACE

A point on a sculptured surface or one of the three associated vectors (TANSPL, CRSSPL or NORMAL) at the point can be retrieved from a surface by parametric reference. The definition formats are pname = POINT/INTOF,ssurf,PARAM,u,v,pname TANSPL vname = VECTOR/INTOF,ssurf,PARAM,u,v,pname,CRSSPL ,UNIT! NORMAL where pname symbolic name of point. vname symbolic name of vector. ssurf symbolic name of previously defined sculptured surface. PARAM indicates that the point or vector is being defined by parametric reference. u parameter in tangent spline direction. v parameter in cross spline direction. pnum patch number in terms of the internal order of patches. pnum must be greater than or equal to zero. If pnum equals zero, then the surface is assumed to be a mesh structured surface and u and v are global mesh parameters. TANSPL tangent spline vector required. CRSSPL cross spline vector required. NORMAL surface normal required. UNIT optional modifier indicating that the unit vector is required. The user should be familiar with the internal layout of the patch structure, refer to Chapter 4, 5 and 6. 274
The surface vectors are briefly explained in Section 1.2.2 and Figure 1.5 shows their correspondence. Unless UNIT is specified the lengths of the vectors are equal to their natural length, as in the canonical form. Examples of using this type of point and vector definitions in the generation of cutter paths are given in Sections 7.4.1 and 7.4.2.

9.1.4 BY PROXIMITY TO A POINT AND ON A SCULPTURED SURFACE

The closest point on a sculptured surface to a specified point or one of the three surface vectors can be defined. The definition formats are, pname = POINT/INTOF,ssurf,pt TANSPL vname = VECTOR/INTOF,ssurf,pt,CRSSPL ,UNIT! NORMAL where pname symbolic name of point. vname symbolic name of vector. ssurf symbolic name of previously defined sculptured surface. pt symbolic name of the point in the proximity of which the point or vector is to be constructed. TANSPL tangent spline vector at closest point. CRSSPL surface normal at closest point. UNIT optional modifier indicating that unit vector is required. 275

9.1.5 BY INTERSECTION OF A SPACE LINE DEFINED BY TWO POINTS

AND A SCULPTURED SURFACE

The point and its associated surface vectors which is the intersection of a space line defined by two points and a sculptured surface can be defined. The formats are, pname = POINT/INTOF,ssurf,pt1,pt2 TANSPL vname = VECTOR/INTOF,ssurf,pt1,pt2,CRSSPL ,UNIT! NORMAL where pname symbolic name of point. vname symbolic name of vector. ssurf symbolic name of previously defined sculptured surface. pt1,pt2 symbolic names of two points which define the space line to be inter- sected with the sculptured surface. TANSPL tangent spline vector. CRSSPL cross spline vector. NORMAL surface normal vector. UNIT optional modifier indicating that unit vector is required. 276

9.1.6 BY INTERSECTION OF A SPACE LINE DEFINED BY A VECTOR

AND A POINT AND A SCULPTURED SURFACE

The point of intersection and its associated surface vectors of a space line specified by a point and vector and a sculptured surface can be defined. The formats are, pname = POINT/INTOF,ssurf,pt,v ,refpt! TANSPL vname = VECTOR/INTOF,ssurf,pt,v ,refpt!,CRSSPL ,UNIT! NORMAL where pname symbolic name of point. symbolic name of vector. ssurf symbolic name of previously defined sculptured surface. pt,v symbolic name of point and vector defining the space line to be inter- sected with the sculptured surface. refpt optional reference point which may be necessary to distinguish between multiple intersections. TANSPL tangent spline vector. CRSSPL cross spline vector. NORMAL surface normal vector. UNIT optional modifier indicating that unit vector is required. 277

9.2 STORING AND RETRIEVING CANONICAL FORMS OF LARGE

DATA ARRAY SURFACES

There are two basic methods of storing and retrieving canonical forms of large data array surfaces (TABCYL, RLDSRF, PATERN, SCURV and SSURF). The first is to output the canonical form as card images to the card punch or the file assigned to receive card punch output. These can then be either physically inserted into the new part program deck, or read into the part program by a segment read from the assigned file. The second is to output the canonical forms in internal format to named permanent files for future retrieval. The format of these files is system dependent, as is the manner to which they are named and referenced by the system. In both cases the canonical forms are stored by the PUNCH command and retrieved by the READ command. For card image output, the standard form of the APT PUNCH command should be used, e.g. PUNCH/1,SS1 to punch or store sculptured surface SS1 PUNCH/SS1,SS2 to punch or store sculptured surfaces SS1 and SS2. PUNCH/ALL to punch or store all canonical forms. Refer to Volume 1 for any additional information and to implementation/installation documentation for details of file assignment and naming. Canonical forms stored as card images on file can be read into a part program by the command, READ/name where name references the file on which the part program segment is stored. Refer to implementation/installation documentation for details. 278
To store the canonical forms in internal format, which is generally more compact, the following form of the PUNCH command should be used PUNCH/RANDOM,name 1,name 2,... RETAIN where RANDOM indicates that an existing canonical form on file with the same name will be over- written with the new version. RETAIN indicates that only new canonical forms will be stored, thus avoiding over- writing existing versions. name 1, name 2,... names of canonical forms to be stored. The filenames generated by the system will be installation dependent but will reference the surface name. Subscripted names can be used and the system will automatically generate file names which append the subscript to the surface name. Inclusive definitions, such as P(ALL) are allowed. Canonical forms stored in this manner can be retrieved by the command READ/1,name 1,name 2. 279

9.3 PRINTOUT CONTROL

The type of information printed on the verification listing as a result of TABCYL, SCURV and SSURF definitions can be controlled by the PRINT command. TABPRT PRINT/ SSPRT , ON SSTEST OFF LIBPRT where ON indicates that the type of verification point is required. OFF inhibits the type of verification listing. TABPRT TABCYL verification listing DEFAULT : ON SSPRT sculptured surface and synthetic curve verification listing DEFAULT : ON Note: If a surface or curve is read in by READ/1,.... a verification listing is printed if SSPRT,ON. SSTEST additional sculptured surface and synthetic curve verification DEFAULT : OFF SSPRT must be ON for SSTEST,ON to be effective. LIBPRT listing of part program statements read from file by a part program segment read, READ/segname. DEFAULT : OFF. 280

9.4 FUNCTIONS

The sculptured surfaces processor provides many trigonometric, mathematical, geometric and data extraction functions, in addition to those described in Volume 1. All functions allowable in APT4 and sculptured surfaces are described in the following subsections. A function can be used wherever a scalar value is allowed. e.g. P1 = POINT/(R * COSF(A)), (R * SINF(A)), z Functions can be nested. e.g. B = SQRT(ABSF(COSF(A))). A nested definition can be used as a geometric argument of a function. e.g. A = ANGLF(C1,(POINT/3,5,0))

9.4.1 TRIGONOMETRIC FUNCTIONS

Trigonometric functions can refer to angles either in terms of degrees or radials. The last letter of the function name indicates whether the angular argument or result is in degrees or radians. F : degrees B : radians The following is a list of available trigonometric functions SINF(A) SINB(A) sine of angle A COSF(A) COSB(A) cosine of angle A TANF(A) TANB(A) tangent of angle A - COTANF(A) COTANB(A) cotangent of angle A ARSINF(X) ARSINB(X) arc sine of X ARCOSF(X) ARCOSB(X) arc cosine of X ATANF(X) ATANB(X) arc tangent of X ATAN2F(X,Y) ATAN2F(X,Y) arc tangent of X/Y 281

9.4.2 MATHEMATICAL FUNCTIONS

The following mathematical functions are available ABSF(x) absolute value of x SQRTF(x) square root of x EXPF(x) exponent function e LOGF(x) natural logarithm log x LOG10F(x) decade logarithm log x SINHF(x) hyperbolic sine COSHF(x) hyperbolic cosine TANHF(x) hyperbolic tangent MINF(x1,x2,x3,...) minimum function - finds the minimum value of up to 99 arguments MAXF(x1,x2,x3,...) maximum function - finds the maximum value of up to 99 arguments MODF(x1,x2) module function = x1 - int part of x2 INTF(x) integer function, truncation SIGNF(x1,x2) transfer of sign = (sign of x2) * x1 282

9.4.3 GEOMETRIC FUNCTIONS

The following geometric functions are available. DOTF(v1,v2) dot product (scalar product) of two vectors. LNTHF(name) length function, finds the length of a vector. The argument can be a VECTOR,LINE,PLANE or a POINT or point containing geometry (CIRCLE,CYLNDR,SPHERE, CONE) in which case the distance to the origin is calculated. Calculations are done in the base coordinate system, that is REFSYS does not apply. ANGLF(name 1,name 2) angle function in degrees. In 2D: the arguments can be points or point containing geometry (CIRCLE,CYLNDR,SPHERE, CONE). The points are projected onto the XY plane and the angle between the positive x-axis and the line defined by the two points is calculated. In 3D: the input arguments are vectors or vector containining geometry (LINE,PLANE) and the angle between the vectors is calculated. In both cases REFSYS does not apply. ANGLB(name 1,name 2) same as ANGLF but angle is returned in radians. DISTF(name 1,name 2) distance between, two parallel planes, two points, a point and a plane. The distance between 2 points or 2 planes is always positive. The distance between a point and a plane is positive if the point is on the same side of the plane as the normal and negative if it is on the opposite side. 283
SPATF(v1,v2,v3) vector volume, calculates the volume determined by 3 vectors, v1,v2,v3. The result is positive if the vectors follow the right hand rule, otherwise negative. Instead of a vector a LINE or PLANE can be used, or points (POINT), or point containing geometry (CIRCLE,CYLNDR,SPHERE, CONE).

9.4.4 DATA EXTRACTION FUNCTIONS

There are three data extraction functions available, PARMF, NUMF and CANF. PARMF provides the means of extracting the parametric coordinates of the point which was the result of the immediately preceding extrinsic geometric construction. NUMF provides means of extracting size data from the canonical form of curves and surfaces in addition to its normal use for extracting the number of points in a PATERN or CLDATA record. CANF provides means of extracting values from the canonical form of synthetic curves and sculptured surfaces. The format for PARMF as a curve extraction function is: Par = PARMF(cname ,PARAM!) FLOW where Par Variable name for extracted parameter. cname Symbolic name for previously defined curve. PARAM Specifies natural parameter for curve. FLOW With this option Par is set to the FLOW parameter value. PARAM or FLOW may be omitted from this statement in which case the default option of PARAM is selected. Note that this statement can only be used after a particular point on a curve has been identified by means of an extrinsic geometric construction via the INTOF facility. 284
Example: P1 = POINT/INTOF,PLAN2,CURV1,P0 PAR1 = PARMF(CURV1,PARAM) In this example PLAN2 is a previously defined APT plane, CURV1 is a previously defined SCURV and P0 is a reference point. P1 is then defined as the point of intersection between PLAN2 and CURV1 closest to P0. PAR1 is given the value of the natural parameter of CURV1 at P1. The format for PARMF as a surface extraction function is: PATCH Par = PARMF ( sname , UPARAM ) VPARAM where sname Symbolic name for previously defined SSURF. PATCH PATCH number required as value for Par. UPARAM u parameter required. VPARAM v parameter required. If PATCH,UPARAM or VPARAM are omitted the default option of PATCH is selected. Once more the use of this function is only valid after an extrinsic geometric construction. Example: P2 = POINT/INTOF,SURF2,P3,P4 PAR2V = PARMF(SURF2,VPARAM) In this example it is assumed that SURF2 is the name of a previously defined sculptured surface and P3 and P4 are points. P2 is first defined as the point of intersection between the line joining P3 and P4 and SURF2. PAR2V is then given the value of the v parameter of P2 on SURF2. 285
The NUMF function returns numerical data values which relate to the entire curve or surface. As a curve number extraction function the format is N = NUMF ( cname , ARC ) SEG N is defined as the number of arcs or segments on the curve. cname symbolic name for a previously defined SCURV ARC or SEG may be omitted in which case the default option gives N as the number of segments. As a surface number extraction function the format is: PATCH N = NUMF ( sname , SPLINE ) CRSSPL where sname symbolic name for previously defined sculptured surface. N Integer variable equal to the number of patches, splines or cross-splines on the surface according to the option selected. If PATCH,SPLINE or CRSSPL are omitted the default option returns N as the number of patches. NA = NUMF(CURV1,ARC) NSEG = NUMF(CURV1,SEG) N2 = NUMF(SURF2) NC = NUMF(SURF2,CRSSPL) NA is the number of arcs on CURV1 NSEG is the number of segments on CURV1 N2 is the number of patches (default option) on SURF2 NC is the number of cross splines (v parametric curves) on SURF2 286
The function CANF provides for the extraction of values, referenced by position, from the canonical form of a geometric entity. For parametric curves (SCURVs) and sculptured surfaces (SSURFs) the number of elements in their canonical form varies according to type and number of arcs or patches. For other geometric entities the number of elements is given in the table below. The format for CANF is vname = CANF(ipos,gname) where vname variable name returns value extracted from canonical form ipos a positive integer specifying position in canonical form of extracted value gname symbolic name for previously defined geometric entity. Example: P1 = POINT/1.2,2.3,-1.7 YP = CANF(2,P1) In these statements YP is given the value of the second element in the canonical form of the point P1. Thus YP = 2.3 in this case. Note that under REFSYS the geometry is transformed to the local coordinate system before extraction by CANF. Geometic Entity Number of Elements LINE 4 PLANE 4 CYLNDR 7 CIRCLE 7 SPHERE 4 HYPERB 10 LCONIC 10 ELLIPS 10 CONE 7 GCONIC 10 QADRIC 10 MATRIX 12 POINT 3 VECTOR 3 287
288