Copyright: Copyright 2001 CADKEY Corporation


CADL Contents

The following Help Topics are available.

Getting Started

Functions

Types

System Variables

CADL Control Statements

CADL Compiler

CADL Converter

Sample CADL Programs

 For Help on Help, Press F1
 Help file built: 10/14/03d


CADL Compiler

CADLComp Files

Compiler Directives

Introduction to CadlComp

Loop Statements

Using CadlComp


CADL control statements

This section describes, in general, some of the basic control Statements available in a CADL program.  For specifics on any of the described commands see the description in the Functions section.

Branching and Looping with Labels

Calling External Programs or System Processes

Compiler-Specific Control Statements

Exiting a CADL program

Program Branching

Program Control Statements

Suspending CADL Execution


CADL Converter

CADL programs from versions prior to GraphX20 need to be converted to the new CADL language.  To assist in converting these programs, the program CadlConverter.exe is included in the CADL directory.

To run the converter from Explorer, go to the CADL sub-directory, of your CADKEY install directory.  Find the file "CadlConverter.exe" and double-click to run.

To run from the command line, change directories to the CADL sub-directory of your CADKEY install directory.  Type "cadlconverter.exe" at the command prompt.

The Converter starts with a file selection dialog from which you can browse to the directory and file(s) that you want to convert.  You can select multiple files to be converted at the same time.  The original file is not changed, but rather a new file with the same name and appends "_conv" to the filename so you can tell which is the new and which is the original file.

After the converter is done you will need to go through the program to make any needed changes according to the new CADL language.  The converter inserts lines near functions that it knows you will want to look at and update.  The inserted line is:

// CONVERSION TIP ///////////////////////////////////////////////////

When you see this in the converted CADL file you will need to make adjustments. Please keep in mind that these are not the only areas that may need adjustment.  The Converter is a tool to help you move the programs from one generation if CADKEY products to the next.  Please use it accordingly.


Functions

#DEFINE

#ELSE

#ENDIF

#IFDEF

#IFNDEF

#INCLUDE

#UNDEF

ABORT

abs(x)

acos(x)

ADDBASEDIM

ADDCOMPOSITE

ADDCOP

ADDCPLANE

ADDDISPVIEW

ADDGEOTOLLDR

ADDLABELLDR

ALONGENT

ANGDIM

ARC

ARCFROM2PNTRAD

ARCTANPOINT

ARCTHREEPOINTS

ARRAY

asin(x)

atan(x)

atan2(y,x)

ATAN3

AUTO

BASEDIM

BUILDWORLDMATRIX

cadl_execute

cadl_execute_file

CDECLOSE

CDEOPEN

ceil(x)

CENTERLINE

CHAIN

CHAMFDIM

CIRCLE

CIRCLE2TANPOINTRAD

CIRCLE3TANPT

CIRDIM

CLEAR

CLEARSEL

CLOSE

COMPOSITE

CONIC

CONTINUE

copsize(type)

cos(x)

cosh(x)

CPlaneToWorld

CROSSPROD

DATUM

DBLSCL

DEFATTR

DELENT

Distance

dms(d, m, s)

DOSUB

DOTPROD

DO…WHILE

ENDPOINTS

ENTINFO

ENTLENGTH

ENTLEVEL

EVALUATEENT

EXEC

EXIT

EXITLOOP

exp(x)

EXPORTPART

EXTENDLINE

floor(x)

fmod(x, y)

FNOTE

FOR

GENDIM

GENSEL

GEOTOL

GET

GETALL

GetAxisAngle

GETCPLANE

GETCUR

GETDBL

GETDISPVIEW

GETENT

GETENTID

GETENTM

GETENTXY

GETGROUP

GETINT

GETKEY

GETLEVELNUMBER

GETLSTYLE

GETLWIDTH

GETMENU

GETNEXT

GETPATH

GETPLANE

GETPOS

GETPROJECTIONMATRIX

GETSTR

GOTO

HALF

HCOPY

hypot(x,y)

IF

IF--ELSE IF--ELSE

IMPORTPART

INPUT

INTERSECT

Intersect

LABEL

LASTENT

LEADER

LEADERWIT

LEVEL

LEVELFROMNAME

LEVELMOD

LINDIM

LINE

LINETANPERP

LoadDimFile

LOADPART

LOCAL

LOCATION

LOCATIONCOORD

log(x)

log10(x)

macro_play

MASKCLEAR

MASKCOLOR

MASKENTITY

MASKLSTYLE

MASKLWIDTH

MASKPEN

MATRIX

MATRIXA

MATROTATE

NEARPOINT

NEWPART

NOTE

NoteState

NURBSCTRLPNTS

NURBSFITPNTS

ON GOTO

PALETTE

PANDOWN

PANLEFT

PANRIGHT

PANUP

PAUSE

POINT

POLYLINE

pow(a, b)

PRINT

PROJECT

PROMPT

READ

REDO

REDRAW

REGISTERPATH

REM

ROTATE2DAXIS

ROTATE2DAXISOFFSET

ROTATECCW

ROTATECW

ROTATEDOWN

ROTATELEFT

ROTATERIGHT

ROTATEUP

SAVECPLANE

SaveDimFile

SAVEDISPVIEW

SAVEPART

SCALE

SET

SETATTR

SETCPLANE

SETDIMFONT

SETDIMFONT

SETDIMLABEL

SETDISPVIEW

SETDUALLABEL

SETGEOTOL

SETGEOTOLDATUM

SETGEOTOLFRAME

SETGEOTOLFRAMEDATUM

SETGEOTOLLEADERS

SETLEVEL

SETLEVELNUMBER

SETNOTE

SETPATH

SETPREFIX

SETSTDPROPFILE

SETSTDPROPPART

SETSUFFIX

SETUSERPROPFILE

SETUSERPROPPART

sin(x)

sinh(x)

sizeof(xxx)

SPLINE

SPRINT

sqrt(x)

SURFACETEXTURE

SURFTEXTADDARROW

SWITCH

tan(x)

tanh(x)

UNDO

UNREGISTERPATH

UpdateDetailEnts

VECTORMULTIPLY

WAIT

WHILE

WINDOW

WITNESS

WorldToCPlane

WRITE

XHATCH

ZOOM


Getting Started

A CADL program file may be generated using a text editor or word processing program under the rules defined in this guide. Names for these files follow the same specifications as the system's naming convention, along with the addition of an extension. Specific extensions are discussed in their respective sections of this guide.

To execute a CADL file in CADKEY, use the Add-Ins > CADL Execute option.

If an error is detected, CADL file processing halts and an error message is displayed.

A typical CADL file consists of variable length records delimited by newlines. Each of these statements directs the flow of the program. A typical statement represents either a primitive, command or expression, along with any required parameters. Please refer to the Functions section of this guide for detailed information on primitives, program control statements and commands.

CADL Expressions

The purpose of an expression is to evaluate a mathematical statement and optionally store the results in a variable. Refer to Register Variables, found in this section, for an explanation of the different types of variables offered by the system.

For example:

POINT (2.0+a), 3.0, (a*b)

describes a POINT primitive with an x value assigned the results of 2 plus the numeric value of a, a y value of 3, and a z value assigned the results of a times b.

Note that in a CADL program, an expression terminates at the end of a line unless a backslash(\) is found. When this is the case, the command is continued on the following line. For example:

n = sqrt(a*b)+\
 sin(angle)*2*\
 (x+y+z)

This equation is evaluated as n = sqrt(a*b)+sin(angle)*2*(x+y+z). The backslash (\) must be the last character in the line, immediately preceding the newline.

The following rules apply to CADL expressions. There are three types of constants, as listed below.

Integer Constants

A decimal integer is a sequence of digits 0 - 9. If the first digit is a 0, the integer is taken as an octal (base 8) value.  In this case only digits 0 - 7 are valid.  If the sequence is preceded by the prefix 0x or 0X, the integer is taken as a hexadecimal (base 16) value. In addition to 0 - 9, hexadecimal digits also include the characters a-f (upper or lower case) corresponding to the values 10 - 15 respectively.

Float Constants

A float constant consists of a signed integer part, a decimal point, a fractional part, an E (or e), and a signed integer exponent. Either the integer part or the fractional part may be omitted, but not both. Either the decimal point or the E (or e) with exponent may be omitted, but not both.

String Constants

A string constant is a sequence of characters enclosed in quotes, such as "this is a string".  All strings are treated as an array of characters and are automatically terminated by the null character (ASCII value 0). Thus, the string "hello" actually contains six characters.  A special character sequence is provided to denote control characters and characters outside of the ASCII range. The sequence is signaled by a backslash (\) character. When detected, the next character is interpreted as shown below. For characters not listed, the character itself is used.  This provides a way of entering characters which normally have a special meaning (e.g., use \ for the \ character, \" for ", etc.)
 	\b	backspace
 	\f	formfeed
 	\n	newline
 	\r	carriage return
 	\t	tab

In addition to the above characters, an octal value may be entered by following the \ character with a three digit octal number (e.g., \263).

Also, a hexadecimal value may be entered by following the \ character with the character x and two hexadecimal digits (e.g., \x85). For an octal value the permissible range is \000 - \377; for a hexadecimal the range is \x00 - \xff.

Most of the operators recognized by the expression evaluator are equivalent to their counterparts in the 'C' programming language. The list is as follows:

Math Operators

a + b           	addition
 	a - b           	subtraction
 	a * b           	multiplication
 	a / b           	division
 	a ^ n           	nth power of a
 	(a)             	precedence
 	a[n]            	array index
 	-a              	negative a
 	+a              	positive a
 	a % b           	a (integer) modulus b
 	xxx = b         	numeric

Variable Assignment

$msg="hello"            	string variable assignment
 	$$msg[x] = "world"      	slist element assignment
 	a=1.5                   	double floating point assignment
 	b=1                     	integer (stored as double) assignment

Logical Operators

a == b          	equal comparison
 	a != b          	not equal comparison
 	a > b        	greater than comparison
 	a < b        	less than comparison
 	a >= b       	greater than or equal to comparison
 	a <= b       	less than or equal to comparison
 	a && b          	AND operation
 	a || b        	OR operation
 	(a) ? x : y     	conditional

Bitwise Operators

a | b      	a ORed with b
 	a & b           	a ANDed with b
 	a # b           	a XORed with b
 	a >> b        	a shifted right by count of b
 	a << b        	a shifted left by count of b
 	~a              	complement

Algebraic operations are prioritized, as with most programming languages. The precedence of operators, listed below, is grouped by operator type. The group header indicates whether the operators are processed from left to right or vice versa.  The list is arranged from higher to lower precedence with operators on the same line having equal precedence. Note that ' (feet) and " (inches) are actually special unary operators.

Primary-expression operators (left->right)
 	()     	[]
 	functions (cos, sqrt, sizeof, etc.)
 	Unary operators  (right->left)
 	+      	-      	~
 	Binary operators (left->right)
 	^
 	*      	/      	%
 	+      	-
 	>>   	<<
 	<   	>   	<=  	>=
 	==     	!=
 	&
 	#
 	|
 	&&
 	||
 	?:
 	Assignment operator (right -> left)
 	=

Example

Simple Equation

Statement:

      x = 4 / 10 * @PI + cos(45)

Result:

      variable x is assigned the value 1.963744

Embedded Assignments

Statement:

      x = (y = 23 / 5) + (z = @depth)

      (where @depth = 0)

Results:

      variable x is assigned the value 4.6

      variable y is assigned the value 4.6

      variable z is assigned the value of system variable

      <at>depth which, in this case, equals zero.

String Assignment

Statement:

     $msg = "Hello"

Results:

     The string variable $msg is created with an array size of 6

     and contains the characters "Hello" followed by a null

     terminating character.  This is equivalent to the statement:

     array $msg[6] = {72, 101, 108, 108, 111, 0}

Register Variables

Variables may substitute a constant numeric value anywhere in a CADL program file (e.g., primitives, commands or expressions), including when specifying an array size.

There are two types of variables offered, a variable set by the user, and a system variable maintained and updated by the system.

Rules for Register Variables

1)      The system register database recognizes and stores floating point (double precision) numeric values only, even if an integer constant was initially assigned.

2)      Variables may be assigned a name consisting of any number of characters, however only the first eight are used (any extra characters are ignored). The first character of a variable name must begin with an alpha character. The remaining characters may be any combination of alphanumeric and underscore (_) characters. Upper and lower case differences are observed.

3)      Arrays may be used if they have been previously initialized with the ARRAY statement.

4)      The maximum number of variables which may be assigned at one time is definable using the configuration program. An arrayname counts as one variable name.

5)      A number of reserved variables are maintained and updated by the system. They are accessible through CADL as read-only.  These variables must always begin with the @ character. System variables are case insensitive.

CADL and the Undo/Redo System

CADL programs are responsible for managing their own interactions with the Undo/Redo system in CADKEY.  The NoteState command notes a state in the database.  This should be used after an action that causes the database to be altered.  Geometric entities that are created in may not display until a NoteState command has been issued.  This should be used after a complete set of actions that should be considered a single action from the user's perspective.  For example, a CADL program that created a rectangle would use NoteState once after creating all four lines, not after each line.

Mixing geometry creation and user interaction commands in a single state can lead to problems.  If a CADL program creates geometry, then without using NoteState, stops to ask the user to indicate a position, for example, and the user uses an immediate mode command that creates a state, such as deleting an entity, that geometry creation will become part of the state for the immediate command.

The view manipulation commands and most of the SET commands are not part of the undo system, and so do not require a NoteState.  Changing the units of the part does require a NoteState, because of where the data is stored and because all dimensions in the part have to be updated to the new units.


Sample CADL programs

The sample CADL files described here are provided to show the application of some of the CADL commands.  Each command is described in detail in the Functions section of this help manual.

Reading from a datafile


System Variables

@color

@const

@cplane

@cplanemat[16]

@dbldat

@depth

@dimasp

@dimfill

@dimfont

@dimht

@diminfo1

@diminfo2

@dimslnt

@dispview

@dispviewmat[16]

@entatt

@error

@font

@intdat

@key

@ldrln

@level

@ltype

@lwidth

@matrix

@noteang

@noteatt

@notefill

@notefont

@noteht

@noteline

@noteslnt

@noteuln

@nread

@numdbl

@numint

@numstr

@numvp

@palb

@palg

@palr

@pen

@pi

@pi05

@pi10

@pi15

@pi20

@refarc

@refln

@scale

@selpval

@selSNum

@strdat

@txtasp

@txtatt

@units

@userscale

@vwwld

@witln

@xcplane

@xcursor

@xinput

@xmax

@xmin

@xview

@xworld

@ycplane

@ycursor

@yinput

@ymax

@ymin

@yview

@yworld

@zcplane

@zinput

@zview

@zworld

CADL Data Types

Entity Information

Math and Logical Functions

Math and Logical Operators


Types

CHAR

DOUBLE

FLOAT

HDRAWINST

HENTITY

HLAYOUT

HLEVEL

HLOCATION

INT

LONG

SHORT

SLIST

STRING

UCHAR

UINT

ULONG

USHORT


@color

Current entity drawing color


@const

Current system status of 2D/3D construction switch


@cplane

Current construction view number


@cplanemat[16]

Current construction view matrix


@dbldat

Information about the last selected entity. See Entity Information for details


@depth

Current Cepth setting


@dimasp

Current system text aspect ratio for dimensions


@dimfill

Current dimension text fill mode


@dimfont

Name of the current dimension font


@dimht

Current system text height for dimensions


@diminfo1

This is an array of flag settings and integer values that are used by some CADL functions to return and accept integer data for a dimension entity.

diminfo1[0]

Dimension modifier.  Describes the design intent of the dimension and describes a prefix that appears between the user-specified prefix and the text of the dimension

0 	No Modifier, standard dimension

1 	Diameter

2 	Spherical Diameter

3 	Radius

4 	Spherical Radius

5 	Controlled Radius

6 	Square

7 	Arc Length

8 	Plate Thickness

diminfo1[1]

Witness Style

0 	both witnesses are shown

1 	only the first witness is shown

2 	only the second witness is shown

3 	neither witness is shown

diminfo1[2]

Leader line style

0 	show both leader lines

1 	show first leader lines

2 	show second leader lines

3 	show neither leader lines

4 	solid leader line

5 	first leader line solid

6 	second leader line  solid

7 	no arrowheads

diminfo1[3]

Direction of arrows

0 	Arrows in

1 	Arrows out

2 	Arrows auto

diminfo1[4]

Dimension units representation

0 	Decimal

1 	Fractional

2 	Feet and inches

3 	degrees

4 	degrees minutes seconds

5 	Radians

6 	Gradians

diminfo1[5]

Dimension Units

0 	Inches

1 	millimeters

2 	Feet

3 	centimeters

4 	Yards

5 	meters

6 	degrees

7 	radians

8 	gradians

9 	user-defined units

diminfo1[6]

Type of tolerance applied.

0 	None

1 	Basic, no tolerance, drawn surrounded by box

2 	PlusMinus

3 	PlusMinusSingleLine

4 	Limit

5 	LimitSingleLine

diminfo1[7]

Reference dimension flag

diminfo1[8]

Decimal character ASCII value.  It is 46 for '.'

diminfo1[9]

Text alignment flag

0 	Text is at a specified angle to the leader line

1 	Text aligned with the leader lines

diminfo1[10]

Autocenter text flag

diminfo1[11]

Standard dimension is being created in

0 	Other, no defined standard

1 	ANSI

2 	ISO

3 	DIN

4 	JIS

5 	KS

diminfo1[12]

Display unit label flag

diminfo1[13]

Display zero tolerance with +/- sign

diminfo1[14]

Trailing zeros flag

diminfo1[15]

Leading zeros flag

diminfo1[16]

Number of decimal places for dimension value

0 - 7 	Places after the decimal

diminfo1[17]

Roundoff for fractional and Ft/In dimensions, denominator only, the numerator is always 1.

diminfo1[18]

Use Dual Dimensioning flag

diminfo1[19]

Dual Dimension Units

0 	Inches

1 	millimeters

2 	Feet

3 	centimeters

4 	Yards

5 	meters

6 	degrees

7 	radians

8 	gradians

9 	user-defined units

diminfo1[20]

Display Dual unit label

diminfo1[21]

Dual Dimension Representation,

0 	Decimal

1 	Fractional

2 	Feet and inches

3 	degrees

4 	degrees minutes seconds

5 	Radians

6 	Gradians

diminfo1[22]

Dual dimension trailing zeros flag

diminfo1[23]

Dual dimension leading zeros flag

diminfo1[24]

Number of decimal places for dual dimension value

0 - 7 	Places after the decimal

diminfo1[25]

Dual Dim Roundoff for fractional and feet and inches dimensions.  (Denominator only, Numerator is 1)

diminfo1[26]

Placement of the dual dimension text

0 	to the right

1 	below

diminfo1[27]

Leader gap value meaning flag

0 	value is a percentage of text height

1 	value is an absolute distance

diminfo1[28]

Use Component attributes for a dimension

0 	No, all components have same attributes

1 	Yes, each component has it's own attributes

diminfo1[29]

Color to use for the witness line

0-63 	CADKEY color number

diminfo1[30]

Pen to use for the witness line

1-8 	CADKEY pen number

diminfo1[31]

Color to use for the leader line

0-63 	CADKEY color number

diminfo1[32]

Pen to use for the leader line

1-8 	CADKEY pen number

diminfo1[33]

Color to use for the arrow head

0-63 	CADKEY color number

diminfo1[34]

Pen to use for the arrow head

1-8 	CADKEY pen number


@diminfo2

Array used by some CADL functions to return double data for a dimension entity

diminfo2[0]

Witness line gap factor.  When this factor is multiplied by the dimension height, it results in the distance (gap) between a witness line and its reference point.

diminfo2[1]

Arrowhead gap factor.  When this factor is multiplied by the dimension height, it results in the rise that a witness line makes above the leader line.

diminfo2[2]

Unit scale per inch, primarily for user defined units.

diminfo2[3]

Dual unit scale per inch, primarily for user defined units.

diminfo2[4]

Upper tolerance value

diminfo2[5]

Lower tolerance value

diminfo2[6]

Angle of witness line.  The angle to sheer the dimension by.

diminfo2[7]

Scale factor  used when displaying tolerances

diminfo2[8]

The gap from the leader to the text when using solid leader lines.


@dimslnt

Current dimension text slant angle


@dispview

Current system view number


@dispviewmat[16]

Current view matrix


@entatt

Array used by some CADL functions to return attributes for an entity

entatt[0]

The color number, 0-63

entatt[1]

The fill color, primarily for polylines.  This is a standard RGB color value.

entatt[2]

The pen number, 1-8.

entatt[3]

The line style, see CKSLTypes for values.

0 	Solid lines.

1 	Dashed lines.

2 	Center lines.

3 	Phantom lines.

entatt[4]

The line width.  Odd values from 1 to 15.

entatt[5]

The entity's group number, 1-127, or 0 if not in a group.

entatt[6]

The entity's subgroup number, 0-255.

entall[7]

The entity's ref control flags


@error

CADL/Calculator error number


@font

Font of last selected entity.


@intdat

Information about the last selected entity. See Entity Information for details


@key

Character code for the last hey hit

-3

CADKEY is preparing to start a root function.

-2

CADKEY is attempting to shut down

-1

The active document has changed

0

Accept Button pressed

1

Menu Button 1 pressed

2

Menu Button 2 pressed

3

Menu Button 3 pressed

4

Menu Button 4 pressed

5

Menu Button 5 pressed

6

Menu Button 6 pressed

7

Menu Button 7 pressed

8

Menu Button 8 pressed

9

Menu Button 9 pressed

10

Menu Button 10 pressed

11

Menu Button 11 pressed

13

Backup Button pressed

14

Escape Button pressed


@ldrln

Array which contains information about leader lines. The leader lines are used for dimensions and leader entities.  The first subscript in the array represents the leader line number (ln).

[ll][0]

Pen number assigned  to leader line
1 to 8 -  Pen number

[ll][1]

Color number assigned to leader line
0 to 63 - Color number

[ll][2]

X coordinate of arrowhead tip in entity coordinates

[ll][3]

Y coordinate of arrowhead tip in entity coordinates

[ll][4]

Angle the arrowhead makes with the entities x-axis

[ll][5]

Arrow height

[ll][6]

Pattern number

[ll][7]

Displayed flag of the leader

[ll][8]

Number of points that make up the leader line

[ll][9]

Number of blank segments in the leader line.

[ll][(n*2)+ 10]

X coordinate of nth endpoint of leader line in entity coordinates, where n is the zero based index of leader points.

[ll][(n*2)+ 11]

Y coordinate of nth endpoint of leader line in entity coordinates, where n is the zero based index of leader points.

[ll][(n*2)+(m)+12]

Number of the mth blank segment, where m is the zero based index of blank segments in the leader and n is the total number of leader points.


@level

Current system level


@ltype

Current line type


@lwidth

Current line width


@matrix

Array containing the matrix values of the last selected entity


@noteang

Current system note text angle


@noteatt

Array used by some CADL functions to return text attributes for note entities.  This array is filled for Note based entities.

noteatt[0]

Angle between baseline of text and the x axis

noteatt[1]

Text height of one line of text

noteatt[2]

Aspect ratio of the text characters

noteatt[3]

Distance between text lines as % of text height

noteatt[4]

Text slant in degrees

noteatt[5]

Justification of the text within the text box. Not used in this version, should be set to 0.

0 	Left justified

1 	Center justified

2 	Right justified

noteatt[6]

Text path direction, always 0 for dimension entities Not used in this version, should be set to 0.

0 	LeftToRight

1 	UpAndDown

2 	RightToLeft

3 	DownAndUp

noteatt[7]

Horizontal alignment of the text to the anchor point

noteatt[8]

Vertical alignment of the text to the anchor point

noteatt[9]

The text is mirrored

noteatt[10]

Filled text

noteatt[11]

The text is underlined

noteatt[12]

The text is strike through


@notefill

Current note text fill mode


@notefont

Current note text font name


@noteht

Current system text height for notes


@noteline

Current note text line spacing factor


@noteslnt

Current note text slant angle


@noteuln

Current note underline mode


@nread

Number of data items read with the last READ command


@numdbl

Number of items currently in @dbldat


@numint

Number of items currently in @intdat


@numstr

Number of items currently in @strdat


@numvp

The number of viewports currently displayed


@palb

Current system color palette BLUE values, where: @palb[n] = BLUE value (between 0 and 255) for color palette index n


@palg

Current system color palette GREEN values, where: @palg[n] = GREEN value (between 0 and 255) for color palette index n


@palr

Current system color palette RED values, where: @palr[n] = RED value (between 0 and 255) for color palette index n


@pen

Current pen value


@pi

The value of PI


@pi05

The value of PI / 2


@pi10

The value of PI.  This is the same as @pi and is included for consistency with the other values of PI


@pi15

The value of 3 * PI / 2, or 1.5 * PI


@pi20

The value of 2 * PI


@refarc

Array which contains information about reference arcs. For each reference arc there are 5 values.  The first subscript in the array represents the reference arc number.

refarc[0][0]

X coordinate of the center of the 1st reference arc.

refarc[0][1]

Y coordinate of the center of the 1st reference arc.

refarc[0][2]

Radius of 1st reference arc.

refarc[0][3]

Start angle of arc segment of the 1st reference arc.

refarc[0][4]

End angle of arc segment of the 1st reference arc.

refarc[n-1][0]

X coordinate of the center of the nth reference arc.

refarc[n-1][1]

Y coordinate of the center of the nth reference arc.

refarc[n-1][2]

Radius of nth reference arc.

refarc[n-1][3]

Start angle of arc segment of the nth reference arc.

refarc[n-1][4]

End angle of arc segment of the nth reference arc.


@refln

Array which contains information about reference lines. For each reference line there are 4 values.  The first subscript in the array represents the reference arc number.

refln[0][0]

X coordinate of the start of the 1st reference line.

refln[0][1]

Y coordinate of the start of the 1st reference line.

refln[0][2]

Z coordinate of the start of the 1st reference line.

refln[0][3]

X coordinate of the end of the 1st reference line.

refln[0][4]

Y coordinate of the end of the 1st reference line.

refln[0][5]

Z coordinate of the end of the 1st reference line.

refln[n-1][0]

X coordinate of the start of the nth reference line.

refln[n-1][1]

Y coordinate of the start of the nth reference line.

refln[n-1][2]

Z coordinate of the start of the nth reference line.

refln[n-1][3]

X coordinate of the start of the nth reference line.

refln[n-1][4]

Y coordinate of the start of the nth reference line.

refln[n-1][5]

Z coordinate of the start of the nth reference line.


@scale

Current system viewing scale


@selpval

Parameter value of marker position on selected entity. This is only for entities selected by the GetEnt function.


@selSNum

Segment number of marker position on selected entity. This is only for entities selected by the GetEnt function.


@strdat

Information about the last selected entity. See Entity Information for details


@txtasp

Current system text aspect ratio for notes


@txtatt

Array used by some CADL functions to return text attributes for dimension entities.  For most note and detail entities, this array will be filled with data

txtatt[0]

Angle between baseline of text and the x axis

txtatt[1]

Text height of one line of text

txtatt[2]

Aspect ratio of the text characters

txtatt[3]

Distance between text lines as % of text height

txtatt[4]

Text slant in degrees

txtatt[5]

Justification of the text within the text box. Not used in this version, should be set to 0.

0 	Left justified

1 	Center justified

2 	Right justified

txtatt[6]

Text path direction, always 0 for dimension entities Not used in this version, should be set to 0.

0 	LeftToRight

1 	UpAndDown

2 	RightToLeft

3 	DownAndUp

txtatt[7]

Horizontal alignment of the text to the anchor point

txtatt[8]

Vertical alignment of the text to the anchor point

txtatt[9]

The text is mirrored

txtatt[10]

Filled text

txtatt[11]

The text is underlined

txtatt[12]

The text is strike through


@units

Current system units mode


@userscale

Scale factor for user defined units


@vwwld

Current system status of View/World switch

0

View coordinates

1

World coordinates


@witln

Array used by some CADKEY entities to return data about their witness line(s).  For each witness line there are eight data elements.  The first subscript in the array represents the witness line number (wl).

[wl][0]

Pen number assigned  to witness line

1 to 8 	Pen number

[wl][1]

Color number assigned to witness line

0 to 63 	Color number

[wl][2]

Displayed flag of the witness

[wl][3]

Number of points that make up the witness line

[wl][4]

Number of blank segments in the witness line.

[wl][(n*2)+ 5]

X coordinate of nth endpoint of witness line in entity coordinates, where n is the zero based index of witness points.

[wl][(n*2)+ 6]

Y coordinate of nth endpoint of witness line in entity coordinates, where n is the zero based index of witness points.

[wl][(n*2)+(m)+7]

Number of the mth blank segment, where m is the zero based index of blank segments in the witness and n is the total number of witness points.


@xcplane

The X coordinate value of the last user selection (construction coordinates)


@xcursor

Current X cursor location in world coordinates


@xinput

The X coordinate value of the last user selection (world coordinates, but modified by the 2D/3D switch)


@xmax

X max coordinate of the current viewport


@xmin

X min coordinate of the current viewport


@xview

The X coordinate value of the last user selection (view coordinates)


@xworld

The X coordinate value of the last user selection (world coordinates)


@ycplane

The Y coordinate value of the last user selection (construction coordinates)


@ycursor

Current Y cursor location in world coordinates


@yinput

The Y coordinate value of the last user selection (world coordinates, but modified by the 2D/3D switch)


@ymax

Y max coordinate of the current viewport


@ymin

Y min coordinate of the current viewport


@yview

The Y coordinate value of the last user selection (view coordinates)


@yworld

The Y coordinate value of the last user selection (world coordinates)


@zcplane

The Z coordinate value of the last user selection (construction coordinates)


@zinput

The Z coordinate value of the last user selection (world coordinates, but modified by the 2D/3D switch)


@zview

The Z coordinate value of the last user selection (view coordinates)


@zworld

The Z coordinate value of the last user selection (world coordinates)


Branching and Looping with Labels

Labels

A label is used to mark a specific location within the program.  This location can then be referenced by a GOTO or ON GOTO statement. When placing a label, you must precede the label with a colon.

Example

Label

:menu1

The GOTO command

Normally, CADL processes each statement from the beginning of a program to the end.  The GOTO statement allows execution to branch to a location in the program that has been labeled.  The format for a GOTO statement is:

Example

GOTO label

Comments

This causes the program to branch to the statement immediately following the specified label. When specifying the label in the GOTO statement, you don't need to include the semicolon.
 By using both the IF and GOTO statements you create program loops.

Example

CADL loop

i = 1

:loop

    PAUSE "The value of i is %d",i

    i = i + 1

    IF ( i <lt>= 5 )

GOTO loop

Comments

In this example, the PAUSE command will be executed five times.

ON (value) GOTO

The ON GOTO statement provides you with an easy way to branch to multiple labels based on a computed value.  The format for the ON GOTO statement is as follows:
 ON value GOTO [label1, label2, ...]
 If value is computed to be a negative number or zero, execution will GOTO label1.  Computed values of 1, 2, 3, etc. causes execution to GOTO the second, third, fourth, etc. labels, respectively.  If there is a positive value for which there is no respective label, execution goes to the last label in the list.  This statement is really a replacement for a series of IF...GOTO statements.  The following two sections of code perform the same function:

Example

IF (x <= 0)

    GOTO lab1

IF (x == 1)

    GOTO lab2

IF (x == 2)

    GOTO lab3

IF (x >= 3)

    GOTO lab4

ON x GOTO lab1, lab2, lab3, lab4

<nl>

<nl>


CADL Data Types

There are various types of data that need to be represented in a program. In the previous versions, CADL supported a single data type, the floating point, in the range of -10^308 to 10^308 and a precision of as many as 15 digits.

Two other data types, integer and character, are obtained by using the floating point. Whenever a value is used in integer operations, the value is truncated or rounded to the nearest integer value. Similarly, if a character is divided by 256, the remainder is used as the ASCII value of the character.

Now, in addition to the above mechanism, CADL supports the following data types: CHAR, DOUBLE, FLOAT, INT, LONG, SHORT, SLIST, STRING, UCHAR, UINT, ULONG, USHORT, HDRAWINST, HENTITY, HLAYOUT, HLEVEL, and HLOCATION


CADLComp Files

To compile CADL files, you need CADLComp.EXE. The executable file can be either in the current working directory or in a directory accessible by the system path. CADLComp is the file you call to compile a program.


Calling External Programs or System Processes

To call an external program or access a system process, you must use the EXEC command.  When executed, this command temporarily suspends the system and executes the command that you specified.  When the program or process is complete, control is returned to the statement immediately following the EXEC statement.


Compiler Directives

The following pages describe the various options for the preprocessor phase of the CADL compiler. To use these directives, your CADL file must have a .cdp extension instead of a .cdl extension and it should be run through the CadlComp utility before execution.

 To direct the preprocessor to replace identifiers with their definitions, you will need to use the #DEFINE directive.  You can also use the #DEFINE directive just to say that a particular identifier has been defined, even if it is not going to be replaced by any particular definition.  This second use of #DEFINE is only useful when using either of the directives, #IFDEF or #IFNDEF.These directives control whether or not a particular section of code is to be compiled.

 #IFDEF compiles the code if the specified identifier has been defined, while #IFNDEF compiles the code only if the identifier has not been defined.  Note that the identifier doesn't necessarily have to have a definition, it just has to be defined.

 To disassociate an identifier with its definition, use the #UNDEF directive. You can use this directive to un-define an identifier you previously defined, or to make sure an identifier was not defined previously in another section of the program.

 To insert the contents of another file into the current program, use the #INCLUDE directive.


Compiler-Specific Control Statements

The following is a list of program control statements that can only be used in compiled programs (see the Introduction to CadlComp section for details):

 CONTINUE
 DO WHILE
 EXITLOOP
 FOR
 IF with a statement block {...} following.
 IF--ELSE IF--ELSE
 LOCAL
 SWITCH
 WHILE


Entity Information

When you select entities in CADL, the information is stored in the system arrays.  This section lists the entity types and which system arrays are filled in when they are selected.

Type Codes For all entities the @intdat holds at least one element, the type code for the entity.  This is always @intdat[0] for the most recently selected entity.

0 	None

1 	Points

2 	Lines

3 	Arcs and Circles

4 	Polylines

5 	Conics

6 	Splines

7 	NURB Splines

8 	Composite entities

9 	Notes

10 	Labels

11 	Linear Dimensions

12 	Angular Dimensions

13 	Circular Dimensions

14 	Base Linear Dimensions

15 	Chamfer Dimensions

16 	Generic Dimensions

17 	Coordinate Dimensions

18 	Balloons

19 	Center Lines

20 	Datums

21 	Datum Targets

22 	Drawing Instances

23 	Geo Tol Symbols

24 	Cross Hatching

25 	Leaders and Witnesses

26 	Part References

27 	Planes

28 	Surface Texture Symbols

29 	Targets

30 	Vectors

31 	Welding Symbols

32 	Solids

33 	Parametric Solids

34 	DRAFT-PAK Features

35 	DRAFT-PAK Fasteners

36 	DRAFT-PAK Mechanical Elements

37 	CADKEY OLE Entity

38 	Textual entities

39 	Note Tables

40 	Dimension Entities

41 	Shells

42 	Solid Edges

43 	Solid Faces

44 	Solid Vertex

45 	Solid Flowline

46 	Parametric Solid Edges

47 	Parametric Solid Faces

48 	Parametric Solid Vertex

49 	Parametric Plane

50 	Parametric Sketch Geometry

51 	Cutting Plane Line

52 	Sheet BODY

Angular Dimensions

@matrix

@entatt

@refln

@witln

@ldrarc

@diminfo1

@diminfo2

@dbldat
[0] - X coordinate of the note (in Entity coordinates)
[1] - Y coordinate of the note (in Entity coordinates)
[2] - Z coordinate of the note (in Entity coordinates)

Arc / Circle

@matrix

@entatt

@dbldat
[0] - Radius of the arc
[1] - Starting angle of the arc in Radians
[2] - Ending angle of the arc in Radians

Balloon Details

@matrix

@entatt

@ldrln

@txtinfo

@dbldat
[0] - X coordinate of the note center (in Entity coordinates)
[1] - Y coordinate of the note center (in Entity coordinates)
[2] - Z coordinate of the note center (in Entity coordinates)

Base Linear Dimensions

@matrix

@entatt

@witln

@ldrln

@diminfo1

@diminfo2

@dbldat
[0] - X coordinate of the note (in Entity coordinates)
[1] - Y coordinate of the note (in Entity coordinates)
[2] - Z coordinate of the note (in Entity coordinates)

Chamfer Dimensions

@matrix

@entatt

@refln

@ldrln

@diminfo1

@diminfo2

@dbldat
[0] - X coordinate of the note (in Entity coordinates)
[1] - Y coordinate of the note (in Entity coordinates)
[2] - Z coordinate of the note (in Entity coordinates)

@intdat
[1] - Style of Chamfer dimension. 0 = C style, 1 = X 45 style.

Circular Dimensions

@matrix

@entatt

@refarc

@witln

@witarc

@ldrln

@diminfo1

@diminfo2

@dbldat
[0] - X coordinate of the note (in Entity coordinates)
[1] - Y coordinate of the note (in Entity coordinates)
[2] - Z coordinate of the note (in Entity coordinates)

@intdat
[1] - Radial (0) or Circular(1)
[2] - Bent radial flag, if [0] is 0
[3] - Shortened solid radial

Conic

@matrix

@entatt

@dbldat
[0] - Conic Type:
0 - Point
1 - Line
2 - Circular arc
3 - Elliptical arc
4 - Parabolic arc
5 - Hyperbolic arc
[1] - 2D rational quadratic coefficients of the first segment
[2] - 	w(u)=@dlbdat[7]*u2+@dlbdat[8]*u+@dlbdat[9]
x(u)=(@dlbdat[1]*u^2+@dlbdat[2]*u+@dlbdat[3])/w(u)
y(u)=(@dlbdat[4]*u^2+@dlbdat[5]*u+@dlbdat[6])/w(u)
[9]
If @intdat[2] = 2, six more entries to @dlbdat are made:
[10]	2D rational quadratic coefficients of the second segment
[11] 	x(u) = (@dlbdat[10]*u^2 + @dlbdat[11]*u + @dlbdat[12])/w(u)
y(u) = (@dlbdat[13]*u^2 + @dlbdat[14]*u + @dlbdat[15])/w(u)
[15]
[16]	Start display segment number and u parameter
[17]	End display segment number and u parameter Note: display segment number = integer; u parameter = decimal

Coordinate Dimension

@matrix

@entatt

@refln

@ldrln

@diminfo1

@diminfo2

@dbldat
[0] - X coordinate of the note (in Entity coordinates)
[1] - Y coordinate of the note (in Entity coordinates)
[2] - Z coordinate of the note (in Entity coordinates)

@intdat
[1] - Display style
0 - Primary,
1 - PrimaryWithShrink,
2 - Secondary,
3 - SecondaryWithShrink,
4 - Primary_Secondary,
5 - Secondary_Primary,
6 - Primary_PrimaryShrink,
7 - Secondary_SecondaryShrink,
8 - Primary_Secondary_PrimaryShrink,
9 - Secondary_Primary_SecondaryShrink
[2] - Is the dimension displaying the z value

Datum Target

@matrix

@entatt

@txtinfo

@dbldat
[0] - X coordinate of the note (in Entity coordinates)
[1] - Y coordinate of the note (in Entity coordinates)
[2] - Z coordinate of the note (in Entity coordinates)

Drawing Instance

@matrix

@dbldat
[0] - X coordinate of the center position of the model as shown
    in this instance
[1] - X coordinate of the center position of the model as shown
    in this instance
[2] - X coordinate of the center position of the model as shown
    in this instance
[3] - The roataion of the instance
[4] - The scale of the instance
[5] - The width of the instance box
[6] - The height of the instance box

@intdat
[1] - The rendering flag
 No self defined rendering
 Wire-frame display
 Hidden Line Removed display
 Hidden Line Dashed display
 Flat solid display
 Smooth solid display
[2] - Is the instance frozen?
[3] - Is the border shown?

Generic Dimensions

@matrix

@entatt

@refarc

@refln

@txtinfo

@dbldat
[0] - X coordinate of the note (in Entity coordinates)
[1] - Y coordinate of the note (in Entity coordinates)
[2] - Z coordinate of the note (in Entity coordinates)

GeoTol Details

@matrix

@entatt

@witln

@ldrln

@txtinfo

@dbldat
[0] - X coordinate of the note (in Entity coordinates)
[1] - Y coordinate of the note (in Entity coordinates)
[2] - Z coordinate of the note (in Entity coordinates)

@intdat
[1] - Number of witness lines
[2] - Number of leader lines
[3] - Number of frames

Hatch

@matrix

@refln 	The reference lines that make up the hatch

@intdat
[1] - Number of solid lines in the hatch
[2] - Number of dashed lines in the hatch
[3] - Number of center lines in the hatch
[4] - Number of phantom lines in the hatch

Comments

The hatch reference lines are listed in order by type corresponding to their order in @intdat.  For example, to access the X value of the start of the third dashed line in the hatch the index given would be (4 * @intdat[1]) + (4 * 3) + 0.  That is the number of solid lines times 4 (each line has four data elements in @dbldat), plus the number of the desired dashed line times 4, plus the index of the line data element desired.

Labels

@matrix

@entatt

@witln

@ldrln

@txtinfo

@dbldat
[0] - X coordinate of the note (in Entity coordinates)
[1] - Y coordinate of the note (in Entity coordinates)
[2] - Z coordinate of the note (in Entity coordinates)

Leader/Witness

@matrix

@entatt

@ldrln

Line

@matrix

@entatt

@dbldat
[0] - X value of first endpoint (in Entity coordinates)
[1] - Y value of first endpoint (in Entity coordinates)
[2] - Z value of first endpoint (in Entity coordinates)
[3] - X value of second endpoint (in Entity coordinates)
[4] - Y value of second endpoint (in Entity coordinates)
[5] - Z value of second endpoint (in Entity coordinates)

Linear Dimensions

@matrix

@entatt

@refln

@witln

@ldrln

@diminfo1

@diminfo2

@dbldat
[0] - X coordinate of the note (in Entity coordinates)
[1] - Y coordinate of the note (in Entity coordinates)
[2] - Z coordinate of the note (in Entity coordinates)

Notes

@matrix

@entatt

@txtinfo

@dbldat
[0] - X coordinate of the note (in Entity coordinates)
[1] - Y coordinate of the note (in Entity coordinates)
[2] - Z coordinate of the note (in Entity coordinates)

NURBSpline

@matrix

@entatt

@numint

@numdbl

@intdat
[1] - Degree of the spline
[2] - Rational flag (0 = not rational, 1 = rational)
[3] - Periodic flag (0 = not periodic, 1 = periodic)
[4] - Closed flag (0 = open, 1 = closed)
[5] - Curve Form
0 - default; unspecified form
1 - polyline form
2 - circular form
3 - elliptical form
4 - parabolic form
5 - hyperbolic form
6 - intersecting form
[6] - Knot type
0 - default type, this includes non-uniform case
1 - unclamped and uniform
2 - clampled and uniform
3 - distinct knot values are equally spaced
[7] - Self intersecting flag (0 = not intersecting, 1 = intersecting)
[8] - Define through control (0 = no, 1 = yes)
[9] - Planar flag (0 = no, 1 = yes)
[10] - Number of knot points
[11] - Number of Control points and weights (there is always one weight per control point)

@dbldat
[0] - Start Parameter
[1] - End Parameter
[2] - Fit Tolerance
[3] - X coordinate of the start tangent (in Entity coordinates)
[4] - Y coordinate of the start tangent (in Entity coordinates)
[5] - Z coordinate of the start tangent (in Entity coordinates)
[6] - X coordinate of the end tangent (in Entity coordinates)
[7] - Y coordinate of the end tangent (in Entity coordinates)
[8] - Z coordinate of the end tangent (in Entity coordinates)
[9] - Parameter value of the first knot point
[9 + n] - Parameter value of the nth knot point where n is the 0 based index of the knot point
...
[9 + @intdat[10] - 1] - Parameter value of the last knot point
[9 + @intdat[10] + 0] - X value of the first control point
[9 + @intdat[10] + 1] - Y value of the first control point
[9 + @intdat[10] + 2] - Z value of the first control point
[9 + @intdat[10] + 3] - Weight of the first control point
...
[9 + @intdat[10] + (@intdat[11] * 4) + 0] - X value of the last control point
[9 + @intdat[10] + (@intdat[11] * 4) + 1] - Y value of the last control point
[9 + @intdat[10] + (@intdat[11] * 4) + 2] - Z value of the last control point
[9 + @intdat[10] + (@intdat[11] * 4) + 3] - Weight of the last control point

Point

@matrix

@entatt

Polyline

@matrix

@entatt

@intdat
[1] - Number of endpoints.
[2] - Closed polyline flag (0 = open, 1 = closed)
[3] - Filled polyline flag (0 = not filled, 1 = filled)
[4] - R value of the fill color if @intdat[3]  if 1
[5] - G value of the fill color if @intdat[3]  if 1
[6] - B value of the fill color if @intdat[3]  if 1

@dbldat
[0] - X value of first endpoint (in Entity coordinates)
[1] - Y value of first endpoint (in Entity coordinates)
[2] - Z value of first endpoint (in Entity coordinates)
[(n*3)+0] - X value of nth endpoint (in Entity coordinates)
[(n*3)+1] - Y value of nth endpoint (in Entity coordinates)
[(n*3)+2] - Z value of nth endpoint (in Entity coordinates)
Since there are three values per endpoint, @numdbl is equal to @intdat[1] times three.

Spline

@matrix

@entatt

@numint

@numdbl

@intdat
[1] - Dimension flag (0 = 2D, 1 = 3D)
[2] - Cyclic flag (0 = open, 1 = closed)
[3] - Number of segments
[4] - Start display segment
[5] - End display segment

@dbldat
If @intdat[1] equals 0 (2D spline), eight values are defined
per spline segment as follows. @numdbl is
equal to @intdat[3] times 8.

[0] - Coefficients of first segment
[7]
...
[(n*8) + 0] - Coefficients for the nth segment where n is
[(n*8) + 7]   the current segment
[((n*8) + 8) + (m*3) + 0] - X value of mth node, where m is the 0 based node on the spline
[((n*8) + 8) + (m*3) + 1] - Y value of mth node, where m is the 0 based node on the spline
[((n*8) + 8) + (m*3) + 2] - Z value of mth node, where m is the 0 based node on the spline
The start and end points of the spline are included in the number of nodes on the spline as the first and last point.

If @intdat[1] equals 1 (3D spline), 12 values are defined
per spline segment as follows. @numdbl is
equal to @intdat[3] times 12.
[0] - Coefficients of first segment
[11]
...
[(n*12) + 0] - Coefficients for the nth segment where n is
[(n*12) + 11]  the current segment
[((n*12) + 12) + (m*3) + 0] - X value of mth node, where m is the 0 based node on the spline
[((n*12) + 12) + (m*3) + 1] - Y value of mth node, where m is the 0 based node on the spline
[((n*12) + 12) + (m*3) + 2] - Z value of mth node, where m is the 0 based node on the spline
The start and end points of the spline are included in the number of nodes on the spline as the first and last point.

Target

@matrix

@dbldat
[0] - Diameter of the Target Symbol

@intdat
[1] - Target type
0 - Solid,
1 - QuadRing,
2 - Quad


Exiting a CADL program

Normally a CADL program is done when it reaches the end of the file. However, if you want to terminate the program before it reaches the end of the file, there are two statements to do it: ABORT and EXIT. Although they both will immediately exit the current program, there is a difference in what they will do afterwards.
 ABORT will always terminate the current program and return you to the CADKEY program.
 EXIT will also terminate the current program, but if that program was executed by a DOSUB statement, EXIT will return control over to the program with the DOSUB statement in it.  If the current program was not called by a DOSUB statement, then it will return you to the CADKEY program.


Introduction to CadlComp

CadlComp is a stand-alone utility that processes a CADL language file into a CADL file that the iternal processor can handle. When CadlComp preprocesses a .cdp file, it creates a .cdl file. This .cdl file will function the same as the .cdp file. The only difference is that any compiler specific commands will be converted to non-compiler specific code and any compiler directives will be replaced by the code they represent.


Loop Statements

If you have tried to create various types of loops in an uncompiled CADL program, you have probably noticed that it can get quite messy, with what appears to be a maze of IF's, GOTO's, and labels.  The following statements allow you to easily construct loop structures in compiled programs.

 CONTINUE
 DO WHILE
 EXITLOOP
 FOR
 WHILE


Math and Logical Functions

CADL supports math functions the same way BASIC, FORTRAN, C and most programming languages do.
 The functions recognized by CADL are equivalent to their counterparts in the C programming language.  CADL supports the following functions:
abs(x)
acos(x)
asin(x)
atan(x)
atan2(y,x)
ceil(x)
copsize(type)
cos(x)
cosh(x)
dms(d, m, s)
exp(x)
floor(x)
fmod(x, y)
hypot(x,y)
log(x)
log10(x)
pow(a, b)
sin(x)
sinh(x)
sizeof(xxx)
sqrt(x)
tan(x)
tanh(x)


Math and Logical Operators

CADL prioritizes algebraic operations the same way BASIC, FORTRAN, C and most programming languages do.  Use parentheses ( ) to change evaluation priorities, expresions in parentheses are always evaluated first.  The priority of math operations is as follows:
 	exponents
 	multiplication, division
 	addition, subtraction

The operators recognized by CADL are equivalent to their counterparts in the C programming language.  CADL supports the following operators provided with an example of each:

Example

+

Addition

Example:  a+b

-

Subtraction

Example:  a-b

^

Power operator, a to the nth power.

Example:  a^b

*

Multiplication

Example:  a*b

/

Division

Example:  a/b

=

Numeric Variable assignment

Example:  a = b

String variable assignment.

Example:  $msg = "Hello"

%

modulus,

Example:  a%b   a (integer) modulus b

( )

Precedence, clarifys Order of operations

Example:  a*(b+c)

add b and c before multiplying by a.

'

Feet

Example:  a'

"

Inches

Example:  a"

==

Equal comparison

Example:  a == b

!=

Not equal comparison

Example:  a != b

>

Greater than comparison

Example:  a > b

<

Less than comparison

Example:  a < b

>=

Greater than or equal to comparison

Example:  a >= b

<=

Less than or equal to comparison

Example:  a <= b

&&

Logical AND operation

Example:  a && b

||

Logical OR operation

Example:  a || b

? :

Conditional, if a then b else ,c

Example:  a ? b : c

|

Calculates bitwise or

Example:  a|b

&

Calculates bitwise and

Example:  a&b

#

Calculates bitwise exclusive or

Example:  a#b

>>

Shift right by count n

Example:  a>>n

<<

Shift left by count n

Example:  a<<n

~

Calculates bitwise inverse

Example:  ~a


Program Branching

The GOTO and ON GOTO statements are for branching within the current CADL program. CHAIN and DOSUB are for branching off the normal program flow into other CADL files.
 DOSUB transfers control over to a specified CADL file. When the end of that file is reached or an EXIT statement is processed, control then returns back to the original file at the statement immediately following the DOSUB statement.
 CHAIN transfers control to a specified CADL file, but there is no return to the original file as in the DOSUB statement.


Program Control Statements

Program control statements decide the flow of the program execution by branching, looping or conditionally executing portions of code. The following is a brief discussion of each one of the program control statements.  For more detailed information, including formats and restrictions, refer to the Reference section.

REM

The REM statement can be used to insert comments into your code. This keyword, as well as any following text, is ignored by the system when the program is executed.  You therefore could also cause certain commands to be ignored just by placing REM in front of them.

Example

REM This is just a comment

REM PROMPT "This command will not be executed until the REM is removed"

IF

The IF statement is used to conditionally execute a portion of code. The IF has the format:
 	IF (expr)
 	statement
 First, the expression (expr) is evaluated.  If it is true (nonzero), then the following statement is executed and program flow continues as normal. If the expression was evaluated as false (zero), then the statement following the IF statement is skipped and program flow continues with the next statement.

Example

y = 5

IF ( x <gt> 10 )

    y = 0

PAUSE "The value of y is %d",y

Comments

In this example, the expression (x > 10) is first evaluated.  If it true (x is greater than 10), then execution continues with the next statement which sets y equal to zero(0).  If it is not true (x is less than or equal to 10), then the statement, y=0, is skipped and program flow continues with the following statement, in this case a PAUSE statement (see the Reference section for details on the PAUSE command).


Reading from a datafile

Reading data from a CADL file is a common method of input.  A data file is typically a series of numeric values seperated by commas.  The READ function in CADL reads the data from the file into variables supplied in the argument list for the function.

Example

Major functions displayed here are: GETPOS, READ, CLOSE, LINE, NOTESTATE, and GOTO

// this creates a short stair riser from a data file of line

// end-points pairs.  The riser is laid on the x=y plane of

// the current CPlane

// The number or line endpoints in the data file

CLEAR nLines

INT nLines = 11

// Get the anchor point for the riser from the user

CLEAR hLocAnchor, dLocX, dLocY, dLocZ

HLOCATION hLocAnchor

DOUBLE dLocX, dLocY, dLocZ

GETPOS "Select anchor position", 0, hLocAnchor

LOCATIONCOORD hLocAnchor, dLocX, dLocY, dLocZ

// Loop Control Variable, index into the data file rows

CLEAR index

INT index = 0

// variables for the endpoints of the lines

CLEAR dXS, dYS, dXE, dYE

DOUBLE dXS, dYS, dXE, dYE

// label the read data line so we can loop back to it

: ReadData

READ "StairRiser.dat", 1, dXS, dYS, dXE, dYE

// add the selected position to the values, the Z is taken

// directly from the selected position

dXS = dXS + dLocX

dYS = dYS + dLocY

dXE = dXE + dLocX

dYE = dYE + dLocY

// draw the two edges defined by these points

LINE dXS, dYS, dLocZ-0.25, dXE, dYE, dLocZ-0.25, , ,4

LINE dXS, dYS, dLocZ+0.25, dXE, dYE, dLocZ+0.25, , ,4

// connect the lead edge

LINE dXS, dYS, dLocZ-0.25, dXS, dYS, dLocZ+0.25, , ,4

// incriment the data line index

index = index + 1

// loop back up to reading the data if there are more entries

IF(index < nLines)

GOTO ReadData

// note the state of the database after the lines are in

// place without this the geometry will not appear until

// another function is run that notes the state.

// Try running this with this line commented out.

NOTESTATE

// close the data file now that we are done reading from it

// this is not required, but it is recommended

CLOSE "StairRiser.dat"

// clean up the variables used

CLEAR nLines, i, dXS, dYS, dXE, dYE

// terminate the CADL program

EXIT

Data for StairRiser.dat file to be in same directory as this

program.

0.0, 0.0,	 0.0, 1.0

0.0, 1.0,	 1.0, 1.0

1.0, 1.0,	 1.0, 2.0

1.0, 2.0,	 2.0, 2.0

2.0, 2.0,	 2.0, 3.0

2.0, 3.0,	 3.0, 3.0

3.0, 3.0,	 3.0, 4.0

3.0, 4.0,	 4.0, 4.0

4.0, 4.0,	 4.0, 3.5

4.0, 3.5,	 0.5, 0.0

0.5, 0.0,	 0.0, 0.0


Suspending CADL Execution

The WAIT command will suspend CADL execution for a specified number of seconds.


Using CadlComp

Command Line Usage

The command line usage of CadlComp is:

 CADLComp [ -CLMNPXdklsu -Bpath -Dcnst[=def] -Idir -nd -ns ] ifile [ ofile ]

 The only required parameter is ifile, the input file.  This is the file that contains the code to be compiled.  This file must have either a .cdl or .cdp file extension.  If the file has any compiler specific commands or any compiler directives, it must have a .cdp extension.  If no extension is included in the filename, a .cdp extension is assumed. Any references to CHAINed or DOSUBed files are assumed to have the same extension as the original input file.

Command Line Options

The following options can appear in any order within the command line. If you are using more than one option that has no parameters (i.e., -C, L, etc.), then these can be combined behind one dash.  For example:

 CadlComp -L -X -ns -nd -s myfile

 can be also written as:

 CadlComp -LXnsnds myfile

 If you are using the options with parameters included (i.e., -Bpath, Idir, etc.), each option must have a dash in front of it.  For example:

 CadlComp -Bc:\cdl -Ic:\cdl\include -Ddebug

 The optional command line parameters are as follows:

 Bpath	Specifies the path of the base directory.  The base directory is where CadlComp will search for any CHAINed or DOSUBed file which has no path given.  If there is a partial path, it will assumed to be a directory off the base directory.  If "." or ".." are used in the partial path, the path is then relative to the file containing the CHAIN or DOSUB statement. Only one -Bpath option can be included on the command line.

 C	When this parameter is included, the preprocessor phase is skipped and only the compiler phase is used on the input file.  This can be used if there are no compiler specific commands or directives in your code. CadlComp forces a .cdl extension on the input file when this option is used.

 Dcnst[=def]	This functions as a #define directive except instead of only being defined within the file that it appeared in, this constant is defined in all files that are part of the compilation.  Like the #define directive, it can be used to define the constant with an actual value, or it can merely say that a particular constant is defined (see #DEFINE).

 d	This will cause CadlComp to delete the intermediate .cdl files that are create by the preprocessor while compiling .cdp files.  This option is on by default if the source file is a .cdp file, and is off by default if -C, -M, -P, or -u are set.  This default can be overridden by -s.

 Idir	Specifies the path of an include directory.  The include directory is where CadlComp will search for any files that are #INCLUDEd when no path or a partial path is given.  If there is a partial path, it will be assumed to be a directory branching off the include directory. If "." or ".." are used in the partial path, the path is relative to the file contain the #INCLUDE directive.  You can have more than one include directory, but they will be searched in the order that they are given on the command line.

 k	If there are kanji character strings in your code and this option is set, they will be treated as kanji characters.  If this is not set, they will be interpreted as normal characters.

 L	When the preprocessor converts various loop commands (FOR, DO WHILE, etc.), it creates various labels for the intermediate .cdl file.  All these labels being with the '$' character.  This option will list all of these $labels and give the total number of labels created.  This is useful since if you set the number of labels in the CONFIG utility to a number lower than the number of labels created within your code, your program will not run in CADKEY.  When the preprocessor interprets a SWITCH statement, it also creates a local variable for internal use.  This option will also list the name of this local variable. (This option only works in the preprocessor phase.)

 l	During the compiler phase, this option will all the variables used in your program, including variables created by the preprocessor.  If you use any CHAINs or DOSUBs, those files will also be listed with their own variable usage list.

 M	When the preprocessor encounters any of the compiler specific commands in a .cdp file, by default it replaces them with a functional copy of the command in .cdl format.  By using this option, your original will also be left in the .cdl file, but it will all be in REM statements. By default, the -s option is automatically set.

 N	This will cause the preprocessor to process only the input file specified.  CHAINed or DOSUBed files will not be preprocessed with this option set. (This option only works if the -P option is set.)

 nd	By default, CadlComp will perform an optimization that will compact all occurrences of repeated data.  Unfortunately, this optimization uses CADKEY's shell memory.  When a program is compiled and uses more than 25k of shell memory, a warning will be displayed.  If you have memory restrictions and do not wish to use this optimization, make sure this option is set.

 ns	This is identical to the -nd option except that the optimization is on duplicated strings.  To turn off this optimization, include this option in the command line.

 P	This causes CadlComp to run only the preprocessor on the input file. All CHAINed and DOSUBed files will also be preprocessed but not compiled. The input file must have a .cdp extension.

 s	This option forces CadlComp to save the intermediate .cdl files that it creates from .cdp files.  This option is on by default if -C, -M, -P, or -u is set, or if the source is a .cdl file. The -d option will override these defaults.

 u	When CadlComp preprocesses a file that has CHAIN or DOSUB statements, it normally preprocesses every single CHAINed or DOSUBed file.  With this option set, the preprocessor will only preprocess those files that have not been modified since the last time their .cdl files were created. This option will only work if you previously have kept the intermediate .cdl files, since it compares the time/date stamp of the .cdl file with the .cdp file.  If the time/date stamps are the same, it will not reprocess the .cdp file.

 X	When CadlComp normally processes a .cdp file to .cdl file, it inserts #line statements into the .cdl file which reference back to the .cdp file.  Since compiler specific commands are converted into .cdl format, the line references in the .cdl file usually don't correspond to the same lines in the original .cdp file. 	These #line statements tell the compiler where it would be in the .cdp file, so if an error is encountered, it will give the line that the error occurred on in the .cdp file.  If you do not wish these #line statements to be included within the .cdl file, set this option.  Note, however, if any error occurs, the line on which the error was encountered will refer to the .cdl file.

 ofile	Normally, when CadlComp creates the .cdx output file, it simply uses the input file name and changes the extension to .cdx.  If you wish a totally different name for the output file, include it in the appropriate position in the command line.

 ??	Can only be used alone on the command line and will display a summary of all of the above options

 As CadlComp runs, the filename of the CADL file it is currently processing is output to the screen. If any CHAIN or DOSUB commands are parsed, the specified filename is saved in a list. Once processing of ifile is complete, each file in the list is preprocessed. This continues until all files called by CHAIN or DOSUB commands have been resolved. Note that unless a filename contains full directory pathname, the directory path for ifile is used.

When CadlComp detects an error, a message is output that specifies the type of error and (usually) the line number at which the error occurs. For most errors, processing terminates immediately; for others, processing continues. In either case however, no output file is generated.


Register Variables
Module: Register Variables

Description

Variables may substitute a constant numeric value anywhere in a CADL program file (e.g., primitives, commands or expressions), including when specifying an array size.

There are two types of variables offered, a variable set by the user, and a system variable maintained and updated by the system.

Rules for Register Variables

1) Variables may be assigned a name consisting of any number of characters. The first character of a variable name must begin with an alpha character. The remaining characters may be any combination of alphanumeric and underscore (_) characters.  Upper and lower case differences are observed.

2) Arrays may be used if they have been previously initialized with the ARRAY statement.

3) A number of reserved variables, called "system variables", are maintained and updated by the system.  They are accessible through CADL as read-only. These variables must always begin with the @ character. System variables are case insensitive. The current list is as below.

4) The system variables are used by many CADL commands for temporary storage of information.  The values of these variables are not guaranteed to persist beyond the next CADL command.  Any values that the program needs to use later should be copied to regular CADL variables immediately after the command that stored the information in those system variables.

 @color
 @const
 @cplane
 @cplanemat
 @dbldat
 @depth
 @dimasp
 @dimfill
 @dimfont
 @dimht
 @diminfo1
 @diminfo2
 @dimslnt
 @dispview
 @dispviewmat
 @entatt
 @error
 @font
 @intdat
 @key
 @ldrln
 @level
 @ltype
 @lwidth
 @matrix
 @noteang
 @noteatt
 @notefill
 @notefont
 @noteht
 @noteline
 @noteslnt
 @noteuln
 @nread
 @numdbl
 @numint
 @numstr
 @numvp
 @palb
 @palg
 @palr
 @pen
 @pi
 @pi05
 @pi10
 @pi15
 @pi20
 @refarc
 @refln
 @scale
 @selpval
 @selsnum
 @strdat
 @txtasp
 @txtatt
 @units
 @userscale
 @versel
 @vertrim
 @view
 @viewmat
 @vwwld
 @witln
 @xcursor
 @xcview
 @xmax
 @xmin
 @xview
 @xworld
 @ycursor
 @ycview
 @ymax
 @ymin
 @yview
 @yworld
 @zcview
 @zview
 @zworld


#DEFINE

#DEFINE

<Compiled CADL Only>
 The #DEFINE directive is used to assign an identifier to substitution-text. All free-form occurrences of the identifier in the .cdp file are replaced by the substitution-text. However, if the identifier is part of a longer word or is enclosed within a quoted string, it is not replaced. The identifier must follow the same naming convention as variables.

 The substitution-text can consist of any valid CADL statement or command. It is separated from the identifier by at least one white-space character (white-space characters following the last word of the substitution-text are not considered part of it). Substitution-text can also be empty.

Example

#DEFINE identifier substitution-text


#ELSE

#ELSE

<Compiled CADL Only>
 Used in a conditional compilation block to specify alternate blocks of code to be processed.  See #IFDEF.

Example

#IFDEF identifier

    ...

    code block 1

    ...

#ELSE

    ...

    code block 2

    ...

#ENDIF


#ENDIF

#ENDIF

<Compiled CADL Only>
 Ends conditional compilation block of code.  Must be used with #IFDEF or #IFNDEF.  See #IFDEF


#IFDEF

#IFDEF

<Compiled CADL Only>
 The #IFDEF and #IFNDEF directives are used to selectively compile portions of code, depending on whether or not the identifier has been defined. Every #IFDEF or #IFNDEF must have a corresponding #ENDIF directive to mark off the code block for conditional compilation.

 If the identifier specified in the #IFDEF directive is defined with either a #DEFINE directive or the runtime compiler option -D, then the statements in code-block 1 are considered part of the source code to be compiled.

 If the identifier does not have a definition, the statements in code-block 2  (following the #ELSE directive) are included in the code to be compiled. The #ELSE directive is optional and can be omitted. In this case, the code block between #IFDEF and #ENDIF directives are compiled if the identifier is defined, and ignored if the identifier is not defined.

 The #IFNDEF directive works the opposite way. It compiles a code block if the identifier does not have a definition, or if it is removed with an #UNDEF directive before reaching the conditional. If there is an #ELSE directive between #IFNDEF and #ENDIF, the code block following #ELSE is compiled if the identifier is defined.

Example

#DEFINE DEBUG

INT nRetVal

GETINT "Please enter an integer", 2, nRetVal

       #IFDEF DEBUG

    PAUSE "You entered %i", nRetVal

       #ENDIF


#IFNDEF

#IFNDEF

<Compiled CADL Only>
 see #IFDEF.


#INCLUDE

#INCLUDE

<Compiled CADL Only>
 The purpose of the #INCLUDE directive is to insert the contents of the file specified by the file-spec in a source file. The file-spec can optionally contain a drive letter and path for the file. Any valid DOS filename can be used for the include files. The following rules should be followed when searching for he file to be included:

 1. If the file-spec consists of a filename, the preprocessor looks for the include file in the directory of the source file.

 2. If the file-spec contains a relative path, the preprocessor looks for the include file under the given path, relative to the directory of the source file.

 3. If the file-spec contains an absolute path, the preprocessor looks for the include file under that path.

 Additional paths for include files can be specified with the -I compiler option at runtime. These directories are searched, in the order in which they are specified, only if the include file is not found under the given file-spec. The search terminates at the first location of the include file.

 The preprocessor replaces the #INCLUDE directive in the source file with the entire contents of the include file. The include files generally contain #DEFINE directives that need to be available globally.

Example

#INCLUDE file-spec


#UNDEF

#UNDEF

<Compiled CADL Only>
 The #UNDEF directive is used to disassociate the identifier with its current definition. After the #UNDEF directive, any subsequent occurrences of the identifier are not translated by the preprocessor. The #UNDEF directive can also be used on an undefined identifier to make sure that it no longer has a definition. The #UNDEF directive is generally used in conjunction with the #DEFINE directive indicating that a certain identifier is available only in a certain section of code.

Example

#UNDEF identifier


ABORT

ABORT

Causes an immediate exit from CADL processing, and control is returned to the CADKEY program. Use EXIT to backup one DOSUB level.

Example

ABORT


abs(x)

Numeric abs(x) Numeric  x

The absolute value of the number.

Parameters

 x

You can assign any value to x, or make it an assigned variable.

Example

y = abs(x)


acos(x)

double acos(x) double  x

The arc cosine of x, in the range of 0 to 180 degrees.

Parameters

 x

The value of x must be between -1 and 1.

Example

y = acos(.862)


ADDBASEDIM

 ADDBASEDIM HENTITY  pBase, hLocation  [RefLoc], double array  [adRefPnt], hLocation  [loc], double  [x], double  [y], double  [z], string  [Str], string  [Font], integer array  [iaDimInfo1], double array  [daDimInfo2], double array  [adTxtAtt], integer array  [iaEntAtt]

This is used to add children dimensions to a parent BASEDIM entity.  The added dimensions will automatically be of the same form and orientation as the BASEDIM they are being added to. Thus there is less information required to add a dimension.

Parameters

 pBase

The Base BASEDIM this dimension is being added to

 [RefLoc]

the location the reference point.  Required if  adRefPnt is not given.

 [adRefPnt]

Array of double data that defines the coordinates of the reference point.  Required if  refloc is not given.

 [loc]

the location to place the text at.  This must be given if  dX,  dY, and  dZ are not given.

 [x]

X value of the text string in text's view coordinates. If  loc is not supplied this will be used for the text position.

 [y]

Y value of the text string in text's view coordinates. If  loc is not supplied this will be used for the text position.

 [z]

Z value of the text string in text's view coordinates. If  loc is not supplied this will be used for the text position.

 [Str]

A character string. If it is omitted, the dimension value is calculated and displayed.

 [Font]

Name of the font to use.

 [iaDimInfo1]

An array of integer values that is used for the dimension.  For more detail refer to the System Arrays section. If this array is given  daDimInfo2 must also be given.

 [daDimInfo2]

An array of doubles that is used for the dimension. For more detail refer to the System Arrays section. If this array is given  adDimInfo1 must also be given.

 [adTxtAtt]

An array of floats that describes the attributes of the dimension text. The array is not required if the value of  Str is NULL. For more detail refer to the System Arrays section.

 [iaEntAtt]

An array of integer values that describes the attributes of the entity.  For more detail refer to the System Arrays section.

Comments

The entity attributes of all dimensions added to BASEDIM entities will be the same as the dimension they are being added to if the attribute arrays are not given.  If some are given and others are not, those not given will be taken from the current attributes of the part.


ADDCOMPOSITE

 ADDCOMPOSITE HEntity  hComposite, HEntity  hEntity

Add an existing entity to a composite entity.

Return Value

@error set as follows:

0 	The entity was added to the composite.

1 	The document for this part no longer exists.

2 	The entity was already in the composite.

3 	The entity does not exist.

4 	The composite does not exist.

Parameters

 hComposite

The handle to the composite to which the entity will be added.

 hEntity

The handle to the entity to be added.

Comments

If the composite has a non-identity transformation matrix, the entity will be moved by this operation.


ADDCOP

 ADDCOP integer  nCopType

Add copious entity

Parameters

 nCopType

Copious type code


ADDCPLANE

 ADDCPLANE string  name, vname  data, vname  [number]

Creates a new cplane

Parameters

 name

The name for the cplane

 data

A double array containing 16 values indicating the 4x4 matrix for the cplane, or an HENTITY containing a Plane entity used to define the cplane.

 [number]

Optional variable to receive the number of the saved cplane.


ADDDISPVIEW

 ADDDISPVIEW string  name, vname  data, vname  [number]

Creates a new display view

Parameters

 name

The name for the display view

 data

A double array containing 16 values indicating the 4x4 matrix for the display view, or an HENTITY containing a Plane entity used to define the display view.

 [number]

Optional variable to receive the number of the new display view.


ADDGEOTOLLDR

 ADDGEOTOLLDR vname  hGeoTol, vname  hLocation

Add a new leader to a GEOTOL

Parameters

 hGeoTol

Handle to a GEOTOL entity

 hLocation

Handles to location for leader


ADDLABELLDR

 ADDLABELLDR string  hLabel, double array  [adPoints], integer array  [anLengths], integer  [nArrowtype], double  [dArrHeight], hLocation  []

Adds leaders to an existing label.

Parameters

 hLabel

Handle to the Label to add leaders to

 [adPoints]

Array of double data that specifies the coordinates of the points that define the LeaderWit lines.  Note that the first point of every witness line will be set equal to the end point of the witness line created by CADKEY for the label and should therefore be given as (0, 0).  The data must be in X Y pair format, and it's length must be at least equal to the sum of the integers in  anLengths times 2.  The values in  anLengths and the number of elements in it are used to extract data from this array as follows:

Leader 1 	The first ( anLengths[0] * 2) data elements define the points used for this leader

Leader 2 	Starting at index ( anLengths[0] * 2) the next ( anLengths[1] * 2) elements define this leader

...

Leader n 	Starting at index ( anLengths[n-2] * 2) the next ( anLengths[n-1] * 2) elements define this leader

 [anLengths]

Array of integers data that defines the number of points in each of the leader lines not counting the first point, which is determined by CADKEY according to which side of the LABEL the leaders start from.  The minimum values of each array element is 1.  If this parameter is omitted, one leader is created using all the point data in  adPoints.  The array values are interpreted as followes:

0 	The number of other points in the first leader

1 	The number of other points in the second leader

...

n 	The number of other points in the nth leader.

 [nArrowtype]

Arrowhead display type.  The same type of arrowhead is used for all the leaders in a LABEL entity

0 	unfilled arrow

1 	filled arrow

2 	slash (also called hash mark)

3 	filled circle (closed dot)

4 	unfilled circle (open dot for directed dimensions)

5 	Triangle stand used for datums

6 	user defined arrowheads begin here

 [dArrHeight]

The height of the arrowhead as % of text height

 []

Location to set the first leaders arrow to. Currently the leaders arrowheads are not associative. This is subject to change in future versions of CADL.


ALONGENT

 ALONGENT HEntity  hEnt, HDrawInst  [hInst], double  dLength, double array var  adCoord, int var  [nSeg], double var  [dParam], int  [nExtend], int  [nWorldMat]

Find a point a given distance along an entity

Return Value

@error set to one of the following:

0 	The computation succeeded.

1 	The entity pointer is invalid.

2 	A pointer to an instance handle was provided, but the handle is null

3 	The entity type doesn't support this operation.

4 	 bExtendCurve is false and  dLength is larger than the length of the curve.

Parameters

 hEnt

Handle to the entity to get information about.

 [hInst]

Handle to the instance, if this is an instance specific entity in layout mode.  For a model mode entity, or a layout specific entity, this must either be set to NULL or omitted.

 dLength

The length along the entity at which to find the point.

 adCoord

The returned coordinate of the point along the entity.

 [nSeg]

The returned segment number of the point along the entity.

 [dParam]

The returned parameter value of the point along the entity.

 [nExtend]

If 1, the calculation may extend beyond the end of the curve.  If 0(default), the computation stops at the end of the curve when  dLength is longer than the curve.

 [nWorldMat]

The matrix for converting from the world space of the object to the computation world space.  This matrix is applied before the projection matrix.


ANGDIM

 ANGDIM integer  nType, integer  nInner, string  [Str], hLocation  [loc], double  [x], double  [y], double  [z], Handle  [Handle1], Handle  [Handle1], Handle  [Handle1], double array  [adRefLin], double array  [adAngPnt], integer  [nMatrix], vname  [hLevel], string  [Font], integer array  [iaDimInfo1], double array  [daDimInfo2], double array  [daTxtAtt], integer array  [iaEntAtt]

The ANGDIM primitive describes an angular dimension entity. All ANGDIM data is represented in local view coordinates.
When an ANGDIM primitive is read from a CADL file, an angular dimension entity is created in the database.  When an ANGDIM entity is written to a CADL file as an ANGDIM primitive, a MATRIX primitive is created first. In addition to a MATRIX primitive, some arrays are created. These arrays are used for the ANGDIM definition.
When an ANGDIM primitive is read from a CADL file, all the arrays except  adRefLin are optional. Either the parameter  adRefLin, or the four RefLoc parameters are given to define the reauired two reference lines of the dimension, and must be supplied.  If both are supplied, the four RefLocs will be used and the data in  adRefLin will be ignored.  The system calculates the angle between the two reference lines defined, measuring from the first line in the counter-clock-wise direction to the second. If a special value/string is desired in place of the numeric value of the angle then the string should should be given in  Str.

Parameters

 nType

The type of angular dimension being created.  0 for 2-line, 1 for 3-point.

 nInner

Is this an inner angle dimension.  0 for Outter angle, 1 for Inner angle

 [Str]

A character string. If it is omitted, the dimension value is calculated and displayed.

 [loc]

the location to place the text at.  This must be given if  dX,  dY, and  dZ are not given.

 [x]

X value of the text string in text's view coordinates. If  loc is not supplied this will be used for the text position.

 [y]

Y value of the text string in text's view coordinates. If  loc is not supplied this will be used for the text position.

 [z]

Z value of the text string in text's view coordinates. If  loc is not supplied this will be used for the text position.

 [Handle1]

For a two line AngDim, this if the HENTITY of the first line of the angle in the counter-clock-wise direction.  For a three point AngDim, this is the HLOCATION of the vertex point of the angle being measured. Required if  adRefLin is not given.

 [Handle1]

For a two line AngDim, this if the HENTITY of the second line of the angle in the counter-clock-wise direction.  For a three point AngDim, this is the HLOCATION of the first point of the angle, in the counter-clock-wise direction, being measured. Required if  adRefLin is not given.

 [Handle1]

For a two line AngDim, this if left empty.  For a three point AngDim, this is the HLOCATION of the second point of the angle, in the counter-clock-wise direction, being measured. Required if  adRefLin is not given.

 [adRefLin]

Array of doubles that defines the reference lines this dimension measures. Each AngDim requires two reference lines For more detail refer to @reflin or the Entity Information section.

 [adAngPnt]

Array of three doubles representing a point lying within the angle that is being measured.  If this is not supplied, the order of the locations, or end-points of the lines will be used to determine which angle is being measured.  This may result in unpredictable behavior.

 [nMatrix]

MATRIX primitive reference number. The MATRIX primitive referenced must precede this primitive or an error message is displayed and the program terminates.

0 (default) 	Use current system view in effect

 [hLevel]

Level handle, see HLEVEL.

 [Font]

Name of the font to use.

 [iaDimInfo1]

An array of integer values that is used for the dimension.  For more detail refer to @diminfo1 or the Entity Information section. If this array is given  daDimInfo2 must also be given.

 [daDimInfo2]

An array of doubles that is used for the dimension. For more detail refer to @diminfo2 or the Entity Information section. If this array is given  adDimInfo1 must also be given.

 [daTxtAtt]

An array of floats that describes the attributes of the dimension text. The array is not required if the value of  Str is NULL. For more detail refer to @txtatt or the Entity Information section.

 [iaEntAtt]

An array of integer values that describes the attributes of the entity. For more detail refer to @entatt or the Entity Information section.

Comments

If the entity attribute or the text attribute arrays are missing, the system defaults will be used in their place.  If both DimInfo arrays are missing, the system defaults will be used, if only one is given the CADL program will abort processing.


ARC

 ARC double  xc, double  yc, double  zc, double  dRad, double  dStartAng, double  dEndAngle, integer  [nMatrix], vname  [hLevel], integer  [nColor], integer  [nStyle], integer  [nGroup], integer  [nSubGroup], integer  [nPen], integer  [nWidth]

The ARC primitive describes a circular arc defined in a specified 2plane. All ARC data is represented in local view coordinates.
When an ARC primitive is read from a CADL file, an arc entity is created in the database.
When an arc entity is written to a CADL file as an ARC primitive, a MATRIX primitive is created first (if necessary) which the ARC primitive may reference as its definition plane.

Parameters

 xc

X value of arc's center in arc's CView

 yc

Y value of arc's center in arc's CView

 zc

Z value of arc's center in arc's CView

 dRad

Radius value of the arc in the current system units, must be >= 0.0005 and <= 10,000

 dStartAng

Starting angle of arc segment, must be >= 0 and <= 360 degrees

 dEndAngle

Ending angle of arc segment, must be >= 0 and <= 360 degrees

 [nMatrix]

MATRIX primitive reference number. The MATRIX primitive referenced must precede this primitive or an error message is displayed and the program terminates.

0 (default) 	World Coordinate system is used

 [hLevel]

Level handle

 [nColor]

Color

0-63 	Number in the system color palette

 [nStyle]

The line style:

1 	Solid

2 	Dashed

3 	Center Line

4 	Phantom line

0 	Use current system line type

 [nGroup]

Group reference number

1-256 	Group number

0 	No group assignment

 [nSubGroup]

Subgroup reference number

1-256 	Subgroup number

0 	No subgroup assignment

 [nPen]

Pen number

1-8 	Pen number

0 	Use current system pen number

 [nWidth]

Line width

1-15 	Odd line width

0 	Use current system line width

Comments

If you wish to specify a group, you must include both the group and the subgroup number.  If either of these arguments is missing or set to zero(0), both of them will be ignored.


ARCFROM2PNTRAD

 ARCFROM2PNTRAD double  x1, double  y1, double  z1, double  x2, double  y2, double  z2, double  dRad, double array var  adCenter1, double array var  adCenter2

Generates 2 centers for an arc with the given radius an two end points of the arc

Return Value

@error set to

0 	Centers generated

1 	Error generating centers

Parameters

 x1

The x coordinate of the first

 y1

The y coordinate of the first

 z1

The z coordinate of the first

 x2

The x coordinate of the second

 y2

The y coordinate of the second

 z2

The z coordinate of the second

 dRad

Radius of the arc

 adCenter1

First possible center point

 adCenter2

Second possible center point


ARCTANPOINT

 ARCTANPOINT vname  hEnt, integer  nSeg, double  dParam, vname  [hInst], double  xP1, double  yP1, double  zP1, int  nDirect, double  dRadius, double  [dStartAng], double  [dEndAng], integer  nCirMat

Given a tangent entity, segment and parameter on the entity, an ending point, and a direction, this function will generate the radius, start and end angles, and matrix to construct an arc that is tangent to the entity and ends at the given point.

Return Value

Sets the value of @Error to one of the following

0 	Success

1 	There was an error during the computation

Parameters

 hEnt

Handle to the tangent entity

 nSeg

Segment on which the entity was selected

 dParam

Parameter of pick point on entity

 [hInst]

Instance entity is in

 xP1

X coordinate of the point

 yP1

Y coordinate of the point

 zP1

Z coordinate of the point

 nDirect

Direction of entity from tangent

1 	ClockWise

2 	CounterClockWise

 dRadius

Returned radius of the circle

 [dStartAng]

Returned start angle of the arc or circle

 [dEndAng]

Returned end angle of the arc or circle

 nCirMat

Returned number of the created matrix for the circle


ARCTHREEPOINTS

 ARCTHREEPOINTS double  xP1, double  yP1, double  zP1, double  xP2, double  yP2, double  zP2, double  xP3, double  yP3, double  zP3, double  dRadius, double  [dStartAng], double  [dEndAng], integer  nCirMat

Given three points, generates the center and radius of an arc or circle that passes through those points.  If it is an arc, the arc begins at the first point and stops at the third point.  If it is a circle, it begins and ends at the first point.

Return Value

Sets the value of @Error to one of the following

0 	Success

1 	Two or more points are coincident.

2 	The three points are colinear.

Parameters

 xP1

X coordinate of the first point

 yP1

Y coordinate of the first point

 zP1

Z coordinate of the first point

 xP2

X coordinate of the second point

 yP2

Y coordinate of the second point

 zP2

Z coordinate of the second point

 xP3

X coordinate of the third point

 yP3

Y coordinate of the third point

 zP3

Z coordinate of the third point

 dRadius

Returned radius of the circle

 [dStartAng]

Returned start angle of the arc or circle

 [dEndAng]

Returned end angle of the arc or circle

 nCirMat

Returned number of the created matrix for the circle


ARRAY

ARRAY

Arrays allow data to be assigned to a single or multi-dimensional storage array within a CADL program. Data may be assigned to an array anywhere within a CADL file, as long as it is assigned before the array is used. The limit to the number of dimensions in an array is five.

 To declare an array, you must use one of the following formats:

 Format 1:	ARRAY arrayname[n]={n1, n2, n3...}

 Format 2:	ARRAY arrayname[n]
..
arrayname[0] = n1
arrayname[1] = n2
..

Comments

To declare an array, you must use ARRAY, followed by the array's name.  Following the arrayname on the line is a number enclosed in square brackets, representing the dimensional size. Up to five sets of brackets may be used.  One set of brackets represents a single-dimensional array; two sets represent a two-dimensional array; three sets represent a three-dimensional array.  The size of the array can also be specified using a variable.

 Once you've declared the array, you can set the elements of the array on the same line by following the dimension size(s) with an equals sign (=) and then a list of the elements, separated by commas and surrounded by curly braces { } (See Format 1).  When using this type of initialization for arrays, the elements in the list must be numeric values; they cannot be variables or expressions.  For multi-dimensional arrays, data is stored by switching the last dimension first, and then continuing up to the first dimension. (See Array Declaration Examples.)

 If you don't wish to set the array initially, but would rather set it later in your program, you may assign values to the array elements by using Format 2. When assigning values to array elements in this fashion, the elements may be assigned with variables along with numeric values. Note that when you are setting the values of an array, the elements are numbered from 0 to (n-1), NOT from 1 to n.

 You can declare an array even if it has already been declared once.  You can change the size of each dimension and even the number of dimensions; however, by doing this, you will lose all the data that you previously stored in the array.

 Examples To define a one-dimensional array of five values, either of the following formats will create the same array:
 	int data [0]
 	ARRAY data [5] = {0, 1, 2, 3, 4}

 OR
 	int data [0]
 	ARRAY data [5]
 	data [0] = 0
 	data [1] = 1
 	data [2] = 2
 	data [3] = 3
 	data [4] = 4

 To define a two-dimensional array of three rows and two columns, both of the following formats will create the same array:
 	int data [3][2]
 	ARRAY data [3][2] = {0, 1, 2, 3, 4, 5}

 OR
 	int data [0][0]
 	ARRAY data [3][2]
 	data [0][0] = 0
 	data [0][1] = 1
 	data [1][0] = 2
 	data [1][1] = 3
 	data [2][0] = 4
 	data [2][1] = 5


asin(x)

double asin(x) double  x

The arc sine of x, a value in the range -90 to 90 degrees.

Parameters

 x

The value of x must be between -1 and 1 degrees.

Example

y = asin(0.65)


atan(x)

double atan(x) double  x

The arc tangent of x, a value in the range -90 to 90 degrees.

Parameters

 x

is any value or assigned variable.

Example

y = atan(17)


atan2(y,x)

double atan2(y,x) double  y, double  x

The arc tangent of y/x, a value in the range 180 to 180 degrees.

Parameters

 y

Any value, with the exception that both parameters are not equal to zero.

 x

Any value, with the exception that both parameters are not equal to zero.

Example

y = atan2(2,17)


ATAN3

 ATAN3 double var  dResult, double  dy, double  dx

Computes the arc tangent of dy/dx in the range 0 - 360.

Parameters

 dResult

Receives the result of the calculation

 dy

If dx and dy are 0  dResult will be set to 0

 dx

If dx and dy are 0  dResult will be set to 0


AUTO

 AUTO integer  [nViewport]

Automatically set the scale of a viewport

Return Value

@error set as follows

0 	The operation completed successfully

1 	The viewport number is invalid.

2 	The part document does not exist.

Parameters

 [nViewport]

Viewport number:

-1 	All viewports

0 (default) 	Primary viewport

>0 	Designated viewport


BASEDIM

 BASEDIM HENTITY  pBase, double  dAxis, integer  nForm, string  [Str], hLocation  [RefLoc], double array  [adRefPnt], hLocation  [loc], double  [x], double  [y], double  [z], integer  [nMatrix], vname  [hLevel], string  [Font], integer array  [iaDimInfo1], double array  [daDimInfo2], double array  [daTxtAtt], integer array  [iaEntAtt]

The BASEDIM primitive describes a base line dimension entity.  There are three forms of base line dimensions recognized in CADKEY: Ordinate, Baseline, and Running.  The BASEDIM primitive is used to describe all three of these forms.  All BASEDIM data is represented in local view coordinates.
When a BASEDIM primitive is read from a CADL file, a base linear dimension is created in the database.  A base linear dimension entity is a collection of individual base linear dimensions.  The BASEDIM primitive creates a parent base linear dimension to which child dimensions are added
When a base linear dimension is written to a CADL file as an BASEDIM primitive, a MATRIX primitive is created first. In addition to a MATRIX primitive, some arrays are created for the BASEDIM definition. When a BASEDIM primitive is read from a CADL file, all the arrays except  RefPnt are optional.  If a special value/string is desired in place of the numeric value of the base line dimension, then the string should replace the  Str parameter.
Baseline and Running dimensions will not display in CADKEY until at least one child dimension has been added.  After creating any form BASEDIM  pBase contains a handle to this base dimension.  This handle is then passed to ADDBASEDIM to add dimensions to the just created parent.
For ordinate and running style the text height given, represents the height of the witness line of the dimension.  For baseline display style, the base dimensions text height is not relivant or required.

Parameters

 pBase

Receives a handle to this basedim so children can be added.

 dAxis

Angle of dimension axis, in degrees.

 nForm

The type of base line dimension being created.

0 	Ordinate dimension

1 	Aligned Ordinate dimension

2 	Baseline dimension

3 	Running dimension

 [Str]

A character string. If it is omitted, the dimension value is calculated and displayed.

 [RefLoc]

the location the reference point.  Required if  adRefPnt is not given.

 [adRefPnt]

Array of double data that defines the coordinates of the reference point.  Required if  refloc is not given.

 [loc]

the location to place the text at.  This must be given if  dX,  dY, and  dZ are not given and  nForm is not specifying an ordinate.

 [x]

X value of the text string in text's view coordinates. If  loc is not supplied and  nForm is not specifying an ordinate this will be used for the text position.

 [y]

Y value of the text string in text's view coordinates. If  loc is not supplied and  nForm is not specifying an ordinate this will be used for the text position.

 [z]

Z value of the text string in text's view coordinates. If  loc is not supplied and  nForm is not specifying an ordinate this will be used for the text position.

 [nMatrix]

MATRIX primitive reference number. The MATRIX primitive referenced must precede this primitive or an error message is displayed and the program terminates.

0 (default) 	Use current system view in effect

 [hLevel]

Level handle, see HLEVEL

 [Font]

Name of the font to use.

 [iaDimInfo1]

An array of integer values that is used for the dimension.  For more detail refer to @diminfo1 or the Entity Information section. If this array is given  daDimInfo2 must also be given.

 [daDimInfo2]

An array of doubles that is used for the dimension. For more detail refer to @diminfo2 or the Entity Information section. If this array is given  adDimInfo1 must also be given.

 [daTxtAtt]

An array of floats that describes the attributes of the dimension text. The array is not required if the value of  Str is NULL. For more detail refer to @txtatt or the Entity Information section.

 [iaEntAtt]

An array of integer values that describes the attributes of the entity. For more detail refer to @entatt or the Entity Information section.

Comments

If the entity attribute or the text attribute arrays are missing, the system defaults will be used in their place.  If both DimInfo arrays are missing, the system defaults will be used, if only one is given the CADL program will abort processing.


BUILDWORLDMATRIX

 BUILDWORLDMATRIX hEntity  hEnt, hDrawInst  hInst, int var  WorldMat

Builds a matrix for any part references and drawing instances

Parameters

 hEnt

Handle to the entity to build the matrix for

 hInst

Handle to the instance the entity is contained in

 WorldMat

Receives the number of the created matrix


cadl_execute

extern "C" SDK_EXPORT void cadl_execute

Execute a CADL program


cadl_execute_file

extern "C" __declspec(dllexport) void cadl_execute_file

Execute a Macro CADL program

Comments

Supercedes sys_mac_cdl_exec


CDECLOSE

 CDECLOSE string  csName

Closes a CDE module from CADL

Parameters

 csName

name of CDE to close


CDEOPEN

 CDEOPEN string  csName

Opens a CDE module from CADL

Parameters

 csName

name of CDE to open


ceil(x)

integer ceil(x) double  x

The value of x rounded up to the nearest integer.

Parameters

 x

Any value.

Example

y = 5.84


CENTERLINE

 CENTERLINE integer  nType, double  dExtension, integer  nAbsolute, HLocation  [FirstLoc], HLocation  [SecondLoc], double array  [adValues], integer  [nMatrix], vname  [hLevel], integer  [nColor], integer  [nGroup], integer  [nSubGroup], integer  [nPen], integer  [nWidth]

A CENTERLINE primitive describes a centerline entity.
 When a CENTERLINE primitive is read from a CADL file, this primitive is stored in the system's database as a Centerline entity.
 When a Centerline entity is written to a CADL file, it is output as a CENTERLINE primitive.

Parameters

 nType

The type of Centerline to be created

0 	Horizontal

1 	Vertical

2 	Parallel

3 	Radial 2 CenterLines

4 	Radial 4 Lines with a point at center

5 	Radial 4 Lines with 2 lines crossed at center

6 	Radial 4 Lines with no center point

7 	Radial 4 Lines with only a center point

 dExtension

How long is the extension beyond the geometry, or provided locations.

 nAbsolute

Flag specifying if  dExtension is an absolute value (1), or a percentage of the length (0).

 [FirstLoc]

The location of the start of the centerline for non Radial types.  For radial types, this is the location of the center of the arc that the centerlines refer to.

 [SecondLoc]

Used for non radial types, pointer to the location of the end of the center line.

 [adValues]

Holds the position data for creating an un-attached centerline.  If  nType is 0 - 2 this array is used if either  FirstLoc or  SecondLoc is not provided and should contain 6 doubles for the x, y, z values of the start and end of the centerline. For Radial types this is used if  FirstLoc is not provided and should contain 4 double as follows: x, y, z of the arc center, and the radius.

 [nMatrix]

Matrix View number.  The MATRIX referenced must precede this primitive, or an error message is displayed and the program in terminated.

0 (default) 	World Coordinate system is used

 [hLevel]

Level handle, see HLEVEL

 [nColor]

Color of the entity

0-63 	Number in the system color palette

 [nGroup]

Group reference number

1-256 	Group number

0 	No group assignment

 [nSubGroup]

Subgroup reference number

1-256 	Subgroup number

0 	No subgroup assignment

 [nPen]

Pen number

1-8 	Pen number

0 	Use current system pen number

 [nWidth]

Line width

1-15 	Odd line width

0 	Use current system line width

Comments

If you wish to specify a group, you must include both the group and the subgroup number.  If either of these arguments is missing or set to zero(0), both of them will be ignored.


CHAIN

CHAIN

Allows you to switch control from the current CADLfile being executed to another CADL file. When chaining occurs,execution continues with the first statement in the specified file and no return to the original file (as with DOSUB) is made.

Comments

File Specification:
 If the filename is not a full path, it is relative to the CADL program.

 In the event of an error (namely, the specified file does not exist), execution from within the current CADL file is terminated.

Example

CHAIN fname


CHAMFDIM

 CHAMFDIM integer  nForm, HENTITY  [ChamferLine], double array  [RefLine], string  [Str], hLocation  [loc], double  [x], double  [y], double  [z], integer  [nMatrix], vname  [hLevel], string  [Font], integer array  [iaDimInfo1], double array  [daDimInfo2], double array  [daTxtAtt], integer array  [iaEntAtt]

A CHAMFDIM primitive describes a linear dimension entity. All CHAMFDIM data is represented in local view coordinates.
When a CHAMFDIM primitive is read from a CADL file, a chamfer dimension entity is created in the database.
When a chamfer dimension entity is written to a CADL file as a CHAMFDIM primitive, a MATRIX primitive is created first. In addition to a MATRIX primitive, some arrays are created for the CHAMFDIM definition.
When a CHAMFDIM primitive is read from a CADL file, all the arrays are optional. CHAMFDIM requires one reference line.  The dimension value is calculated from the line specified.  If a special value/string is desired in place of the numeric value of the dimension then the string  Str.

Parameters

 nForm

Chamfer dimension form:

0 	Chamfer dimension preceeded with "C"

1 	Chamfer dimension followed by " x 45°"

 [ChamferLine]

The line that is being dimensioned, required if  RefLine is not supplied.

 [RefLine]

The line that is being dimensioned, required if  ChamferLine is not supplied.

 [Str]

A character string. If it is omitted, the dimension value is calculated and displayed.

 [loc]

the location to place the text at.  This must be given if  dX,  dY, and  dZ are not given.

 [x]

X value of the text string in text's view coordinates. If  loc is not supplied this will be used for the text position.

 [y]

Y value of the text string in text's view coordinates. If  loc is not supplied this will be used for the text position.

 [z]

Z value of the text string in text's view coordinates. If  loc is not supplied this will be used for the text position.

 [nMatrix]

MATRIX primitive reference number. The MATRIX primitive referenced must precede this primitive or an error message is displayed and the program terminates.

0 (default) 	Use current system view in effect

 [hLevel]

Level handle, see HLEVEL

 [Font]

Name of the font to use.

 [iaDimInfo1]

An array of integer values that is used for the dimension.  For more detail refer to @diminfo1 or the Entity Information section. If this array is given  daDimInfo2 must also be given.

 [daDimInfo2]

An array of doubles that is used for the dimension. For more detail refer to @diminfo2 or the Entity Information section. If this array is given  adDimInfo1 must also be given.

 [daTxtAtt]

An array of floats that describes the attributes of the dimension text. The array is not required if the value of  Str is NULL. For more detail refer to @txtatt or the Entity Information section.

 [iaEntAtt]

An array of integer values that describes the attributes of the entity. For more detail refer to @entatt or the Entity Information section.

Comments

If the entity attribute or the text attribute arrays are missing, the system defaults will be used in their place.  If both DimInfo arrays are missing, the system defaults will be used, if only one is given the CADL program will abort processing.


CIRCLE

 CIRCLE double  xc, double  yc, double  zc, double  dRad, integer  [nMatrix], integer  nLevel, integer  nColor, integer  nStyle, integer  nGroup, integer  nSubGroup, integer  nPen, integer  nWidth

The CIRCLE primitive describes a complete 360 degree circular arc defined in a specified plane. All of the characteristics of an ARC primitive apply to a CIRCLE primitive, except that the start and end angle parameters are omitted.

Parameters

 xc

X value of circle's center in its CView

 yc

Y value of circle's center in its CView

 zc

Z value of circle's center in its CView

 dRad

Radius value of the arc in the current system units, must be >= 0.0005 and <= 10,000

 [nMatrix]

MATRIX primitive reference number. The MATRIX primitive referenced must precede this primitive or an error message is displayed and the program terminates.

0 (default) 	World Coordinate system is used

 nLevel

Level number

 nColor

Color

0-63 	Number in the system color palette

 nStyle

The line style:

1 	Solid

2 	Dashed

3 	Center Line

4 	Phantom line

0 	Use current system line type

 nGroup

Group reference number

1-256 	Group number

0 	No group assignment

 nSubGroup

Subgroup reference number

1-256 	Subgroup number

0 	No subgroup assignment

 nPen

Pen number

1-8 	Pen number

0 	Use current system pen number

 nWidth

Line width

1-15 	Odd line width

0 	Use current system line width

Comments

If you wish to specify a group, you must include both the group and the subgroup number.  If either of these arguments is missing or set to zero(0), both of them will be ignored.


CIRCLE2TANPOINTRAD

 CIRCLE2TANPOINTRAD int  n3D, double  dRad, HEntity  hEnt1, HEntity  hEnt2, int  nSeg1, double  dParam1, double array  [adPoint1], int  nSeg2, double  dParam2, double array  [adPoint2], int  nCirMat, HDrawInst  [hInst1], HDrawInst  [hInst2], int  [nMatrix]

Compute a circle with a given radius that is tangent to or passes through two entities or points respectively.

Return Value

Sets the value of @Error to one of the following

0 	Successful computation

3 	Two computation can't handle one or more of the provided entities.

4 	Any other failure.

Parameters

 n3D

Is this being done in 2d(0) or 3d(1)?  If in 2d, the provided matrix is used to project into 2d space.  Otherwise, the function attempts to create a plane based on the selected entities.  If such a plane can not be defined, it falls back to the 2d case.

 dRad

The radius of the circle.

 hEnt1

A pointer to the first entity.  If this pointer is NULL, then the first condition is a point, and its value must be stored in  rPoint1. Only one of this parameter and  pEnt2 may be NULL.

 hEnt2

A pointer to the second entity.  If this pointer is NULL, then the second condition is a point, and its value must be stored in  rPoint2. Only one of this parameter and  pEnt1 may be NULL.

 nSeg1

The guess segment for an entity first condition.  Updated to be the segment of the actual computed point upon successful return.

 dParam1

The guess parameter for an entity first condition.  Updated to be the parameter of the actual computed point upon successful return.

 [adPoint1]

Receives the first computed point for an entity first condition, or contains the point value for a point first condition.

 nSeg2

The guess segment for an entity second condition.  Updated to be the segment of the actual computed point upon successful return.

 dParam2

The guess parameter for an entity second condition.  Updated to be the parameter of the actual computed point upon successful return.

 [adPoint2]

Receives the second computed point for an entity second condition, or contains the point value for a point second condition.

 nCirMat

Receives the matrix of the circle.

 [hInst1]

The drawing instance containing the first entity.

 [hInst2]

The drawing instance containing the second entity.

 [nMatrix]

A transformation from the world space of the part to the world space of the computation.  This may also be used to project the computation into a 2d computation.


CIRCLE3TANPT

 CIRCLE3TANPT HEntity  pEnt1, HEntity  pEnt2, HEntity  pEnt3, int  nSeg1, double  dParam1, double Array  [adPoint1], int  nSeg2, double  dParam2, double Array  [adPoint2], int  nSeg3, double  dParam3, double array  [adPoint3], double array  adMatrix, double  dRadius, HDrawInst  pInst1, HDrawInst  pInst2, HDrawInst  pInst3, int  nMatrix

Compute a circle that is tangent to or passes through three entities or points respectively.

Return Value

Sets the value of @Error to one of the following

0 	Successful computation

3 	Two computation can't handle one or more of the provided entities.

4 	Any other failure.

Parameters

 pEnt1

A pointer to the first entity.  If this pointer is NULL, then the first condition is a point, and its value must be stored in  rPoint1.

 pEnt2

A pointer to the second entity.  If this pointer is NULL, then the second condition is a point, and its value must be stored in  rPoint2.

 pEnt3

A pointer to the third entity.  If this pointer is NULL, then the third condition is a point, and its value must be stored in  rPoint3.

 nSeg1

The guess segment for an entity first condition.  Updated to be the segment of the actual computed point upon successful return.

 dParam1

The guess parameter for an entity first condition.  Updated to be the parameter of the actual computed point upon successful return.

 [adPoint1]

Receives the first computed point for an entity first condition, or contains the point value for a point first condition.

 nSeg2

The guess segment for an entity second condition.  Updated to be the segment of the actual computed point upon successful return.

 dParam2

The guess parameter for an entity second condition.  Updated to be the parameter of the actual computed point upon successful return.

 [adPoint2]

Receives the second computed point for an entity second condition, or contains the point value for a point second condition.

 nSeg3

The guess segment for an entity third condition.  Updated to be the segment of the actual computed point upon successful return.

 dParam3

The guess parameter for an entity third condition.  Updated to be the parameter of the actual computed point upon successful return.

 [adPoint3]

Receives the third computed point for an entity third condition, or contains the point value for a point third condition.

 adMatrix

Receives the matrix of the circle.

 dRadius

Receives the radius of the circle.

 pInst1

The drawing instance containing the first entity.

 pInst2

The drawing instance containing the second entity.

 pInst3

The drawing instance containing the third entity.

 nMatrix

A transformation from the world space of the part to the world space of the computation.  This may also be used to project the computation into a 2d computation.


CIRDIM

 CIRDIM integer  nForm, string  [Str], hLocation  [loc], double  [x], double  [y], double  [z], HEntity  [pArc], double array  [adRefArc], hLocation  [RefCenter], double array  [adRefPnt], integer  [nMatrix], vname  [hLevel], string  [Font], integer array  [iaDimInfo1], double array  [daDimInfo2], double array  [daTxtAtt], integer array  [iaEntAtt]

The CIRDIM primitive describes a circular dimension entity. All CIRDIM data is in local view coordinates.
When a CIRDIM primitive is read from a CADL file, a circular dimension entity is created in the database.
When a circular dimension entity is written to a CADL file as a CIRDIM primitive, a MATRIX primitive is created first. In addition to a MATRIX primitive, some arrays are created for the CIRDIM definition.
When a CIRDIM primitive is read from a CADL file, all of the arrays except refarc are optional. The circular dimension entity requires one reference arc.  Based on the reference arc definition in the refarc array, the system calculates the radius or diameter of the arc/circle. If a special value/string is desired in place of the numeric value of the dimension then the string should replace the  Str.

Parameters

 nForm

Linear dimension form:

1 	Radial circular dimension

2 	Diametral circular dimension

3 	Bent radial circular dimension

 [Str]

A character string. If it is omitted, the dimension value is calculated and displayed.

 [loc]

the location to place the text at.  This must be given if  dX,  dY, and  dZ are not given.

 [x]

X value of the text string in world coordinates. If  loc is not supplied this will be used for the text position.

 [y]

Y value of the text string in world coordinates. If  loc is not supplied this will be used for the text position.

 [z]

Z value of the text string in world coordinates. If  loc is not supplied this will be used for the text position.

 [pArc]

An HENTITY handle to the arc being dimensioned. Used in place of  adRefArc

 [adRefArc]

Array of doubles that defines the coordinates of the reference arc. Each CIRDIM requires only one reference arc. For more detail refer to the System Arrays section.  If  pArc is given any values given in this parameter are not used.

 [RefCenter]

The associative location the reference center of a bent radial circular dimension.

 [adRefPnt]

Array of doubles defining the (x, y) coordinates of the reference points of a bent radial dimension.  If  RefCenter is supplied, the first 4 elements are used to define the two elbow positions. If  RefCenter is omitted, the first 6 elements are used to define first the reference center coordinate, then the two elbow points.  These are world coordinate points

 [nMatrix]

MATRIX primitive reference number. The MATRIX primitive referenced must precede this primitive or an error message is displayed and the program terminates.

0 (default) 	Use current system view in effect

 [hLevel]

Level handle, see HLEVEL

 [Font]

Name of the font to use.

 [iaDimInfo1]

An array of integer values that is used for the dimension.  For more detail refer to @diminfo1 or the Entity Information section. If this array is given  daDimInfo2 must also be given.

 [daDimInfo2]

An array of doubles that is used for the dimension. For more detail refer to @diminfo2 or the Entity Information section. If this array is given  adDimInfo1 must also be given.

 [daTxtAtt]

An array of floats that describes the attributes of the dimension text. The array is not required if the value of  Str is NULL. For more detail refer to @txtatt or the Entity Information section.

 [iaEntAtt]

An array of integer values that describes the attributes of the entity. For more detail refer to @entatt or the Entity Information section.

Comments

If  nForm == 3 (Bent radial circular dimension), then each CIRDIM requires three reference points.  They may be all static points defined in  adRefPnt, or the reference center can be associative, defined by  RefCenter with the two elbow points defined in  adRefPnt.

If the entity attribute or the text attribute arrays are missing, the system defaults will be used in their place.  If both DimInfo arrays are missing, the system defaults will be used, if only one is given the CADL program will abort processing.


CLEAR

 CLEAR   VarList

Once variables are defined, they remain defined until the CADKEY program is terminated. This causes all variables to be global and therefore, they can be used across different CADL files.  If a variable is already defined as one type, and another program attempts to use it as another type, an error will occur, so it's good practice to clear any variables defined by a CADL that don't need to remain beyond the end of the program.

Parameters

 VarList

List of variables to be undefined.  If empty, all variables will be undefined.  This does not affect part-specific variables.


CLEARSEL

 CLEARSEL integer  mode

CLEARSEL clears the selection flag of entities that have been previously selected by the GETENTM command and have not been subsequently processed by the GETNEXT command. Normally, GETNEXT clears the selection flag. However, when an exit is made from CADL before GETNEXT has processed all of the selected entities, the unprocessed entities will not be selectable by CADKEY functions. To prevent this from happening, use CLEARSEL whenever this kind of premature exit from CADL is made.
 Normally, CLEARSEL is directed to only clear the selection flags of entities in this list. This can be a problem if GETENTM is called multiple times (through programming error or otherwise) or an exit is made from CADL, CADKEY selection functions were performed, and then CADL was run again without proper cleanup. In this case, the selection list contains the currently selected entities with previously selected entities no longer on the list. When this occurs, CLEARSEL must be directed to clear the selection flags of all the entities in the database.

Parameters

 mode

Clear mode:

0 	Use selection list

1 	All entities in database


CLOSE

 CLOSE string  filename

CLOSE closes either DEVIN, DEVOUT, or a data file. Data files are normally closed only at CADL termination or whenever the EXEC command is processed. This command can be used to close a data file at any other time. DEVIN and DEVOUT are normally closed only at CADL termination. Closing DEVOUT prior to EXECing a program insures that it can read all of the DEVOUT file. DEVOUT should also be closed if DEVIN is to be used to read what was written to DEVOUT.

Parameters

 filename

DEVIN, DEVOUT, or a file name

Comments

Sample file Reading from a datafile


COMPOSITE

 COMPOSITE hentity  hComposite, string  [csName], integer  [nMatrix], vname  [hLevel], integer  [nColor], integer  [nStyle], integer  [nGroup], integer  [nSubGroup], integer  [nPen], integer  [nWidth]

Add a new composite entity to this part.

Parameters

 hComposite

Receives a handle to the created composite.

 [csName]

A name for the composite entity.  If not provided the composite will be unnamed

 [nMatrix]

The transformation MATRIX number for this composite.  If this matrix is supplied, then this transformation will be applied to all entities in the composite.  New entities that are added do not have their transformation matrix changed.  Thus, adding entities to a composite with a transformation matrix will move the entities.

 [hLevel]

Level handle for composite

 [nColor]

Color

0-63 	Number in the system color palette

255 	Use System value

 [nStyle]

The line style:

1 	Solid

2 	Dashed

3 	Center Line

4 	Phantom line

0 	Use current system line type

255 	Use System value

 [nGroup]

Group reference number

1-256 	Group number

0 	No group assignment

 [nSubGroup]

Subgroup reference number

1-256 	Subgroup number

0 	No subgroup assignment

 [nPen]

Pen number

1-8 	Pen number

0 	Use current system pen number

255 	Use System value

 [nWidth]

Line width

1-15 	Odd line width

0 	Use current system line width

255 	Use System value

Comments

If you wish to specify a group, you must include both the group and the subgroup number.  If either of these arguments is missing or set to zero(0), both of them will be ignored.

The attribute parameters are used for the entities in the composite. If these are not supplied, then attributes are not set on this entity. To use the system attributes, supply the specified "use system value" value for the attributes and 0 for the group and subgroup

This function does not set LastEnt to the created composite. A composite simply owns a set of entities.  It adds little to no semantic information other than the fact that for some reason these entities belong together.  It is a replacement for the collective mechanism of older versions of CADKEY.


CONIC

 CONIC double  a, double  b, double  c, double  d, double  e, double  f, double  xs, double  ys, double  xe, double  ye, double  [depth], integer  [nMatrix], vname  [hLevel], integer  [nColor], integer  [nStyle], integer  [nGroup], integer  [nSubGroup], integer  [nPen], integer  [nWidth]

The CONIC primitive defines a conic section (i.e., ellipse, hyperbola, parabola) in a specified plane. The CONIC primitive is based on the following equation, which is the general quadratic representation of a conic:

A*x2 + B*x*y + C*y2 + D*x + E*y + F = 0

When a CONIC primitive is read from a CADL file, a conic entity is created in the database.  If a CADL file includes a CONIC primitive with a reference to a MATRIX primitive, that MATRIX primitive must precede the CONIC primitive.

Parameters

 a

Value of the coefficient A in the quadratic representation of the conic

 b

Value of the coefficient B in the quadratic representation of the conic

 c

Value of the coefficient C in the quadratic representation of the conic

 d

Value of the coefficient D in the quadratic representation of the conic

 e

Value of the coefficient E in the quadratic representation of the conic

 f

Value of the coefficient F in the quadratic representation of the conic

 xs

X coordinate for the start point of the conic in world coordinates

 ys

Y coordinate for the start point of the conic in world coordinates

 xe

X coordinate for the end point of the conic in world coordinates

 ye

Y coordinate for the end point of the conic in world coordinates

 [depth]

Depth of the conic in world coordinates

 [nMatrix]

MATRIX primitive reference number. The MATRIX primitive referenced must precede this primitive or an error message is displayed and the program terminates.

0 (default) 	World Coordinate system is used

 [hLevel]

Level handle

 [nColor]

Color

0-63 	Number in the system color palette

 [nStyle]

The line style:

1 	Solid

2 	Dashed

3 	Center Line

4 	Phantom line

0 	Use current system line type

 [nGroup]

Group reference number

1-256 	Group number

0 	No group assignment

 [nSubGroup]

Subgroup reference number

1-256 	Subgroup number

0 	No subgroup assignment

 [nPen]

Pen number

1-8 	Pen number

0 	Use current system pen number

 [nWidth]

Line width

1-15 	Odd line width

0 	Use current system line width

Comments

If you wish to specify a group, you must include both the group and the subgroup number.  If either of these arguments is missing or set to zero(0), both of them will be ignored.


CONTINUE

CONTINUE

<Compiled CADL Only>
 The CONTINUE statement used in a loop will cause the next iteration of the loop to begin.  In a FOR loop, the execution continues with the expression that increments or decrements the loop variable.  In the WHILE and DO WHILE loops, the execution continues with the evaluation of the test condition.
 The CONTINUE statement is used to initiate the next iteration of a DO WHILE, FOR or WHILE loop, skipping any remaining statements in the body of the loop.
 When a CONTINUE statement is encountered in a FOR loop, the program control is transferred to the iteration expression of the loop to increment or decrement the loop variables. After that, the test condition for the loop is evaluated. If it is true (nonzero), the next iteration of the loop starts. If the test condition is false, the loop terminates.

In a DO WHILE or a WHILE loop, the CONTINUE statement transfers the program control to the evaluation of the test condition of the WHILE clause. If the result is true, the next iteration of the loop is started. If it is false, the loop terminates.

Example

WHILE(condition)

    {

    if(skip_iteration)

CONTINUE

    loop body

    }


copsize(type)

integer copsize(type) word  Type

Size of copious entity item.

Parameters

 Type

 Type can be any one of the following constants (either upper or lowercase letters may be used):

char 	character

uchar 	unsigned character

int 	integer

uint 	unsigned integer

short 	short integer

ushort 	unsigned short

long 	long integer

ulong 	unsigned long

float 	float

double 	double

tcode 	copious entity type code

Example

s = copsize (long)

 (s will be equal to 4)


cos(x)

double cos(x) double  x

The cosine of the angle x, a value in the range 1 to 1.

Parameters

 x

Any angle value, x in degrees.

Example

y = cos(67.3)


cosh(x)

double cosh(x) double  x

The hyperbolic cosine of the angle x, a value in the range greater than or equal to one.

Parameters

 x

Any angle value, x in degrees.

Example

y = cosh(67.3)


CPlaneToWorld

 CPlaneToWorld double  dX, double  dY, double  dZ

Converts a CPlane coordinate to be World relative

Parameters

 dX

X value of the coordinate to be changed, this may also be a double array of three values representing the coordinate to modify, in which case the next two parameters  y and  z are skipped.  Otherwise they are required as the other two elements of the coordinate.

 dY

Y value of the coordinate to be changed

 dZ

Z value of the coordinate to be changed


CROSSPROD

 CROSSPROD double array  dResult, double array  adVec1, double array  adVec2

Compute the cross product of two vectors

Parameters

 dResult

The value of the cross product

 adVec1

First vector

 adVec2

Second vector


DATUM

 DATUM string  text, int  nAttach, hLocation  [locSymbol], double  [xSymbol], double  [ySymbol], double  [zSymbol], hLocation  [locLeader], double  [xLeader], double  [yLeader], double  [zLeader], opt int  nStandard, integer  [nMatrix], vname  [hLevel], string  [Font], double array  [daTxtAtt], integer array  [iaEntAtt]

Adds a new Datum to this part

Parameters

 text

The text displayed in the datum.

 nAttach

Where is the datum attached, for datums attached to GeoTol and dimension entities.

0 	Normal Attachment to a Location on a target entity

1 	Attachment via an extension line from a target entity

2 	Above the center of the target entity (usually a GEOTOL) uses the top center of the target entity to work from

3 	Below the center of the target entity (usually a GEOTOL) uses the top center of the target entity to work from

4 	Above the arrows of the first Witness, denoting an edge plane

5 	On the arrows of the first Witness, denoting a center plane

6 	Above the arrows of the second Witness, denoting an edge plane

7 	On the arrows of the second Witness, denoting a center plane

 [locSymbol]

the location to place the symbol at. This must be given if  dX,  dY, and  dZ are not given.

 [xSymbol]

X value of the symbol in world coordinates. If  loc is not supplied this will be used for the text position.

 [ySymbol]

Y value of the symbol in world coordinates. If  loc is not supplied this will be used for the text position.

 [zSymbol]

Z value of the symbol in world coordinates. If  loc is not supplied this will be used for the text position.

 [locLeader]

the location to place the leader at. This must be given if  dX,  dY, and  dZ are not given.

 [xLeader]

X value of the leader in world coordinates. If  loc is not supplied this will be used for the text position.

 [yLeader]

Y value of the leader in world coordinates. If  loc is not supplied this will be used for the text position.

 [zLeader]

Z value of the leader in world coordinates. If  loc is not supplied this will be used for the text position.

 nStandard

The standard used for this datum.  ANSI82 datums have a different appearance than ASME94/ISO datums.

0(default) 	No defined standard

1 	ANSI Y14.5M-1982

2 	ASME Y14.5M-1994

3 	ISO

4 	DIN

5 	JIS

6 	KS

 [nMatrix]

MATRIX primitive reference number. The MATRIX primitive referenced must precede this primitive or an error message is displayed and the program terminates.

0 (default) 	Use current system view in effect

 [hLevel]

Level handle

 [Font]

Name of the font to use.

 [daTxtAtt]

An array of floats that describes the attributes of the dimension text. The array is not required if the value of  Str is NULL. For more detail refer to the System Arrays section.

 [iaEntAtt]

An array of integer values that describes the attributes of the entity.  For more detail refer to the System Arrays section.

Comments

If the entity attribute or the text attribute arrays are missing, the system defaults will be used in their place.


DBLSCL

 DBLSCL integer  [nViewport]

Automatically double the scale of a viewport

Return Value

@error set as follows

0 	The operation completed successfully

1 	The viewport number is invalid.

2 	The part document does not exist.

Parameters

 [nViewport]

Viewport number:

-1 	All viewports

0 (default) 	Primary viewport

>0 	Designated viewport


DEFATTR

 DEFATTR   Keyword1,   Keyword2

Used in conjunction with SETATTR, allows for a number of entity attributes to be changed through CADL file execution.  The purpose of DEFATTR is to define which attributes are to be set, as as the order in which they are to appear.  Once defined here, SETATTR is called to actually modify the attributes listed.

Parameters

 Keyword1

The first attribute keyword

 Keyword2

The second attribute keyword and so on

Comments

The following are the kewords that are supported as the parameters.

COLOR 	Color

FCOLOR 	Fill color

GRPNUM 	Group number. Must be before SUBGRP if these are used.

LEVEL 	Level handle

LINETYPE 	Line type

LINEWIDTH 	Line width

PEN 	Pen number

SUBGRP 	Subgroup number. Must be after GRPNUM if these are used.

TEXTANG 	Text rotation angle

TEXTASP 	Text aspect ratio

TEXTFILL 	Text fill mode

TEXTHT 	Text height

TEXTLINE 	Text line spacing factor

TEXTMIR 	Text mirror mode

TEXTSLANT 	Text slant angle

TEXTSTRIKE 	Text strikethrough mode

TEXTULINE 	Text underline mode


DELENT

 DELENT   [vname]

Deletes a single entity

Return Value

@Error set to one of the following

3 CK_NO_PART 	The part document does not exist.

2 CK_BAD_ENT 	The entity handle is invalid

1 CK_NOT_ALLOWED 	Deletion of that entity is not allowed

0 CK_NOERROR 	The entity was succesfully deleted.

Parameters

 [vname]

Handle to the entity to delete.  Last selected or created entity's handle can be retrieved through LASTENT.  If this is not provided, the contents of the selection list will be deleted.


Distance

 Distance vname double  dDistance, double  dx1, double  dy1, double  dz1, double  dx2, double  dy2, double  dz2, integer  [nMatrix]

Calculated the distance between two coordinates.

Parameters

 dDistance

Receives the calculated distance

 dx1

X value of first coordinate

 dy1

Y value of first coordinate

 dz1

Z value of first coordinate

 dx2

X value of second coordinate

 dy2

Y value of second coordinate

 dz2

Z value of second coordinate

 [nMatrix]

MATRIX primitive reference number. The MATRIX primitive referenced must precede this primitive or an error message is displayed and the program terminates.  This is used if the points are to be projected into a given matrix before the distance is determined

0 (default) 	Use current system view in effect


dms(d, m, s)

double dms(d, m, s) Numeric  d, Numeric  m, Numeric  s

Calculates an angle in degrees from the degree, minute, second notation.  This will then accept the angle as specified, as 60ths for example, when both dimensioning and creating. Returns a single value in degrees using this formula:
 	dms = d + (m/60) + (s/3600)

Parameters

 d

Degree value

 m

Minute value

 s

Second value

Example

y = dms (23, 2, 55)

 y will be equal to 23.0486


DOSUB

 DOSUB Quoted String  fname

Transfers control to another CADL file. However, once the end of file is reached or an EXIT command is processed (within the file to which control has been transferred), control returns to the current file and execution continues at the statement following the DOSUB.

Parameters

 fname

CADL file to transfer control to

Comments

File Specification:
 If the filename is not a full path, it is relative to the CADL program.

 In the event of an error (namely, the specified file does not exist), execution from within the current CADL file is terminated.

Example

DOSUB fname


DOTPROD

 DOTPROD double var  dResult, double array  adVec1, double array  adVec2

Compute the dot product of two vectors

Parameters

 dResult

The value of the dot product

 adVec1

First vector

 adVec2

Second vector


DO…WHILE

DO…WHILE

<Compiled CADL Only>
 The DO WHILE statement executes in a similar fashion as the WHILE statement except that the test condition is evaluated after every iteration of the loop.

The body of the DO WHILE loop (enclosed within the braces) is executed in each pass. At the end of the pass, the expression for the WHILE statement is evaluated. If the expression is false (zero), the loop terminates and the program continues with the statement following the loop. If the expression is true (non-zero), the whole process repeats.

If the statement block consists of only one statement, it does not have to be enclosed in braces.

Example

DO

    {

...

    statement-block

...

    } WHILE (expr)


ENDPOINTS

 ENDPOINTS hEntity  hEnt, hDrawInst  hInst, double array  adStart, double array  adEnd

Determine the two end points of the given entity

Parameters

 hEnt

Entity to extract endpoints of

 hInst

Instance the entity is contained in

 adStart

Received the (x,y,z) of the start point

 adEnd

Received the (x,y,z) of the end point


ENTINFO

 ENTINFO hentity var  rEntity, int var  nSeg, int var  nStartSeg, double var  dStartParam, int var  nEndSeg, double var  dEndParam, int var  bClosed

Retrieve the number of segment, number and parameter value of the start segment, number and parameter value of the end segment for the given entity.

Return Value

@error Set to one fo the following

0 	Information successfully retrieved.

1 	The entity pointer is invalid.

3 	The entity type doesn't support this operation.

Parameters

 rEntity

Handle to the entity to get information about.

 nSeg

Returns the number of segments in the entity.

 nStartSeg

Returns the segment number of the start point of the entity.

 dStartParam

Returns the parameter value of the start point of the entity.

 nEndSeg

Returns the segment number of the end point of the entity.

 dEndParam

Returns the parameter value of the end point of the entity.

 bClosed

Returns true if the entity is closed (forms a closed loop).


ENTLENGTH

 ENTLENGTH HEntity  hEnt, double var  dLength

Gets the length of the specified entity.  Length will be returned as 0.0 for entities where length is meaningless.

Parameters

 hEnt

Handle to the entity to get information about.

 dLength

Returned length of the entity


ENTLEVEL

 ENTLEVEL HEntity  hEnt, HLevel  hLevel

Gets the level of the specified entity.

Parameters

 hEnt

Handle to the entity to get information about.

 hLevel

Returned handle of the entitys level


EVALUATEENT

 EVALUATEENT HEntity  hEnt, HDrawInst  hInst, int  nFlatten, int  nExtendStart, int  nExtendEnd, int  nSeg, double  dParam, int  [nTransMat], double array var  adCoord, double array var  [adCoord], double array var  [adCoord], double array var  [adCoord]

Evaluate various mathematical attributes of the entity at the given segment and parameter values.

Return Value

@error Set as follows

0 	The values were computed

3 	This entity doesn't support this operation.

4 	The segment number is out of range.

5 	The parameter value is out of range.

6 	The segment number or parameter value was forced to be in the displayed range for the entity before the computation.  (Only if  bExtendCurveStart or  bExtendCurveEnd is false.)

Parameters

 hEnt

Handle to the entity to get information about.

 hInst

Handle to the instance, if this is an instance specific entity in layout mode.  For a model mode entity, or a layout specific entity, this must be set to NULL.

 nFlatten

Should the return values be flattened into the XY plane?  If true, the Z values are set to 0.0.

 nExtendStart

Should the curve be extended beyond the start of its visible region, if possible, to complete the computation.

 nExtendEnd

Should the curve be extended beyond the end of its visible region, if possible, to complete the computation.

 nSeg

The given segment number.

 dParam

The given parameter value.

 [nTransMat]

The matrix for converting from the world space of the object to the computation world space.  This matrix is applied before the projection matrix.

 adCoord

The coordinate of the given segment and paramter

 [adCoord]

The normal vector (first derivative) at the point.

 [adCoord]

The curvature (second derivative) at the point.

 [adCoord]

The third derivative at the point.


EXEC

 EXEC string  command

The EXEC statement allows external programs or system processes to be accessed and run from inside the CADL program.  Information may be passed to an external program for processing, information display, etc.  When executed, this command temporarily suspends the system and executes the requested command(s).

Parameters

 command

The command desired at the prompt, including any parameters, redirection, or pipes.


EXIT

EXIT

Causes an immediate exit from the CADL file being executed.  If processing of the current file was the result of a DOSUB from another file, control returns to that file. Otherwise, CADL processing is complete and control is returned to the CADKEY program.

Example

EXIT


EXITLOOP

EXITLOOP

<Compiled CADL Only>
 The EXITLOOP statement in a FOR, WHILE and DO WHILE loop terminates the execution of that loop.  If the loop is nested inside another loop, the execution of the outer loop is not affected.

The EXITLOOP statement is used to break out of a loop during any of its iterations. When an EXITLOOP statement is encountered in a DO WHILE, FOR or WHILE loop, the program skips any remaining statements in the body of that loop and continues execution with the first statement following that loop.

If an EXITLOOP statement is executed in a loop that is nested within another loop, only the inside loop is terminated and the program continues with the outer loop.


exp(x)

double exp(x) double  x

Returns the value e to the x of e^x (natural exponential function).

Parameters

 x

Any value x.

Comments

When the resultant value overflows, CADKEY sets the value to the largest possible double-precision value.

Example

y = exp(3)


EXPORTPART

 EXPORTPART string  sFileName, String  sPartName, integer  [nMatrix], integer  [nOption]

Export selected geometry into a CKPartDoc

Parameters

 sFileName

The full pathname of the design file to recieve the new part.

 sPartName

The name of the part in the design file.

 [nMatrix]

MATRIX primitive reference number. The MATRIX primitive referenced must precede this primitive or an error message is displayed and the program terminates.

 [nOption]

What to do with the original entities in the part

0 	Leave the entities as they are now. (Default)

1 	Delete the entities.

2 	Replace the entities with a reference to the new part.


EXTENDLINE

 EXTENDLINE double array  adStart, double array  adEnd, int  [nMode], integer  [nViewport]

Extends a line until it reaches the window border. If the line is defined by two points and is parallel to the view z axis, then the input points are not altered.

Return Value

@error set as follows

0 	The operation completed successfully

1 	The viewport number is invalid.

2 	The part document does not exist.

Parameters

 adStart

Start point input and return.

 adEnd

End point input and return.

 [nMode]

Input mode

0(default) 	 ckcStart and  ckcEnd define a line to extend

1 	 ckcStart defines a point through which a horizontal line is drawn, and extended to the border.

2 	 ckcStart defines a point through which a vertical line is drawn, and extended to the border.

 [nViewport]

Viewport number:

-1 	All viewports

0 (default) 	Primary viewport

>0 	Designated viewport


floor(x)

double floor(x) double  x

The value of x rounded down to the nearest integer.

Parameters

 x

Any value x.

Comments

Because the CADL does not do integer arithmetic by truncation, use floor to approximate integer arithmetic by truncation.

Example

y = 5.84

 x = floor(y)

 x will be equal to 5


fmod(x, y)

double fmod(x, y) double  x, double  y

Returns floating point remainder of an integer division, as modulus, x mod y.

Parameters

 x

Any value.

 y

Any value.

Example

x = 55.32

 y = fmod (x, 3)

 y will be equal to 1.32


FNOTE

FNOTE

The FNOTE primitive has been replaced with the NOTE primitive.  A note type parameter has been added to the NOTE primitive to allow for specification of what type of note is being created.  See NOTE for full details.


FOR

FOR

<Compiled CADL Only>
 The FOR statement provides a means to loop through a set of commands, with control over the initialization of the loop, a test condition, and any loop variables.

A FOR loop is used to execute a statement block a fixed number of times using the optional expressions expr1, expr2, and expr3 to control the initialization, test, and iteration, respectively.

In a FOR loop, expr1 is evaluated first. This expression is typically used to assign initial values to loop variables. It can be left out if there are no loop variables to initialize.

Expr2 is the test condition for the loop. It is evaluated before the body of the loop is executed. If the result is false (zero), the statements in the body of the loop (enclosed in braces) are skipped and the program continues with the first statement following the FOR loop.

If expr2 is true or it is omitted, the statement block (enclosed within the braces) is executed. Expr3 is then evaluated to increment or decrement any loop variables. This expression can also be omitted.  If the statement block consists of only one statement, it does not have to be enclosed in braces.

Example

FOR ([expr1];  [expr2];  [expr3])

    {

...

    statement-block

...

    }


GENDIM

 GENDIM integer  nLines, integer  nArcs, integer  nArrows, word  dArrayName, integer  nArrowType, double  x, double  y, string  strText, integer  [nMatrix], double  [dRotation], double  [dHeight], double  [dAspect], integer  [nColor], vname  [hLevel], string  [strFont], integer  [nGroup], integer  [nSubGroup], integer  [nPen], integer  [nSlant], integer  [nFill]

A GENDIM (generic dimension) primitive describes the geometry and text used in a CADKEY generic dimension entity.
When a GENDIM primitive is read from a CADL file, a generic dimension entity is created in the CADKEY database in the specified view. The dimension's associativity is maintained, but it is not as flexible with modification and movement as other dimension entities in CADKEY.
A MATRIX is created first (if necessary) which the GENDIM primitive may reference as its definition matrix view.
When using a GENDIM primitive to create, all or some of the following entities may be used:
1) lines
2) arcs
3) arrowhead points
4) text
This creates a single Generic Dimension entity in CADKEY, which can only be manipulated as a whole.

Parameters

 nLines

Number of lines in dimension

 nArcs

Number of arcs in dimension

 nArrows

Number of arrowheads in dimension

 dArrayName

Name of one-dimensional data array containing line, arc, and arrowhead data (in that order). Size of array is dependent upon the number of items.
The data required for each item is as follows:

Line data:
x1     X value of endpoint 1 in GENDIM's view coordinates
y1     Y value of endpoint 1 in GENDIM's view coordinates
x2     X value of endpoint 2 in GENDIM's view coordinates
y2     Y value of endpoint 2 in GENDIM's view coordinates

Arc data:
xc     X value of arc center in GENDIM's view coordinates
yc     Y value of arc center in GENDIM's view coordinates
rad    arc radius
ang1   starting angle (degrees)
ang2   ending angle (degrees)

Note that the arc is drawn counter-clockwise from ang1 to ang2.

Arrowhead data:
X   X value of arrowhead point in GENDIM's view coordinates
Y   Y value of arrowhead point in GENDIM's view coordinates
ang     angle of arrowhead away from point (degrees)

For example, if the dimension contains one line and one arrowhead, the array is set as follows:

arrayname  [0] = x1    (line data)
   [1] = y1
   [2] = x2
   [3] = y2
   [4] = x     (arrowhead data)
   [5] = y
   [6] = ang

 nArrowType

Arrowhead type:

0 	Style 1

1 	Style 2

2 	Style 3

3 	Style 4

 x

X value of the anchor point of the text string in view coordinates

 y

Y value of the anchor point of the text string in view coordinates

 strText

The text of the generic dimension

 [nMatrix]

MATRIX primitive reference number. The MATRIX primitive referenced must precede this primitive or an error message is displayed and the program terminates.

0 (default) 	Use current system view in effect

 [dRotation]

The rotation angle of the text about the XY coordinate (in degrees) rot must be >= 0 and <= 360 degrees

 [dHeight]

The character height in system world units

 [dAspect]

The text aspect ratio (width/height)

 [nColor]

The color assigned to the note entity

0-63 	Number in the system color palette

 [hLevel]

Level assigned to the note entity

 [strFont]

Text font name assigned to the note entity

 [nGroup]

Group reference number

1-256 	Group number

0 	No group assignment

 [nSubGroup]

Subgroup reference number

1-256 	Subgroup number

0 	No subgroup assignment

 [nPen]

Pen number

1-8 	Pen number

0 	Use current system pen number

 [nSlant]

Text slant angle, must be >= -31 and <= 31 degrees

 [nFill]

Fill mode

0 	Nonfilled text

1 	Filled text

Comments

If you wish to specify a group, you must include both the group and the subgroup number.  If either of these arguments is missing or set to zero(0), both of them will be ignored.


GENSEL

 GENSEL string  Prompt, int var  nument, int  [nSelFlag], int  [nCollSel], int  [bSelRefEnts], int  [bPosSnap], int  [bAccept], int  [bLayFlag], int  [bSelInst]

Invokes the CADKEY general selection mechanism and waits until one or more entities are selected before returning control to the CADL program. The number of entities selected is returned in a specified variable. Restrictions on the selectable entity types may be applied by using any of the SET masking statements directly preceding the GETENTM statement.
 If the selection process is successful, the GETNEXT statement is subsequently used to retrieve the data on selected entities one at a time in the order that they were selected.

Parameters

 Prompt

The prompt to display.

 nument

Number of entities selected.

 [nSelFlag]

Flag to indicate whether select the entity with selection flag on or not.  (Default is 0)

 [nCollSel]

Option to indicate how to handle collections. (Default is 0, entities treated as individuals)

 [bSelRefEnts]

If 1, then reference entities can be selected. If 0, then the PartRef itself is selected. (Default is 1)

 [bPosSnap]

Indicate whether to use Position Snap or not. (Default is 1)

 [bAccept]

Indicate whether to use Accept button or not. (Default is 0)

 [bLayFlag]

Indicate whether to restrict layout mode selection or not.  (Default is 0)

 [bSelInst]

Indicate whether to select an instance when an instance specific entity is selected.  (Default is 0)


GEOTOL

 GEOTOL vname  hGeoTol, integer  nFrames, double  [x], double  [y], double  [z], integer  [nMatrix]

Creates a Geometric Dimensioning & Tolerancing (GD&T/GeoTol) symbol.

Parameters

 hGeoTol

Receives a handle to the GeoTol

 nFrames

The number of frames in the symbol

 [x]

The x coordinate of the symbol

 [y]

The y coordinate of the symbol

 [z]

The z coordinate of the symbol

 [nMatrix]

Matrix View number.  The MATRIX referenced must precede this primitive, or an error message is displayed and the program is terminated.

0 (default) 	World Coordinate system is used


GET

 GET word  KeyWord, double  dValue ...

The GET command allows for a number of system patameters to be set.

Parameters

 KeyWord

Specifies what parameter is being set.  May be exactly one of the following:

A0REP 	Get the mode for displaying + or - signs in front of a zero angular dimension tolerance value. When turned on, the sign is not displayed.

ALTMODE 	Get the mode for angular dimension tolerance. Values are as follows:
 0 - No tolerance.
 1 - Basic tolerance, drawn surrounded by box.
 2 - Plus tolerance above minus tolerance.
 3 - Tolerances are the same, uses +/- symbol.
 4 - Upper and lower limits instead of value.
 5 - Upper and lower limits on one line.

ANG_REP 	Get the representation angular dimensions are displayed in.
 3 - degrees
 4 - degrees minutes seconds
 5 - Radians
 6 - Gradians

ARR1STYLE 	Get the current style of the first arrowhead.

ARR2STYLE 	Get the current style of the second arrowhead.

ARRDIR 	Get the current direction of the arrowheads: in (0), out (1), or auto (3).

ARR_GAP 	Get the arrowhead gap factor. When his factor is multiplied by the dimension height, it results in the rise that the witness line makes above the leader line.

ATOL_MAX 	Get the maximum tolerance value for angular dimensions.

ATOL_MIN 	Get the minimum tolerance value for angular dimensions.

AUTOCNTR 	Get the mode for automatically centering dimension text. When turned on, the dimension text is automatically centered.

AUTOMAN 	Get the mode for automatically dimensioning text. When turned on, the text is automatically placed in the dimension. When turned off, the text must be entered manually.

COLOR 	Get the current drawing color number

CONST_3D 	Get the 3d construction mode.  (true = 3d, false = 2d)

CPLANE 	Get the current CPlane number

DECDMS 	Get the representation for the angle measurement format.
 3 - decimal degree format
 4 - degree, minute, second format

DECIMAL_POINT 	Get the "Decimal Point" format character

DEC_RND_ANG 	Get the round off factor for angular dimensions, when the unit of the dimension is fractional, or feet and inches.

DEC_RND_DUAL 	Get the round off factor for dual dimensions, when the unit of the dimension is fractional, or feet and inches.

DEC_RND_LIN 	Get the round off factor for linear dimensions, when the unit of the dimension is fractional, or feet and inches.

DEPTH 	Get the construction plane depth

DETAILSTD 	Get the standard being used for detailing.
 0 - No standard
 1 - ANSI standard
 2 - ISO standard
 3 - DIN standard
 4 - JIS standard
 5 - KS standard

DIGANGLE 	Get the Digitization Rotation (radians)

DIMALIGN 	Gets the text alignment of dimension entities.  On and the text will line up with the dimensions leader lines.

DIMASP 	Get the width/height ratio of dimension text characters. A value of 0.5 will produce characters of normal aspect ratio. A value > 0.5 causes the characters to be compressed horizontally. A greater value causes expansion. All subsequently created dimensions will have this aspect ratio assigned.

DIMFILL 	Get the current dimension text fill mode.

DIMHALIGN 	Get the horizontal alignment for dimension text.

DIMHT 	Get the current dimension text height.  All subsequently created dimensions will have this height assigned.

DIMJUSTIFY 	Get the dimension text justification.

DIMLBLDISP 	Get the dual dimension label display flag

DIMMIRROR 	Get the current dimension text mirror mode. All subsequently created dimensions will have this mirror mode.

DIMMODE_ANG 	Get the angular dimension mode, or the system of measurement.
 3 - degree format
 4 - degree, minute, second format

DIMMODE_LIN 	Get the linear dimension mode, or the system of measurement.
 0 - decimal format
 1 - fractional format
 2 - feet and inches format

DIMMODIFIER 	Gets the modifier for the design intent of the dimension and describes a prefix that appears between the user-specified prefix and the text of the dimension.
 0 - NoMod,
 1 - Diameter,
 2 - SphericalDiameter,
 3 - Radius,
 4 - SphericalRadius,
 5 - ControlledRadius,
 6 - Square,
 7 - ArcLength,
 8 - PlateThickness

DIMSCALE 	Get the scale factor applied to dimension values.

DIMSHORT 	Get the mode for short leaders for radial and diametral dimensions. When turned on, short leaders are used, otherwise, normal leaders are used.

DIMSLANT 	Get the current dimension text slant angle. The angle ranges from 31 (extreme slant to the left) through -31 (extreme slant to the right), with 0 being the midpoint (no slant).

DIMSPACE 	Get the dimension text line spacing factor

DIMSTRIKE 	Get the current dimension text strikethrough mode.

DIMULINE 	Get the current dimension text underline mode.  All subsequently created dimensions will have this underline mode.

DIMVALIGN 	Get the vertical alignment for dimension text.

DIMVALUE 	Get the user entered value of a dimension, if any.

DIM_COMPONENTS 	Gets the Use Component attributes for detail entities flag.

DISPVIEW 	Gets the number of new display view, optional viewport number

DUALDIM 	Get the dual dimension use flag.

DUALLBLDISP 	Get the dual dimension label display flag

DUALPLACE 	Get the placement mode of dual dimensions.

DUALPREC 	Get the precison of dual dimensions.

DUALREP 	Get the dual dimension representation.

DUALREP 	Get the representation of the dual dimension.

DUALRND 	Get the rounding factor for dual dimensions.

DUALSCALE 	Get the scale factor for dual dimensions.

DUALUNITS 	Gets the units to use for dual dimensions.

EDITVALUE 	Get the mode for using a manually entered value for the dimension display, or using the actual calculated value.  When turned on the manually entered value is used.

FILLCOLOR 	Get the current fill color value.  If the high order byte is set, this is an index into the entity color palette, otherwise it is an actual RGB value.

FRACT_RND_DUAL 	Get the round off factor for dual dimensions,  when the unit of the dimension is fractional, or feet and inches.

FRACT_RND_LIN 	Get the round off factor for linear dimensions, when the unit of the dimension is fractional, or feet and inches.

GRID 	Get the display of the grid on or off.

GRIDINC 	Get the grid parameters: x spacing, y spacing, x offset and y offset

L0REP 	Get the mode for displaying + or - signs in front of a zero linear dimension tolerance value. When turned  on, the sign is not displayed.

LDR_DIST 	Get the gap from the dimension text to a solid leader line.  Used in conjunction with the CK_SET_LDR_DISTOPT flag.

LDR_DISTOPT 	Get the meaning of the leader distance value.
 0 - value is a percentage of text height.
 1 - value is an absolute value.

LDZERO_ANG 	Get the mode for displaying leading zeros in angular dimensions. When turned on, keeps the leading zeros.

LDZERO_DUAL 	Get the mode for displaying leading zeros in dual dimensions. When turned on, keeps the leading zeros.

LDZERO_LIN 	Get the mode for displaying leading zeros in linear dimensions. When turned on, keeps the leading zeros.

LEADER 	Get the current leader display style. All subsequently created leaders will be this style. Possible values are:
 0 - both leader lines.
 1 - first leader line.
 2 - second leader line.
 3 - no leader line.
 4 - solid leader line.
 5 - 1st leader line to be solid.
 6 - 2nd leader line to be solid.
 7 - solid leader with no arrowheads.

LIMIT 	Gets the current line segment termination mode of the CADKEY line creation functions.
 0 - the line endpoints are coincident with the positions specified.
 1 - line segments are extended through positions to the intersection with the boundary of the viewport of definition.

LINESTYLE 	Gets the current line style.  All subsequently created geometry will have this line style.

LINEWIDTH 	Gets the current line width.  All subsequently created geometry will have with this width.

LTLMODE 	Get the tolerance mode for linear dimensions. Values are as follows:
 0 - No tolerance.
 1 - Basic tolerance, drawn surrounded by box.
 2 - Plus tolerance above minus tolerance.
 3 - Tolerances are the same, uses +/- symbol.
 4 - Upper and lower limits instead of value.
 5 - Upper and lower limits on one line.

LTOL_MAX 	Get the maximum tolerance value for linear dimensions

LTOL_MIN 	Get the minimum tolerance value for linear dimensions

MODBRKATRIB 	Get the modify break attribute option

MODBRKGROUP 	Get the modify break group rules option

MODBRKLEVEL 	Get the modify break level override

NOTEANG 	Get the angle of a vector along which all subsequently created note, disknote, and label text is drawn.  The angle ranges from 0.0, a horizontal vector running from left to right, through 2 PI, measured in a counter-clockwise direction.

NOTEFILL 	Get the current note text fill mode. All subsequently created notes, disk notes, and labels will have this fill mode.

NOTEHALIGN 	Get the horizontal alignment for note text.

NOTEHT 	Get the current note text height. All subsequently created notes, disk notes, and labels will have this height assigned.

NOTELINE 	Get the current note text line spacing factor. The product of this factor and the character height is equal to the distance between the lines of text. All subsequently created notes and disk notes will use this factor.

NOTEMIRROR 	Get the current note text mirror mode.  All subsequently created notes, disk notes, and labels will have this mirror mode.

NOTESLANT 	Get the slant for the note text.

NOTESPACE 	Get the spacing for the note text lines.

NOTESTRIKE 	Get the current note strikethrough mode.

NOTEULINE 	Get the current note text underline mode. All subsequently created notes, disk notes, and labels will have this underline mode.

NOTEVALIGN 	Get the vertical alignment for note text.

PAR_DIR 	Get the note paragraph direction

PEN 	Get the current pen number.

POSSNAP 	Get the position snap flag.

POSSNAP_CTR 	Get the center snap flag.

POSSNAP_END 	Get the endpoint snap flag.

POSSNAP_MID 	Get the midpoint snap flag.

POSSNAP_PNT 	Get the point snap flag.

POSSNAP_QUAD 	Get the quadrant snap flag.

POSSNAP_SIZE 	Get the position snap search radius.

POSSNAP_X2D 	Get the 2D intersection snap flag.

POSSNAP_X3D 	Get the 3D intersection snap flag.

PRECISION_ANG 	Get the decimal precision for angular dims

PRECISION_DUAL 	Get the decimal precision for dual dims

PRECISION_LIN 	Get the decimal precision for linear dims

QTRIM 	Enable the quick trim mode

SELLIST 	Get the selection list mode

SELTOGGLE 	Get the selection toggle key

SNAP 	Get the snap mode on or off.

SNAPINC 	Get the snap parameters: x spacing, y spacing, x offset and y offset

TEXTASP 	Get the width/height ratio of note text characters. A value of 0.5 will produce characters of normal aspect ratio. A value > 0.5 causes the characters to be compressed horizontally. A greater value causes expansion. All subsequently created text entities will have this aspect ratio assigned.

TOL_SCALE 	Get the text scale factor for double-up tolerancing.

TRZERO_ANG 	Get the trailing zeros mode for angular dimensions. When turned on, keeps the trailing zeros.

TRZERO_DUAL 	Get the trailing zeros mode for dual dimensions. When turned on, keeps the trailing zeros.

TRZERO_LIN 	Get the trailing zeros mode for linear dimensions. When turned on, keeps the trailing zeros.

UNIT 	Get the drawing units of the model.

UNITSCALE 	Gets the scale of the part units for UserDefined units. If the units are not user defined, they will be changed to UserDefined. The scale is the number of UserUnits per inch.

VERSEL 	Enable selection verification mode

WITANGLE 	Get the angle by which to sheer the dimension witness lines.

WITNESS 	Get the display of witness lines in dimensions. All subsequently created dimensions will use this witness line display mode. Possible display mode values are:
 0 - Both
 1 - First
 2 - Second
 3 - None

WIT_GAP 	Get the witness line gap factor. When this factor is multiplied by the dimension height, it results in the distance (gap) between the witness line and its reference point.

WORLD_COORD 	Get the world construction mode. (true = world, false = cplane)

XFCPYOPT 	Gets the copy option

XFGRPOPT 	Use the group option

XFJPTCPY 	Join using the copy option

XFJPTOPT 	Get the join option

XFJPTRUL 	Resolve the ambiguity

XFLEVOPT 	Use the Active level

 dValue ...

The value(s) retrieved from the system parameter(s) to.


GETALL

 GETALL int Variable  numEnt, integer  ViewportNum

GETALL selects all of the entities residing within the current window boundaries. The number of entities selected is returned in a specified variable. Restrictions on the selectable entity types may be applied by using one of the SET masking statements directly preceding the GETALL statement.
 If the selection process is successful, the GETNEXT statement is subsequently used to retrieve the data on selected entities one at a time in the order that they were selected. See GETNEXT for more information.

Return Value

@error

2 	invalid viewport number

1 	no entities were selected

0 	success

Parameters

 numEnt

the number of entities that were selected.

 ViewportNum

the viewport number to select in.  0 or default will get entities from the primary viewport.


GetAxisAngle

 GetAxisAngle double  dX1, double  dY1, double  dZ1, double  dX2, double  dY2, double  dZ2, integer  [nMatrix], double var  dAngle

This function determines the angle formed by the line defined by the two given points, and the X-axis of the given MATRIX primitive.

Parameters

 dX1

The X value of the start of the desired axis.

 dY1

The Y value of the start of the desired axis.

 dZ1

The Z value of the start of the desired axis.

 dX2

The X value of the end of the desired axis.

 dY2

The Y value of the end of the desired axis.

 dZ2

The Z value of the end of the desired axis.

 [nMatrix]

MATRIX primitive reference number. The MATRIX primitive referenced must precede this primitive or an error message is displayed and the program terminates.

0 (default) 	Use current system view in effect

 dAngle

Variable to store return axis value in degrees


GETCPLANE

 GETCPLANE integer  nCPlane, double array  data

Retrieves the specified system construction plane matrix and stores it in the retvw array or the system array @dbldat.

Return Value

@error Set:

0 	No error

1 	View not defined

2 	Cannot  create system array

Parameters

 nCPlane

Number of the CPlane to retrieve data for

 data

Name of variable for returned CPlane data. If not supplied, CPlane data is returned in @dbldat.  The variable must be an array variable or not have been previously used.  On return from GETCPLANE the variable will be one-dimensional and contain 16 elements.


GETCUR

 GETCUR string  prompt, integer  nStyle, integer  dspflg, double  [x], double  [y], double  [z], string  [placement], double  [dRot], string  [menu], integer  [nDefault]

GETCUR displays a text string on the CADKEY prompt line, a menu in the CADKEY menu area and a specified cursor style, then waits for either a menu item to be selected or a 3D position to be picked.

Parameters

 prompt

Text string to be displayed on the prompt line. The total length of the text string should not exceed 68 characters or truncation may occur.

 nStyle

Style for cursor display:

1 	Crosshairs

2 	Arrow

3 	Rubberband line

4 	Rubberband box (display view)

5 	Rubberband box (construction view)

6 	Drag box (non-view dependent)

7 	Drag box (view dependent)

 dspflg

If set to 0, no cross is drawn at the cursor pick position. If set to 1, the position cross is drawn.

 [x]

X value of anchor point or width of drag box

 [y]

Y value of anchor point or height of drag box

 [z]

Z value of anchor point

 [placement]

Two-letter keyword to indicate position of cursor placement in drag box. The first letter defines horizontal placement and the second defines vertical placement.
Horizontal	Vertical
L = left  	T = top
C = center	C = center
R = right 	B = bottom

 [dRot]

Rotation angle of drag box rot must be >= 0 and <= 360 degrees.

 [menu]

Text strings to be displayed in the CADKEY menus.  The total length of each entry string should not exceed ten characters.  The menu items in the string are separated by the | character.  Leading and trailing whitespace are stripped from the string.  Example: "Menu 1 | Menu 2 ||| Menu 5" will display the text "Menu 1", "Menu 2", and "Menu 5" on buttons 1, 2, and 5.  Buttons 3 and 4 will not be displayed.  If more than 11 items are included in the string, the extra items will be silently ignored.

 [nDefault]

Default menu item. This can be set to any value from 1 - n, where 'n' is the number of menu items displayed. If the user types the <Enter> key instead of a function button or cursor selection, this value is returned as the menu item selected. For example, if nDefault is passed as 3 and <Enter> is typed, @key will contain the value 3, the same as if F3 is typed. If "nDefault" is set to zero or not supplied (the default), the value returned in @key for the <Enter> key is -1 and no processing of the "%s" specifier takes place.

Comments

Usage of the parameters x, y, z, plc, and dRot (described below) is dependent on the cursor style as shown in the following table. The abbreviations are: WC - world coordinates; EC - view coordinates; CC - cursor plane coordinates. A dash indicates that a parameter is not required.

nStyle	x	y	z	placement
rot 	x/y/z usage
1	-	-	-	-	-
2	-	-	-	-	-
3	WC	WC 	WC	-	-
anchor point
4	VC	VC	-	-	-
anchor point
5	CC	CC	CC	-	-
anchor point
6	VC	VC	-	Yes	Yes
drag box size
7	VC	VC	-	Yes	Yes
drag box size

System Variables Set:
@ERROR Error Code:
0 = No error
1 = Exception error (CR, F10, or ESC)

@KEY Code for last key hit:
-3 = ESCAPE
-2 = F10
-1 = CR (<Enter>)
 0 = Position returned
 1 = F1
 2 = F2
...
12 = F12

@XVIEW X coordinate of position found (in view coordinates)

@YVIEW Y coordinate of position found (in view coordinates)

@ZVIEW Z coordinate of position found (in view coordinates)

@XCVIEW X coordinate of position found (in construction view coordinates)

@YCVIEW Y coordinate of position found (in construction view coordinates)

@ZCVIEW Z coordinate of position found (in construction view coordinates)

@XWORLD X coordinate of position found (in world coordinates)

@YWORLD Y coordinate of position found (in world coordinates)

@ZWORLD Z coordinate of position found (in world coordinates)


GETDBL

 GETDBL string  sPrompt, double  dDefVal, double var  dRetVal, string  [menu]

Displays a text string on the CADKEY prompt line and a menu in the CADKEY menu area, then waits for either a menu item to be selected or a numeric real value to be entered. If a menu item is selected, the number is returned in the system variable @KEY. If a real value is entered instead, its value is stored in the specified floating point variable.

Parameters

 sPrompt

Text string to be displayed on the prompt line. The total length of the text string should not exceed 68 characters.

 dDefVal

Default floating point value. If <Enter> is pressed without supplying a value, this value is returned.

 dRetVal

Variable to store return value in.

 [menu]

Text strings to be displayed in the CADKEY menus.  The total length of each entry string should not exceed ten characters.  The menu items in the string are separated by the | character.  Leading and trailing whitespace are stripped from the string.  Example: "Menu 1 | Menu 2 ||| Menu 5" will display the text "Menu 1", "Menu 2", and "Menu 5" on buttons 1, 2, and 5.  Buttons 3 and 4 will not be displayed.  If more than 11 items are included in the string, the extra items will be silently ignored.


GETDISPVIEW

 GETDISPVIEW integer  nDispView, double array  data

Retrieves the specified system view matrix and stores it in the retvw array or the system array @dbldat.

Return Value

@error Set:

0 	No error

1 	View not defined

2 	Cannot  create system array

Parameters

 nDispView

Number of the Display view to retrieve data for

 data

Name of variable for returned Display view data.  If not supplied, Display view data is returned in @dbldat.  The variable must be an array variable or not have been previously used.  On return from GETDISPVIEW the variable will be one-dimensional and contain 16 elements.


GETENT

 GETENT string  Prompt, HENTITY  [hEntity], HDRAWINST  [hDrawInst], int  [nSelFlag], int  [nCollSel], int  [bSelRefEnts], int  [bPosSnap], int  [bAccept], int  [bLayFlag]

GETENT displays a text string on the CADKEY prompt line, activates the graphics cursor, and waits until an entity is selected before returning control to the CADL program. The numeric entity type code and ID are returned in specified variables.  Other entity data is returned in specified variable arrays or system variable arrays. Restrictions on the selectable entity types may be applied by using any of the SET masking statements preceding the GETENT  statement.

Return Value

@error is 0 if no error occurred during processing.
@key variable is set as follows:

0 	Entity was selected

12 	Accept menu selected, no Entity was selected

13 	Backup menu selected, no Entity was selected

14 	Escape menu selected, no Entity was selected

Parameters

 Prompt

The prompt to display.

 [hEntity]

Pointer to the entity selected.

 [hDrawInst]

Pointer to the instance if entity selected is instance specific in layout mode.

 [nSelFlag]

Flag to indicate whether select the entity with selection flag on or not.  (Default is 0)

 [nCollSel]

Option to indicate how to handle collections. (Default is 0, entities treated as individuals)

 [bSelRefEnts]

If 1, then reference entities can be selected. If 0, then the PartRef itself is selected. (Default is 1)

 [bPosSnap]

Indicate whether to use Position Snap or not. (Default is 1)

 [bAccept]

Indicate whether to use Accept button or not. (Default is 0)

 [bLayFlag]

Indicate whether to restrict layout mode selection or not.  (Default is 0)


GETENTID

 GETENTID integer  id

Selects the entity having the given ID.  Entity data is available in system variable arrays.

Parameters

 id

Entity ID

Comments

System Variables Set:
@ERROR (ivar)   Error Code:
0 = No error
1 = Selection error

@NUMINT Number of integer values in @INTDAT array.

@INTDAT[] Array of integer data for the entity selected. The contents of this array are dependent upon the entity selected.  Refer to Entity Information in the Appendices of this manual for information on the contents of @INTDAT for each entity type.

@NUMDBL Number of floating point values in @DBLDAT array.

@DBLDAT[] Array of floating point data for the entity selected. The contents of this array are dependent upon the entity selected.  Refer to Entity Information in the Appendices for information on the contents of @DBLDAT for each entity type.

@NUMSTR Number of character values in @STRDAT array.

@STRDAT[] Array of character data for the entity selected. The contents of this array are dependent upon the entity selected.  Refer to Entity Information in the Appendices  for information on the contents of @STRDAT for each entity type.

@MSCDAT[] Array of miscellaneous data for the entity selected. The contents of this array are dependent upon the entity selected.  Refer to Entity Information in the Appendices for information on the contents of @MSCDAT for each entity type.


GETENTM

 GETENTM string  Prompt, integer  SelOpt, int var  nument, int  [nSelFlag], int  [nCollSel], int  [bSelRefEnts], int  [bPosSnat], int  [bAccept], int  [bLayFlag], int  [bSelInst]

Invokes a particular option of the CADKEY general selection mechanism and waits until one or more entities are selected before returning control to the CADL program. The number of entities selected is returned in a specified variable. Restrictions on the selectable entity types may be applied by using any of the SET masking statements directly preceding the GETENTM statement.
 If the selection process is successful, the GETNEXT statement is subsequently used to retrieve the data on selected entities one at a time in the order that they were selected.

Parameters

 Prompt

The prompt to display.

 SelOpt

Entity selection option, one of the following

1 	Single

2 	Chain

3 	Window

4 	Polygon

5 	Group

6 	Plane

7 	All Displayed

 nument

Number of entities selected.

 [nSelFlag]

Flag to indicate whether select the entity with selection flag on or not.  (Default is 0)

 [nCollSel]

Option to indicate how to handle collections. (Default is 0, entities treated as individuals)

 [bSelRefEnts]

If 1, then reference entities can be selected. If 0, then the PartRef itself is selected. (Default is 1)

 [bPosSnat]

Indicate whether to use Position Snap or not. (Default is 1)

 [bAccept]

Indicate whether to use Accept button or not. (Default is 0)

 [bLayFlag]

Indicate whether to restrict layout mode selection or not.  (Default is 0)

 [bSelInst]

Indicate whether to select an instance when an instance specific entity is selected.  (Default is 0)


GETENTXY

 GETENTXY double  dX, double  dY, integer  [nVpNum], HENTITY  [hEntity], double var  [dData], int var  [iData], char var  [cData], double var  [mData]

GETENTXY selects an entity at the given X, Y view position. The numeric entity type code and ID are returned in specified variables.  Other entity data is returned in specified variable arrays or system variable arrays. Restrictions on the selectable entity types may be applied by using any of the SET masking statements preceding the GETENTXY statement.

Parameters

 dX

x view position of the entity.

 dY

y view position of the entity.

 [nVpNum]

Viewport number.  0 or default = Primary viewport

 [hEntity]

Pointer to the entity selected.

 [dData]

Variable name of array in which to return entity's double point data.  If this is omitted, the data will be put into @DBLDAT.

 [iData]

Variable name of array in which to return entity's integer data.  If this parameter is omitted, the data will be put into @INTDAT.

 [cData]

Variable name of array in which to return the entity's character data.  If this is omitted, the character data will be put into @STRDAT.

 [mData]

Variable name of array in which to return the entity's miscellaneoud data.  If omitted, the data will put in @MSCDAT.


GETGROUP

 GETGROUP integer  grpnum

GETGROUP retrieves group name and subgroup flags for the specified group. The data is returned via @INTDAT and @STRDAT.

Parameters

 grpnum

Group number (1-256)

Comments

System Variables Set:
@ERROR Error code:

0 	No error

1 	Invalid group number

2 	Cannot create system array
@NUMINT (ivar)  Number of @INTDAT elements (32)
@INTDAT[0-31] (ivar)    Subgroup flags
There are eight subgroup flags per @INTDAT element - the low order bits 0-7. This yields a total of 256 subgroups. The flags are arranged such that bits 0-7 of @INTDAT[0] correspond to subgroups 1-8, bits 0-7 of @INTDAT[1] correspond to subgroups 9-16, etc. If the value of a flag is 0, the subgroup is not used. If set to 1, the subgroup is used.
If the group name has a null length (i.e., @STRDAT[0] contains a zero), then the group is not assigned.
@NUMSTR (ivar)      Number of @STRDAT characters (1-10)
@STRDAT (cvar)      Group name


GETINT

 GETINT string  sPrompt, integer  nDefVal, integer var  nRetVal, string  [menu]

Displays a text string on the CADKEY prompt line and a menu in the CADKEY menu area, then waits for either a menu item to be selected or a numeric integer value to be entered. If a menu item is selected, the number is returned in the system variable @KEY. If an integer value is entered instead, its value is stored in the specified integer variable.

Parameters

 sPrompt

Text string to be displayed on the prompt line. Optionally, the default value "nDefVal" may be displayed in the prompt string if the format specifier %n is included in the prompt string (refer to Basics for details on format specifiers).  The total length of the text string, including the displayed default value as well as the returned typed-in number, should not exceed 68 characters.

 nDefVal

Default integer value. If <Enter> is pressed without supplying a value, this value is returned.

 nRetVal

Variable to store return value in.

 [menu]

Text strings to be displayed in the CADKEY menus.  The total length of each entry string should not exceed ten characters.  The menu items in the string are separated by the | character.  Leading and trailing whitespace are stripped from the string.  Example: "Menu 1 | Menu 2 ||| Menu 5" will display the text "Menu 1", "Menu 2", and "Menu 5" on buttons 1, 2, and 5.  Buttons 3 and 4 will not be displayed.  If more than 11 items are included in the string, the extra items will be silently ignored.


GETKEY

 GETKEY int  Wait

GETKEY checks the system keyboard buffer and returns a character code if a key is pressed. Note that the actual ASCII value of the key is returned, even for ESCAPE, BACKUP, and CR <Enter>.

Parameters

 Wait

Specifies if to wait for a key to be pressed (CK_TRUE) or not (CK_FALSE)


GETLEVELNUMBER

 GETLEVELNUMBER HLevel  hLevel, string var  csNumber

Gets the number of the given level.

Parameters

 hLevel

The Level handle to return number of

 csNumber

The returned Level number


GETLSTYLE

 GETLSTYLE string  prompt, integer var  nRetType, integer  [nMultFlag]

GETLSTYLE displays a text string on the CADKEY prompt line along with a window of line style icons and waits for one or more line types to be selected.

Parameters

 prompt

Text string to be displayed on the prompt line. The total length of the text string should not exceed 68 characters or truncation may occur.

 nRetType

Variable to store the single line style selected (1-4) or the line type mask where:

bit 0 	Solid

bit 1 	Dashed

bit 2 	Center line

bit 3 	Phantom line

 [nMultFlag]

Multiple selection flag:

0 	(Default) Return single line style

1 	Return multiple line styles as mask

Comments

System Variables Set:
@ERROR Error code:
 0 = No error
 1 = Exception error (CR, F10, ESC)

@KEY Code for last key hit:
 -3 = ESCAPE
 -2 = F10
 -1 = CR (<Enter>)
 0  = Value returned in "rettype"


GETLWIDTH

 GETLWIDTH string  prompt, integer var  nRetType, integer  [nMultFlag]

GETLWIDTH displays a text string on the CADKEY prompt line along with a window of line width icons and waits for one or more line widths to be selected.

Parameters

 prompt

Text string to be displayed on the prompt line. The total length of the text string should not exceed 68 characters or truncation may occur.

 nRetType

Variable to store the single line width selected (1-15) or the line width mask where:

bit 0 	Width 1

bit 2 	Width 3

bit 4 	Width 5

...

bit 14 	Width 15

 [nMultFlag]

Multiple selection flag:

0 	(Default) Return single line width

1 	Return multiple line widths as mask

Comments

System Variables Set:
@ERROR Error code:
 0 = No error
 1 = Exception error (CR, F10, ESC)

@KEY Code for last key hit:
 -3 = ESCAPE
 -2 = F10
 -1 = CR (<Enter>)
  0 = Value returned in "retwdt"


GETMENU

 GETMENU string  sPrompt, string  [menu], integer  nDefVal

GETMENU displays a text string on the CADKEY prompt line and a menu in the CADKEY menu area, then waits until a menu item is selected. The menu item chosen is returned in the system variable @KEY.

Return Value

@error is set to 0 if one of the 11 menu buttons was pressed, or 1 if the function exited for any other reason, such as Backup or Escape was pressed, or CADKEY is exiting.

Parameters

 sPrompt

Text string to be displayed on the CADKEY prompt line. The total length of the text string should not exceed 68 characters.

 [menu]

Text strings to be displayed in the CADKEY menus.  The total length of each entry string should not exceed ten characters.  The menu items in the string are separated by the | character.  Leading and trailing whitespace are stripped from the string.  Example: "Menu 1 | Menu 2 | | | Menu 5" will display the text "Menu 1", "Menu 2", and "Menu 5" on buttons 1, 2, and 5.  Buttons 3 and 4 will not be displayed.  The entries for the non-displayed buttons must have at least one space to be recognized. If more than 11 items are included in the string, the extra items will be silently ignored.

 nDefVal

Default menu item. This can be set to any value from 1 to n where 'n' is the number of menu items displayed. If the user types the <Enter> key instead of a function button, this value is returned as the menu item selected. For example, if  nDefVal is passed as 3 and <Enter> is typed, @key will contain the value 3, the same as if F3 is typed.


GETNEXT

 GETNEXT int var  nEntType, HEntity var  [hEnt], integer  [nSelNum], int var  [id], double var  [dData], int var  [nData], string var  [cData]

Retrieves the data for selected entities one at a time after GETENTM or GETALL has been successfully executed. If GETNEXT is successful, the numeric entity type code and ID are returned in specified variables. Other entity data is returned in specified variable arrays or system variable arrays.
 There are two ways in which to use GETNEXT: with or without the entity selection number parameter. If used without the entity selection number parameter, each GETNEXT statement gets the next selected entity in the list. Once the list is expired, an error code indicating such is returned, and the internal pointer to the selected entities is set back to the start of the list.  Subsequent GETNEXT commands will work through the list once again. If GETNEXT is used with the entity selection number, the specified entity is returned. Note that if the next GETNEXT command does not specify the optional parameter, the next entity in the list is returned.

Return Value

@error set to the following

0 	Next Entity retrieved

1 	Past end of selection list

2 	Requested entity number is not in valid range

3 	Unknown error, entity not selected

Parameters

 nEntType

Returned type code for entity selected. See Entity Information in the Appendices for a list of entity codes.

 [hEnt]

Returned handle to the entity

 [nSelNum]

Entity selection number. Must be in the range 1 to n where n is the number of entities returned by GETENTM.

 [id]

variable to return the entity ID number in.

 [dData]

Variable name of array in which to return the entity's floating point data. The sizeof() function can be used to determine the number of elements in the array. If this parameter is omitted the floating point data will be put into @DBLDAT.

 [nData]

Variable name of array in which to return the entity's integer data. The sizeof() function can be used to determine the number of elements in the array. If this parameter is omitted, the integer data will be put into @INTDAT.

 [cData]

Variable name of array in which to return the entity's character data. The sizeof() function can be used to determine the number of elements in the array. If this parameter is omitted, the character data will be put into @STRDAT.


GETPATH

 GETPATH string  pathname, varname  curpath

Retrieve the current value of a registered path.

Return Value

The success or failure of the operation

0 	The path has been retrieved.

-1 	The path was not found in the set of registered paths.

Parameters

 pathname

The name of the path, as passed to REGISTERPATH, or any of the standard paths: CADL, CDE, DWG, DXF, DesignFiles, IGES, Languages, Macro, Notes, Parasolid, SAT, STEP, STL, Templates, Textures, VRML, and in WorkshopEX: CATIA, ProE, UG

 curpath

The current value of the path.  If the registry does not contain an entry for this path, then the default path will be used.  If the default path is a relative path, then the current support path will be prepended to it.


GETPLANE

 GETPLANE string  prompt, double array  data

GETPLANE displays a text string on the CADKEY prompt line along with the CADKEY plane selection menu. After choosing a method for plane selection from the menu and selecting the plane, control is returned to the CADL program.  For more information on the usage of the options in the plane selection menu, refer to the CADKEY user manual. The data for the plane selected is returned in either a specified array variable or a system array variable (default).

Format: GETPLANE prompt, data

Parameters

 prompt

Text string to be displayed on the prompt line.

 data

Name of variable for returned plane data. If not supplied, plane data is returned in @dbldat.  The variable must be an array variable or not have been previously used.  On return from GETPLANE the variable will be one-dimensional and contain 16 elements.


GETPOS

 GETPOS string  prompt, integer  defopt, HLOCATION  locPos

GETPOS displays a text string on the first half of the CADKEY prompt line along with the CADKEY position menu and waits until a 3D position in space is indicated using one of the options provided by the position menu (refer to the CADKEY or CUTTING EDGE User Reference Guide for more information on the usage of the Universal Position Menu).

Parameters

 prompt

Text string to be displayed on the prompt line.

 defopt

Default position menu option (1-11). This may be overridden by the user when the menu is displayed.

 locPos

The location of the position selected, if there if one.

Comments

Sample file Reading from a datafile


GETPROJECTIONMATRIX

 GETPROJECTIONMATRIX int var  nMatProj

Creates a projection matrix for a part in 2D construction mode.  Often used in conjunction with Project.

Parameters

 nMatProj

receives the projection matrix number or -1 if the part is in 3D mode and therefore has no projection matrix


GETSTR

 GETSTR string  prompt, string  defstr, string var  retstr, string  [menu]

GETSTR displays a text string on the CADKEY prompt line and a menu in the CADKEY menu area, then waits for either a menu item to be selected or a text string to be entered. If a menu item is selected, the number is returned in the system variable @KEY. If a text string is entered instead, its value is stored in the specified string variable.

Parameters

 prompt

Text string to be displayed on prompt line. Optionally, the default value "defstr" may be displayed in the prompt string if the format specifier %s is included in the prompt string (refer to the Introduction section of this guide for details on format specifiers).  The total length of the text string, including the displayed default value as well as the returned typed in string, should not exceed 68 characters or truncation may occur.

 defstr

Default string. If <Enter> is pressed without supplying a string, the default string is returned.

 retstr

Variable to store return string. Variable name must begin with a '$' character. The returned string will be a null terminated array of characters.

 [menu]

Text strings to be displayed in the CADKEY menus.  The total length of each entry string should not exceed ten characters.  The menu items in the string are separated by the | character.  Leading and trailing whitespace are stripped from the string.  Example: "Menu 1 | Menu 2 ||| Menu 5" will display the text "Menu 1", "Menu 2", and "Menu 5" on buttons 1, 2, and 5.  Buttons 3 and 4 will not be displayed.  If more than 11 items are included in the string, the extra items will be silently ignored.

Comments

System Variables Set:
 @ERROR (ivar)  Error code:
 0 = No error
 1 = Exception exit (F10 or ESC)
 @KEY (ivar)    Code for last key hit:
 -3  = ESCAPE
 -2  = F10
  0  = Value returned in "retstr"
  1  = F1
  2  = F2
  ...
  11 = F12


GOTO

 GOTO string  strLabel

Causes execution to branch to the statement immediately following the specified label. Normally CADL processes each statement in sequence from the beginning to the end of the file.  The GOTO statement must be followed by a label name.

Parameters

 strLabel

The label to branch to

Comments

Sample file Reading from a datafile


HALF

 HALF integer  [nViewport]

Automatically half the scale of a viewport

Return Value

@error set as follows

0 	The operation completed successfully

1 	The viewport number is invalid.

2 	The part document does not exist.

Parameters

 [nViewport]

Viewport number:

-1 	All viewports

0 (default) 	Primary viewport

>0 	Designated viewport


HCOPY

 HCOPY Handle  hDestination, Handle  hSource

Copies one CADL handle to another.  Both must be of the same type.  Valid CADL handles supported are HDRAWINST, HENTITY, HLAYOUT, HLEVEL, HLOCATION

Parameters

 hDestination

Handle to receive a copy of the source

 hSource

Handle to copy.  If the two handles are not the same type, CADL will report an error about the typw of this handle.


hypot(x,y)

double hypot(x,y) double  x, double  y

The length of the hypotenuse of the triangle, sqrt (x*x + y*y).

Parameters

 x

The length of one leg of a right triangle.

 y

The length of the other leg of a right triangle.

Example

a = 3.5

 b = 6.7

 h = hypot(a,b)

 h will be equal to 7.5591


IF

IF

In the IF statement, the expression following the IF clause (expr) is first evaluated. Then, if the expression is true (nonzero), the statement following the IF clause is executed. If the expression is false (zero), the statement following the IF clause is ignored. The program then continues with the statement following the compound IF statement.
In a compiled CADL program a statememt block may be used after an IF command.

Example

uncompiled

IF (expr)

    statement

compiled

IF (expr)

    {

    statement1

    statement2

    }


IF--ELSE IF--ELSE

IF--ELSE IF--ELSE

<Compiled CADL Only>
 The first difference between this compiler statement and the uncompiled IF statement is that instead of only being able to execute one statement if the expression is true, you can now execute a group of statements, surrounded by brackets {}.  To execute one set of commands if a test condition is true and another set if it is false, you can use an IF...ELSE construction.  To choose from multiple sets of commands, you can add as many ELSE...IF clauses as is necessary.

 In the IF ... ELSE IF ... ELSE statement, the expression, expr, following the IF clause is evaluated first. If the expression is true (nonzero), the statements (enclosed within the braces) in the statement-block following the IF clause are executed. The program then continues with the statement following the compound IF statement.

 If the expression, expr, is false (zero), the program evaluates the expressions after the succeeding ELSE IF clauses. When an ELSE IF statement with a true expression is found, the statement-block following that ELSE IF clause is executed. The program then continues with the first statement following the compound IF statement.

 If no ELSE IF clause has a true expression, the statements enclosed within the braces in the statement-block following the ELSE clause are executed. The program then continues with the statement following the compound IF statement.

 The ELSE IF and ELSE clauses in the compound IF statement are not mandatory. A compound IF statement can consist of only an IF and one or more ELSE IF clauses, an IF and an ELSE clause, or just an IF clause. If an ELSE clause is used, it must be the last clause of the compound IF statement. The execution for the clauses used remains the same.

 If the statement-block following any clause consists of only one statement, it does not have to be enclosed in braces.

Example

IF (expr)

{

statement-block

}

[ ELSE IF (alt-expr)

{

statement-block

} ]

[ ELSE

{

statement-block

} ]


IMPORTPART

 IMPORTPART string  sFileName, string  [sPartName], integer  [nMatrix], double  [dX], double  [dY], double  [dZ], double  [dRot], double  [dScale], integer  [nParentOpt], vname  [hLevel], int  [nLevelOpt], int  [nLevelOffset], int  [nGroup], string  [sGroupName]

Imports model geometry from the given file/part into this part.

Return Value

@error set as follows:

CK_NOERROR 	No error.

CK_NO_PART 	The part's document no longer exists.

CK_BAD_FILENAME 	The filename provided is empty.

CK_BAD_MATRIX 	The matrix provided was invalid.

CK_BAD_OPT 	One of the other options is invalid.

CK_BAD_PARTNAME 	The provided part name doesn't exist in the file.

CK_ENT_NOFIT 	An out of memory error occurred.

CK_ERROR 	An error occurred with the translation library.

CK_FILE_ERROR 	An error occurred loading the file.

CK_NOT_EXISTS 	There are no parts in the given file.

Parameters

 sFileName

The full pathname of the file from which to import.  This can be a Part File, a Pattern File, a Design File, or a Template File.

 [sPartName]

For Design and Template files, the name of the part to import.  If this is NULL, then CADKEY will select the part to import.

 [nMatrix]

MATRIX primitive reference number. The MATRIX primitive referenced must precede this call or an error message is displayed and the program terminates.

 [dX]

Translation in the X direction, applied after nMatrix.

 [dY]

Translation in the Y direction, applied after nMatrix.

 [dZ]

Translation in the Z direction, applied after nMatrix.

 [dRot]

Rotation about the Z axis, applied after nMatrix.

 [dScale]

Uniform scale, applied after nMatrix.

 [nParentOpt]

Where in the level tree the import will be based.

0 	The import will be placed at the root of the part.

1 	The import will be placed on the active level.

2 	The import will be placed on the level specified

 [hLevel]

Only used if  nParentOpt is 2.  This is a handle to the level to be used as the root of the import.

 [nLevelOpt]

How entities are distributed among levels.

0 	All entities will be placed on the selected parent level.  If  nParentOpt is 0, then a new root level is created to hold the import.

1 	Same as 0, except that a composite will be created and the entities will be added to that composite.

2 	This copies the level tree of the original part into the new part.  The tree is rooted at the selected parent level.  Since no two levels with the same parent can have the same (non-zero) number, any conflicts will be resolved by moving the children of the copied level to the existing level with the same number.

 [nLevelOffset]

Only used if  nLevelOpt is 2.  This is the offset that is applied to the numbers of the copied levels, before any conflict resolution.

 [nGroup]

Should the entities be added to a group?

 [sGroupName]

The name of the group to be used if  bGroup is true.  This part will be searched for a group with the given name.  If a group is found, an unused subgroup will be selected.  If no group is found, then a new group will be created.  If there are no more available groups or subgroups, then the entities will not be grouped.


INPUT

 INPUT string  format, variable  [var_1],   ..., variable  [var_n]

Reads characters, integers, and floating point numbers from the current standard input device in a variety of ways through the use of a format string.  INPUT is a more flexible alternative to the READ statement.  The format string contains any number of field specifiers which are used to describe how input data should be read and converted to variable values.  For each specifier, a variable name is parsed from the statement and set accordingly.  Unlike the READ statement, only one element of an array can be set at a time. Refer to the Introduction section of this CADL guide for a description of field specifiers.
 The input device must be set to a file by using the SET DEVIN command before using this command.  The file will be open until CADL processing is completed, another SET DEVIN command is processed, or a CLOSE DEVIN is processed.

Parameters

 format

Format control string

 [var_1]

Name of first variable to set based on first field specifier

 ...

 [var_n]

Name of the nth variable to set based on the nth field specifier.

Comments

System Variables Set:
@ERROR (ivar)   Error code:
 0 = No error
 1 = DEVIN not open

@NREAD (ivar) Number of fields successfully converted


INTERSECT

 INTERSECT double  adIntersect[3], double  adLine1[6], double  adLine2[6], integer  [nMatrix]

Calculated the intersection of two lines defined by thier end points in the matrix provided.

Return Value

Sets @Error to -1 if the lines are parallel, 0 when intersection is found.

Parameters

 adIntersect[3]

Array to receive the x, y, and z position of the intersection.

 adLine1[6]

specifies the end points of the first line.

 adLine2[6]

specifies the end points of the second line.

 [nMatrix]

MATRIX primitive reference number. The MATRIX primitive referenced must precede this primitive or an error message is displayed and the program terminates.

0 (default) 	Use current system view in effect


Intersect

 Intersect double  adIntersect[3], double  adLine1[6], double  adLine2[6], integer  [nMatrix]

Calculated the intersection of two lines defined by thier end points in the matrix provided.

Return Value

Sets @Error to -1 if the lines are parallel, 0 when intersection is found.

Parameters

 adIntersect[3]

Array to receive the x, y, and z position of the intersection.

 adLine1[6]

specifies the end points of the first line.

 adLine2[6]

specifies the end points of the second line.

 [nMatrix]

MATRIX primitive reference number. The MATRIX primitive referenced must precede this primitive or an error message is displayed and the program terminates.

0 (default) 	Use current system view in effect


LABEL

 LABEL string  String, integer  [nSide], double array  [adPoints], integer array  [anLengths], double  [x], double  [y], double  [z], hLocation  [loc], integer  [nMatrix], vname  [hLevel], integer  [nArrowtype], double  [dArrHeight], string  [strFont], double array  [adTxtAtt], integer array  [iaEntAtt]

A LABEL primitive describes the geometry and text found in a CADKEY label dimension entity.  When a LABEL primitive is read from a CADL file, a label entity is created in the CADKEY database in the specified view.  When a label entity is written to a CADL file as a LABEL primitive, a MATRIX primitive is created first (if necessary) which the LABEL primitive may reference as its definition plane. A label can have any number of leaders from either the right or left side of the text body.  There is always a short 2 text height line between the text and the start of the leaders.  All leaders start at the end of this line.

Parameters

 String

The character string of the label text

 [nSide]

The side of the text the leaders start from

0 	Right hand leader

1 	Left hand leader

2 	Automatic leader side selection

 [adPoints]

Array of double data that specifies the coordinates of the points that define the LeaderWit lines.  Note that the first point of every leader should be either (0,0) if the end of the CADKEY created witness is not known, or the end of the witness.  Either way CADKEY will set the first point to the end of the generated witness line.  The data must be in X Y pair format, and it's length must be at least equal to the sum of the integers in  anLengths times 2 if  anLengths is provided. If  anLengths is not provided and this is, it must have an even number of data elements. The values in  anLengths and the number of elements in it are used to extract data from this array as follows:

Leader 1 	The first ( anLengths[0] * 2) data elements define the points used for this leader

Leader 2 	Starting at index ( anLengths[0] * 2) the next ( anLengths[1] * 2) elements define this leader

...

Leader n 	Starting at index ( anLengths[n-2] * 2) the next ( anLengths[n-1] * 2) elements define this leader

 [anLengths]

Array of integers data that defines the number of points in each of the leader lines not counting the first point, which is determined by CADKEY according to which side of the LABEL the leaders start from.  The minimum values of each array element is 1.  If this parameter is omitted, one leader is created using all the point data in  adPoints.  The array values are interpreted as followes:

0 	The number of other points in the first leader

1 	The number of other points in the second leader

...

n 	The number of other points in the nth leader.

 [x]

X value of the text string in text's view coordinates

 [y]

Y value of the text string in text's view coordinates

 [z]

Z value of the text string in text's view coordinates

 [loc]

the location to place the note at

 [nMatrix]

MATRIX primitive reference number. The MATRIX primitive referenced must precede this primitive or an error message is displayed and the program terminates.

0 (default) 	World Coordinate system is used

 [hLevel]

Level handle

 [nArrowtype]

Arrowhead display type.  The same type of arrowhead is used for all the leaders in a LABEL entity

0 	unfilled arrow

1 	filled arrow

2 	slash (also called hash mark)

3 	filled circle (closed dot)

4 	unfilled circle (open dot for directed dimensions)

5 	Triangle stand used for datums

6 	user defined arrowheads begin here

 [dArrHeight]

The height of the arrowhead as % of text height

 [strFont]

Text font name assigned to the note entity

 [adTxtAtt]

An array of floats that describes the attributes of the dimension text. The array is not required if the value of  Str is NULL. For more detail refer to the System Arrays section.

 [iaEntAtt]

An array of integer values that describes the attributes of the entity.  For more detail refer to the System Arrays section.


LASTENT

 LASTENT vname  hEnt

Gets a handle to the last selected or created entity

Parameters

 hEnt

variable to put the handle into


LEADER

LEADER

This primitive has been combined with WITNESS in the new LEADERWIT primitive.


LEADERWIT

 LEADERWIT double array  adPoints, integer  [nArrowtype], double  [dArrHeight], integer  [nMatrix], integer vname  [nhevel], integer  [nColor], integer  [nGroup], integer  [nSubGroup], integer  [nPen]

A LEADERWIT primitive describes the geometry found in a CADKEY leader/witness dimension entity.
 When a LEADERWIT primitive is read from a CADL file, a leader/witness entity is created in the CADKEY database. When a leader/witness entity is written to a CADL file as a LEADERWIT primitive, a MATRIX primitive is created first (if necessary) which the LEADERWIT primitive may reference as its definition matrix.

Parameters

 adPoints

Array of double data that defines the coordinates of the points that define the LeaderWit line.

 [nArrowtype]

Arrowhead display type.  The same type of arrowhead is used for all the leaders in a LABEL entity

-1 	(default) no arrow head, making a witness line

0 	unfilled arrow

1 	filled arrow

2 	slash (also called hash mark)

3 	filled circle (closed dot)

4 	unfilled circle (open dot for directed dimensions)

5 	Triangle stand used for datums

6 	user defined arrowheads begin here

 [dArrHeight]

The height of the arrowhead as % of text height

 [nMatrix]

MATRIX primitive reference number. The MATRIX primitive referenced must precede this primitive or an error message is displayed and the program terminates.

0 (default) 	World Coordinate system is used

 [nhevel]

Level handle

 [nColor]

The color assigned to the note entity

0-63 	Number in the system color palette

 [nGroup]

Group reference number

1-256 	Group number

0 	No group assignment

 [nSubGroup]

Subgroup reference number

1-256 	Subgroup number

0 	No subgroup assignment

 [nPen]

Pen number

1-8 	Pen number

0 	Use current system pen number

0 	(default) no arrowhead is used, Witness created

1 	Style 1

2 	Style 2

Comments

Supercedes both LEADER and WITNESS.  A Witness is a leader that does not have an arrowhead.

If you wish to specify a group, you must include both the group and the subgroup number.  If either of these arguments is missing or set to zero(0), both of them will be ignored.


LEVEL

 LEVEL vname  hLevel, vname  [hLevel], string  [csDescriptor], int  [nLevelNumber], int  [bDisplayed], int  [bSelectable], int  [bRefDisplayed], int  [nColor], int  [nStyle], int  [nPen], int  [nWidth]

Creates a handle to a level in the CADKEY part.  If the specified level does not exist, CADL will create the level in the part. CADL determines level existance as follows.
 If a level number is supplied, CADL will check to see if a level with that number already exists under the requested parent.  If so that existing level is used.  If a description is supplied, and the existing level has no description, the description is used for the existing level.
 If a level number is not supplied, and a descriptor is supplied, CADL will check to see if a level with that description exists anywhere in the part. If so it will use that level.

Parameters

 hLevel

Pointer to the created level

 [hLevel]

Handle to the Level to create a new level under. Omitting this parameter puts the new level at the root.

 [csDescriptor]

The Level descriptor

 [nLevelNumber]

The Level number in relation to the parent level. default is 0, no level number.

 [bDisplayed]

Value specifying if the Level should be displayed, default is true(1). This parameter does not take effect if the desired level already exists.

 [bSelectable]

Value specifying if the Level should be made selectable, default is true(1) This parameter does not take effect if the desired level already exists.

 [bRefDisplayed]

Value specifying if reference is displayed, default is true(1) This parameter does not take effect if the desired level already exists.

 [nColor]

Specifies the default color for this level A value of -1, default, means to use the parent's value. This parameter does not take effect if the desired level already exists.

 [nStyle]

Specifies the default line style for this level A value of -1, default, means to use the parent's value. This parameter does not take effect if the desired level already exists.

 [nPen]

Specifies the default pen number for this level A value of -1, default, means to use the parent's value. This parameter does not take effect if the desired level already exists.

 [nWidth]

Specifies the default line width for this level A value of -1, default, means to use the parent's value. This parameter does not take effect if the desired level already exists.


LEVELFROMNAME

 LEVELFROMNAME string  csLevelName, HLevel  hLevel

Gets the level given a level number String.

Parameters

 csLevelName

The numbers of the levels to be changes

 hLevel

Returned Level handle for the given name


LEVELMOD

 LEVELMOD word  Attrib, string  csLevelNumbers, int  [nColor], int  [nStyle], int  [nPen], int  [nWidth]

Sets the attributes of a list of levels

Return Value

@error set as follows

0 	The operation completed successfully

1 	The attribute is invalid.

Parameters

 Attrib

The attribute being set.  May be one of the following

DISP 	Displays the level(s)

NDISP 	Un-displays the level(s)

SEL 	Makes the level(s) selectable

NSEL 	Makes the level(s) unselectable

RDISP 	Set the level as reference displayed

NRDISP 	Set the level as reference un-displayed

ATTRIB 	Set the color, style, pen and width attributes

 csLevelNumbers

The numbers of the levels to be changes. May be either a quoted string or a string variable.

 [nColor]

Specifies the default color for this level, -1 to clear the default color.  Used only for ATTRIB flag

 [nStyle]

Specifies the default line style for this level, -1 to clear the default color.  Used only for ATTRIB flag

 [nPen]

Specifies the default pen number for this level, -1 to clear the default color.  Used only for ATTRIB flag

 [nWidth]

Specifies the default line width for this level, -1 to clear the default color.  Used only for ATTRIB flag


LINDIM

 LINDIM double  dAxis, integer  nForm, string  [Str], hLocation  [loc], double  [x], double  [y], double  [z], hLocation  [StartLoc], hLocation  [EndLoc], double array  [adRefLn], integer  [nMatrix], vname  [hLevel], string  [Font], integer array  [iaDimInfo1], double array  [daDimInfo2], double array  [daTxtAtt], integer array  [iaEntAtt]

A LINDIM primitive describes a linear dimension entity. All LINDIM data is represented in local view coordinates. When a LINDIM primitive is read from a CADL file, a linear dimension entity is created in the database. When a linear dimension entity is written to a CADL file as a LINDIM primitive, a VIEW primitive is created first. In addition to a VIEW primitive, some arrays are created for the LINDIM definition. When a LINDIM primitive is read from a CADL file, all the arrays except  refln are optional. LINDIM requires one reference line.  From the length of the reference line and the value of 'form', a dimension value is computed. If a special value/string is desired in place of the numeric value of the dimension then the string  Str.

Parameters

 dAxis

The angle of the dimension

 nForm

Linear dimension form:

1 	Linear dimension

2 	Radial edge (radius of arc/circle dimensioned parallel to an edge)

3 	Diametral edge (diameter of arc/circle dimensioned parallel to an edge)

 [Str]

A character string. If it is omitted, the dimension value is calculated and displayed.

 [loc]

the location to place the text at.  This must be given if  dX,  dY, and  dZ are not given.

 [x]

X value of the text string in text's view coordinates. If  loc is not supplied this will be used for the text position.

 [y]

Y value of the text string in text's view coordinates. If  loc is not supplied this will be used for the text position.

 [z]

Z value of the text string in text's view coordinates. If  loc is not supplied this will be used for the text position.

 [StartLoc]

the location of the start of the reference line for this dimension.  Required if  adRefLn is not given.

 [EndLoc]

the location of the end of the reference line for this dimension.  Required if  adRefLn is not given.

 [adRefLn]

An array doubles defining the coordinates of the reference lines. Each LINDIM requires one reference line defined by its (x,y,z) endpoints.  Required if  StartLoc and  EndLoc are not given.

 [nMatrix]

MATRIX primitive reference number. The MATRIX primitive referenced must precede this primitive or an error message is displayed and the program terminates.

0 (default) 	Use current system view in effect

 [hLevel]

Level handle, see HLEVEL

 [Font]

Name of the font to use.

 [iaDimInfo1]

An array of integer values that is used for the dimension.  For more detail refer to @diminfo1 or the Entity Information section. If this array is given  daDimInfo2 must also be given.

 [daDimInfo2]

An array of doubles that is used for the dimension. For more detail refer to @diminfo2 or the Entity Information section. If this array is given  adDimInfo1 must also be given.

 [daTxtAtt]

An array of floats that describes the attributes of the dimension text. The array is not required if the value of  Str is NULL. For more detail refer to @txtatt or the Entity Information section.

 [iaEntAtt]

An array of integer values that describes the attributes of the entity. For more detail refer to @entatt or the Entity Information section.

Comments

If the entity attribute or the text attribute arrays are missing, the system defaults will be used in their place.  If both DimInfo arrays are missing, the system defaults will be used, if only one is given the CADL program will abort processing.


LINE

 LINE double  x1, double  y1, double  z1, double  x2, double  y2, double  z2, integer  [nMatrix], vname  [hLevel], integer  [nColor], integer  [nStyle], integer  [nGroup], integer  [nSubGroup], integer  [nPen], integer  [nWidth]

The LINE primitive describes the two endpoints of a line in X, Y, Z World or MATRIX view coordinates.
When a line entity is written to a CADL file, it is output as a LINE primitive.  If the 2D construction mode is in effect, line entities are dumped with a MATRIX reference.  When a LINE primitive references a MATRIX, the Matrix view primitive is output first (if necessary).
The line length itself must be greater than or equal to 0.0005, and less than or equal to 10,000.

Parameters

 x1

X value of line endpoint 1

 y1

Y value of line endpoint 1

 z1

Z value of line endpoint 1

 x2

X value of line endpoint 2

 y2

Y value of line endpoint 2

 z2

Z value of line endpoint 2

 [nMatrix]

MATRIX primitive reference number. The MATRIX primitive referenced must precede this primitive or an error message is displayed and the program terminates.

0 (default) 	World Coordinate system is used

 [hLevel]

Level handle

 [nColor]

Color of the entity

0-63 	Number in the system color palette

 [nStyle]

The line style:

1 	Solid

2 	Dashed

3 	Center Line

4 	Phantom line

0 	Use current system line type

 [nGroup]

Group reference number

1-256 	Group number

0 	No group assignment

 [nSubGroup]

Subgroup reference number

1-256 	Subgroup number

0 	No subgroup assignment

 [nPen]

Pen number

1-8 	Pen number

0 	Use current system pen number

 [nWidth]

Line width

1-15 	Odd line width

0 	Use current system line width

Comments

If you wish to specify a group, you must include both the group and the subgroup number.  If either of these arguments is missing or set to zero(0), both of them will be ignored.


LINETANPERP

 LINETANPERP int  n3D, int  nTan, HEntity  [hEnt1], HDrawInst  [hInst1], int var  nSeg1, double var  dParam1, double array  Point1, int  nTan2, HEntity  [hEnt2], HDrawInst  [hInst2], int var  nSeg2, double var  dParam2, double array  Point2, opt int  nMatrix

Compute a line either tangent or perpendicular to each of two entities.  Either entity may be omitted, in which case a provided fixed point is used.

Return Value

CKNoError if the computation is successful.  CK_BADTYPE if the computation can't handle one or more of the provided entities.  CKError on other failures.

Parameters

 n3D

Is this being done in 2d or 3d?  If in 2d, the provided matrix is used to project into 2d space.  Otherwise, the function attempts to create a plane based on the selected entities.  If such a plane can not be defined, it falls back to the 2d case.

 nTan

Whether the first condition is tangent (1) or perpendicular (0).

 [hEnt1]

A pointer to the first entity.  If this pointer is omitted, then the first condition is a point, and its value must be stored in  Point1.

 [hInst1]

The drawing instance containing the first entity

 nSeg1

The guess segment for an entity first condition. Updated to be the segment of the actual computed point.

 dParam1

The guess parameter for an entity first condition. Updated to be the parameter of the actual computed point.

 Point1

Receives the first computed point for an entity first condition, or contains the point value for a point first condition.

 nTan2

Whether the second condition is tangent (1) or perpendicular (0).

 [hEnt2]

A pointer to the second entity.  If this pointer is omitted, then the second condition is a point, and its value must be stored in  Point2.

 [hInst2]

The drawing instance containing the second entity

 nSeg2

The guess segment for an entity second condition. Updated to be the segment of the actual computed point.

 dParam2

The guess parameter for an entity second condition.  Updated to be the parameter of the actual computed point.

 Point2

Receives the second computed point for an entity second condition, or contains the point value for a point second condition.

 nMatrix

A transformation from the world space of the part to the world space of the computation.  This may also be used to project the computation into a 2d computation.


LoadDimFile

 LoadDimFile string  csFilename

Loads a dimension settings file (*.dim) into the active part

Parameters

 csFilename

Path and file name of the file to load


LOADPART

 LOADPART string  sFilename, string  sPartname, int  nDisplayed

Open the named file/part.

Return Value

@error set as follows

CK_NOERROR 	No error.

CK_BAD_FILENAME 	The filename provided is empty.

CK_BAD_PARTNAME 	The provided part name doesn't exist in the file.

CK_ERROR 	An error occurred with the translation library.

CK_FILE_ERROR 	An error occurred loading the file.

CK_NOT_EXISTS 	There are no parts in the given file.

Parameters

 sFilename

The full pathname of the file to open.  This can be a Part File, a Pattern File, a Design File, or a Template File.

 sPartname

For Design and Template files, the name of the part to open if this is NULL, then CADKEY will select the part to open

 nDisplayed

If this is zero the part is loaded but not visible otherwise it is loaded and made active(visible)


LOCAL

LOCAL

<Compiled CADL Only>
 LOCAL provides a means of indicating that certain variables are local to the currently running CADL program and may not be accessed by other programs. Multiple LOCAL statements may be specified but they must occur before the first executable statement in the program (/*...*/ and REM statements are not executable).

Example

LOCAL var1, var2


LOCATION

 LOCATION vname  hLocation, int  nType, double  [dX], double  [dY], double  [dZ], vname  [hEntity], vname  [hDrawInst], double  [dAngDist], int  [nStart], int  [nSeg], double  [dDeltaX], double  [dDeltaY], double  [dDeltaZ], double  [dParm], vname  [hEntity2], int  [nSeg2], double  [dParm2]

A Location in CADKEY space defined by more than its position.  There are many types of locations in CADKEY ranging from the simple non-associative Location, to the complex Intersection Location which is associative to two entities.  Most of the locations in CADKEY are associative to the geometry to which they refer.  This command is used to create all 24 types of CADKEY Location objects.  Not all the parameters are used for all the different types.  The three values of the coordinate are required only for the simple, non-associative, Location.  For all others, if they are not given, the coordinate will be calculated using the other data for the location type being created.  The different types of locations are described below.

Location.  This is the simplest form of Location in CADKEY, contaning only the coordinate that is being referenced.  These are not associative to any entities.

Entity Location.  An entity location is a position that is associative to an entity in CADKEY.  These are primarily used for the two-line angular dimensions.  They are given a position on the entity they refer to, but the position may not be used by the CADKEY entity using the location.

Diameter Location.  Locations used by edge diameter dimensions are diameter locations.  These refer to one end of an arcs diameter at a given angle.

Radius Location.  Locations used by edge radius dimensions are radius locations.  These refer to one end of an arcs radius at a given angle.

Center Location.  This location points to the center of an arc entity. This location can be enhanced with a Delta, Cylindrical, or Spherical offset.

Along Entity Location.  Specifies a position along a particular entity. This location can be enhanced with a Delta, Cylindrical, or Spherical offset.

End Entity Location.  This location refers to the end of a given entity. This location can be enhanced with a Delta, Cylindrical, or Spherical offset.

Mid-Point Location.  Represents the middle position on the entity.  This is not the same as the Center location which is only valid for arcs. This location can be enhanced with a Delta, Cylindrical, or Spherical offset.

Intersection Location.  Represents the intersection of two entities.  For an intersection both entities must be in the same instance. This location can be enhanced with a Delta, Cylindrical, or Spherical offset.

Parameters

 hLocation

Variable to recieve the handle of the created location.

 nType

The type of location being created.

0 	Location

1 	Entity

2 	Diameter

3 	Radius

4 	Center

5 	Along Entity

6 	End Entity

7 	Mid-Point

8 	Intersection

 [dX]

World X value of the coordinate of the location. If supplied the Y and Z values must also be supplied.  This is required for the Location type ( nType = 0).

 [dY]

World Y value of the coordinate of the location. If supplied the X and Z values must also be supplied.  This is required for the Location type ( nType = 0).

 [dZ]

World Z value of the coordinate of the location. If supplied the X and Y values must also be supplied.  This is required for the Location type ( nType = 0).

 [hEntity]

Entity this location is associated with.  Required if  nType is not Location (0).

 [hDrawInst]

The Drawing instance that  hEntity may be in.

 [dAngDist]

Used only for  nType values of 2, 3, and 5.
 The Angle of the diameter or radius for Diameter and Radius type location.  The Distance along the entity for the Along type location.

 [nStart]

Used only for  nType values of 2, 3, 5, and 6.
 For a radius location this specifies if the location is at the center of the radius.  For diameter location it tells if the location is at the start of the diameter.  For along entity and end entity locations it tells if the position is measured from, or is, the start(1) or end(0) of the entity

 [nSeg]

Used only for  nType values of 5 - 8.
  For Along entity location ( nType 5), this is a flag specifying if the distance is a percentage of the entities distance (0), or an absolute value (1).  For the other types this is used for, it specifies the segment of the entity the location's position is on.

 [dDeltaX]

This is the world x component of the optional offset vector.
This is not used for location types 0-3.

 [dDeltaY]

This is the world y component of the optional offset vector.
This is not used for location types 0-3.

 [dDeltaZ]

This is the world z component of the optional offset vector.
This is not used for location types 0-3.

 [dParm]

Used only for  nType values of 8.
  The parameter along the first entity of the intersection point.

 [hEntity2]

Used only for  nType of 8.
 Handle to the second entity of the intersection.

 [nSeg2]

Used only for  nType of 8.
 The segment the intersection is located in on the second entity.

 [dParm2]

Used only for  nType of 8.
 The parameter along the second entity of the intersection point.


LOCATIONCOORD

 LOCATIONCOORD hLocation  Location, double  dX, double  dY, double  dZ

Retreives the coordinate positions from an HLOCATION object.

Parameters

 Location

The location to get the coordinate from

 dX

Double to receive the X value of the coordinate

 dY

Double to receive the Y value of the coordinate

 dZ

Double to receive the Z value of the coordinate


log(x)

double log(x) double  x

The natural logarithm of x.

Parameters

 x

Any number which is greater than or equal to zero.

Example

x = log(4.9)

 x will be equal to 1.589235


log10(x)

double log10(x) double  x

The base 10 logarithm of x.

Parameters

 x

Any number x which is greater than or equal to zero.

Example

x = log10(3)

 x will be equal to 0.477121


macro_play

extern "C" SDK_EXPORT void macro_play

Execute a CADL macro


MASKCLEAR

MASKCLEAR

Clears all current selection masks


MASKCOLOR

 MASKCOLOR int  nColor1, int  nColor...

The MASKCOLOR command allows for the setting the CADKEY selection mask to particular colors.  This is a replacement for the "SET MASKCOL, ..." command.  When a color mask is in place, only entities of the colors in the mask are selectable.  To remove an color from a the mask send in the negative of the color number. Use 0 to clear all colors from the mask.

Parameters

 nColor1

First color to mask on

 nColor...

other colors to mask on

0 	Clear the color mask

1 	Color 1

... 	...

64 	Color 64


MASKENTITY

 MASKENTITY int  nEntity type

The MASKENTITY command allows for the setting the CADKEY selection mask to particular entities.  This is a replacement for the "SET MASK, ...", and "SET MASKENT, ..." commands.  When an entity is masked it is selectable and other entities are not, see below for a list of entity types and their mask flags.  To remove an entity from a mask send in the negative of the entity's number.

 Example:
 	To set a mask that will select primitive geometry
 	MASKENTITY 1, 2, 3, 4, 5, 6
 	To remove points from the selectable set
 	MASKENTIYT -1

Parameters

 nEntity type

A list of the entity types to be masked.

0 	None, clears any mask in effect

1 	Points

2 	Lines

3 	Arcs and Circles

4 	Polylines

5 	Conics

6 	Splines

7 	NURB Splines

8 	Composite entities

9 	Notes

10 	Labels

11 	Linear Dimensions

12 	Angular Dimensions

13 	Circular Dimensions

14 	Base Linear Dimensions

15 	Chamfer Dimensions

16 	Generic Dimensions

17 	Coordinate Dimensions

18 	Balloons

19 	Center Lines

20 	Datums

21 	Datum Targets

22 	Drawing Instances

23 	Geo Tol Symbols

24 	Cross Hatching

25 	Leaders and Witnesses

26 	Part References

27 	Planes

28 	Surface Texture Symbols

29 	Targets

30 	Vectors

31 	Welding Symbols

32 	Solids

33 	Parametric Solids

34 	DRAFT-PAK Features

35 	DRAFT-PAK Fasteners

36 	DRAFT-PAK Mechanical Elements

37 	CADKEY OLE Entity

38 	Textual entities

39 	Note Tables

40 	Dimension Entities

41 	Shells

42 	Solid Edges

43 	Solid Faces

44 	Solid Vertex

45 	Solid Flowline

46 	Parametric Solid Edges

47 	Parametric Solid Faces

48 	Parametric Solid Vertex

49 	Parametric Plane

50 	Parametric Sketch Geometry

51 	Cutting Plane Line

52 	Sheet Body


MASKLSTYLE

 MASKLSTYLE int  nLinestyle1, int  nLinestyle...

The MASKLSTYLE command allows for the setting the CADKEY selection mask to particular line styles.  This is a replacement for the "SET MASKLTYPE, ..." command. When a line style mask is in place, only entities of the line styles in the mask are selectable.  To remove a line style from a the mask send in the negative of the line style. Use 0 to clear all line styles from the mask.

Parameters

 nLinestyle1

First line style to mask on

 nLinestyle...

other line style to mask on

1 	Line style 1

... 	...

4 	Line style 4


MASKLWIDTH

 MASKLWIDTH int  nLinewidth1, int  nLinewidth...

The MASKLWIDTH command allows for the setting the CADKEY selection mask to particular line widths.  This is a replacement for the "SET MASKLWIDTH, ..." command. When a line width mask is in place, only entities of the line widths in the mask are selectable.  To remove a line width from a the mask send in the negative of the line width. Use 0 to clear all line widths from the mask.

Parameters

 nLinewidth1

First line width to mask on

 nLinewidth...

other line width to mask on

1 	Line width 1

2 	Line width 3

... 	...

8 	Line width 15


MASKPEN

 MASKPEN int  nPen1, int  nPen...

The MASKPEN command allows for the setting the CADKEY selection mask to particular pens.  This is a replacement for the "SET MASKPEN, ..." command.  When a pen mask is in place, only entities drawn with the pens in the mask are selectable.  To remove a pen from a the mask send in the negative of the pen number. Use 0 to clear all pens from the mask.

Parameters

 nPen1

First pen to mask on

 nPen...

other pen to mask on and so on

1 	Pen 1

... 	...

8 	Pen 8


MATRIX

 MATRIX integer  nMatrixNum, double  t1, double  t2, double  t3, double  t4, double  t5, double  t6, double  t7, double  t8, double  t9, double  [t10], double  [t11], double  [t12]

The MATRIX primitive describes the view in which a planar primitive (such as an ARC, CIRCLE or TEXT) is defined. This primitive contains the information necessary to define a geometric plane, using a 3 X 3 rotation matrix.
A MATRIX primitive must precede the planar primitive referencing it.
A MATRIX primitive does not create any entities in CADKEY, it retains the view matrix information for the remainder of the CADL program, or until another MATRIX is created with the same reference number.  If multiple MATRIX primitives are defined with the same reference number, the most recent MATRIX is the only one retained by the program.

Parameters

 nMatrixNum

The MATRIX reference number to use for entity creation in this CADL session.  The value of the reference number must be greater than 0.

 t1

First element in the rotation matrix.

 t2

Second element in the rotation matrix.

 t3

Third element in the rotation matrix.

 t4

Fourth element in the rotation matrix.

 t5

Fifth element in the rotation matrix.

 t6

Sixth element in the rotation matrix.

 t7

Seventh element in the rotation matrix.

 t8

Eighth element in the rotation matrix.

 t9

Ninth element in the rotation matrix.

 [t10]

X offset of the matrix.

 [t11]

Y offset of the matrix.

 [t12]

Z offset of the matrix.

Comments

The parameters are ordered in the matrix as follows
[ t1 	t2 	t3 ]
[ t4 	t5 	t6 ]
[ t7 	t8 	t9 ]
[ t10	t11	t12 ]

This 3 X 3 rotation matrix defines the X, Y and Z axis rotation about the part model origin ( X = 0, Y = 0, Z = 0) relative to model space, or the system's view 1 (TOP view). In this system, X is the horizontal axis, Y is the vertical axis, and Z is the axis pointing out of the plane.

The offset value represents the X, Y, and Z, offset values of this matrix origin relative to the model space.

The following  characteristics apply to the rotation matrix:

1.   It is orthogonal in the linear algebraic sense (i.e., its transpose is its inverse).

2.   It has a positive determinant.  Reference Coordinate System (Model space or View 1).

Rotation about the X axis is given by:

[	1 	   0  	  0   	]
[	0 	 cos X	-sin X	]
[	0 	 sin X	 cos X	]

Rotation about the Y axis is given by:

[	 cos Y 	0 	sin Y	]
[	  0    	1 	  0  	]
[	-sin Y 	0 	cos Y	]

Rotation about the Z axis is given by:

[	cos Z 	-sin Z	  0 ]
[	sin Z 	 cos Z	  0 ]
[	  0   	  0   	  1 ]


MATRIXA

 MATRIXA integer  nMatrixNum, double array  adValues

Same as MATRIX except it takes an array of values.

Parameters

 nMatrixNum

The MATRIX reference number to use for entity creation in this CADL session.  The value of the reference number must be greater than 0.

 adValues

The first 9 elements represent the rotation matrix.  The last three are the offset of the matrix origin and are not required.

Comments

The parameters are ordered in the matrix as follows
[ adValues[0] 	adValues[1] 	adValues[2] ]
[ adValues[3] 	adValues[4] 	adValues[5] ]
[ adValues[6] 	adValues[7] 	adValues[8] ]
[ adValues[9] 	adValues[10] 	adValues[11] ]

The 3 X 3 rotation matrix defines the X, Y and Z axis rotation about the part model origin ( X = 0, Y = 0, Z = 0) relative to model space, or the system's view 1 (TOP view). In this system, X is the horizontal axis, Y is the vertical axis, and Z is the axis pointing out of the plane.

The offset value represents the X, Y, and Z, offset values of this matrix origin relative to the model space.

The following  characteristics apply to the rotation matrix:

1.   It is orthogonal in the linear algebraic sense (i.e., its transpose is its inverse).

2.   It has a positive determinant.  Reference Coordinate System (Model space or View 1).

Rotation about the X axis is given by:

[	1 	   0  	  0   	]
[	0 	 cos X	-sin X	]
[	0 	 sin X	 cos X	]

Rotation about the Y axis is given by:

[	 cos Y 	0 	sin Y	]
[	  0    	1 	  0  	]
[	-sin Y 	0 	cos Y	]

Rotation about the Z axis is given by:

[	cos Z 	-sin Z	  0 ]
[	sin Z 	 cos Z	  0 ]
[	  0   	  0   	  1 ]


MATROTATE

 MATROTATE int  nMat, double  dX, double  dY, double  dZ, int var  nRotMat

Rotates a matrix about the x, y, and z axis

Parameters

 nMat

Number of the matrix to rotate

 dX

rotation about the x-axis

 dY

rotation about the y-axis

 dZ

rotation about the z-axis

 nRotMat

Receives the number of the rotated matrix


NEARPOINT

 NEARPOINT HEntity  hEntity, HDrawInst  hDrawInst, double array  dPoint[3], int  nGlobalSearch, double array  dNearPnt[3], int  [nSeg], double  [dParam], double  dMinDist, int  dExtendStart, int  bExtendEnd, int  nProjMatrix, int  nWorldMat

Computes the minimum distance between a point and an entity.

Return Value

@error set to one of the following

0 	The value was computed successfully.

1 	The entity pointer is invalid.

2 	Instance handle is not valid

3 	The entity type doesn't support this operation.

4 	The provided starting segment is out of range.

5 	The provided starting parameter is out of range.

Parameters

 hEntity

Handle to the entity to get information about.

 hDrawInst

Handle to the instance, if this is an instance specific entity in layout mode.  For a model mode entity, or a layout specific entity, this must be set to NULL.

 dPoint[3]

The input point, in computation world coordinates.

 nGlobalSearch

Should the search start at a specific point or should a global search over the entity be performed.

 dNearPnt[3]

Receives the closest point on the entity, in computation world space.

 [nSeg]

If  bGlobalSearch is true, the starting segment number for the search.  Receives the segment number of the closest point.

 [dParam]

If  bGlobalSearch is true, the starting parameter value for the search.  Receives the parameter value of the closest point.

 dMinDist

Receives the minimum distance between the point and the entity.

 dExtendStart

Should the search be extended beyond the start of the curve?

 bExtendEnd

Should the search be extended beyond the end of the curve?

 nProjMatrix

The projection matrix for a 2D minimum distance. If this is NULL, the calculation is done in 3D space.  This matrix converts from the world space of the calculation to the viewing orientation and then projects to a specific z depth.

 nWorldMat

The matrix for converting from the world space of the object to the computation world space.  This matrix is applied before the projection matrix.


NEWPART

 NEWPART string  sFilename, int  nNewDesignDoc, string  sPartfile, int  nDisplayed

Create a new file/part

Return Value

@error set as follows

CK_NOERROR 	No error.

CK_NO_PART 	There is no active file.

CK_FILE_ERROR 	An error occurred loading the file.

CK_NOT_EXISTS 	The specified file/part does not exist

Parameters

 sFilename

The full pathname of the design file(may be blank)

 nNewDesignDoc

If Zero(0) create a Part in the existing document specified  sFilename, or the active file if that is empty. If non-zero create a Part in a new design doc

 sPartfile

The name of the new Part File (may be blank)

 nDisplayed

If non-zero create a frame around the new document and display it if zero load it but do not display it


NOTE

 NOTE string  Text, double  [x], double  [y], double  [z], hLocation  [loc], integer  [nMatrix], vname  [hLevel], integer  [nType], string  [strFont], double array  [adTxtAtt], integer array  [iaEntAtt]

The NOTE primitive describes one or more strings of characters assigned to a specified view plane. When a NOTE primitive is read from a CADL file, a note entity is created in the database.  When a note entity is written to a CADL file, a MATRIX primitive is created first (if necessary) which the NOTE primitive may reference as its assigned plane.

Parameters

 Text

The text to use for the note.

 [x]

X value of the lower left corner of the first line of the text string in text's view coordinates

 [y]

Y value of the lower left corner of the first line of the text string in text's view coordinates

 [z]

Z value of the lower left corner of the first line of the text string in text's view coordinates

 [loc]

the location to place the note at

 [nMatrix]

MATRIX primitive reference number. The MATRIX primitive referenced must precede this primitive or an error message is displayed and the program terminates.

0 (default) 	World Coordinate system is used

 [hLevel]

Level handle

 [nType]

Defines what type of note is created in the CADKEY part.  The values are as follows with 0 being the default value if this parameter is ommited.

0 	 Text is used as the note text

1 	 Text is a filename from which the note is read. Note that this will only read from the file when the note is created.

2 	 Text is a filename that the note entity will link to. this option replaces the FNOTE primitive of previous versions. Note that, like FNOTE of the past, this will read from the file every time the part is loaded into CADKEY.

 [strFont]

Text font name assigned to the note entity

 [adTxtAtt]

An array of floats that describes the attributes of the dimension text. The array is not required if the value of  Str is NULL. For more detail refer to the System Arrays section.

 [iaEntAtt]

An array of integer values that describes the attributes of the entity.  For more detail refer to the System Arrays section.


NoteState

NoteState

Notes a state in the CADKEY database.  Should be used after an action that causes the CADKEY database to be altered.  Geometric entities that are created in CADL, may not display until a NoteState command has been issued.


NURBSCTRLPNTS

 NURBSCTRLPNTS integer  nDegree, integer  nRational, integer  nPeriodic, integer  nClosed, integer  nCurveform, integer  nKnottype, double  dStartParam, double  dEndParam, double array  adKnots, double array  adControls, double array  adWeights, integer  [nMatrix], HLevel  [hLevel], integer  [nColor], integer  [nStyle], integer  [nGroup], integer  [nSubGroup], integer  [nPen], integer  [nWidth]

The NURBSPLINE data primitive describes NURBSpline created using Control Points, Knot points & weights

Parameters

 nDegree

The degree of the curve.

0-25 	Valid range of curve degrees

 nRational

The value specifying if the NURBSpline rational (or not)

0 	Not Rational

1 	Rational

 nPeriodic

The value specifying if the NURBSlpine is perodic (or non-periodic)

0 	Not Periodic

1 	Periodic

 nClosed

The value specifying if the NURBSpline is closed (or open).

0 	Open

1 	Closed

 nCurveform

The form (shape) of the Curve

0 	default; unspecified form

1 	polyline form

2 	circular form

3 	elliptical form

4 	parabolic form

5 	hyperbolic form

6 	intersecting form

 nKnottype

The type of Knot

0 	default type, this includes non-uniform case

1 	unclamped and uniform

2 	clampled and uniform

3 	distinct knot values are equally spaced

 dStartParam

The Parameter of the first displayed point on the starting segment.  (range 0 - 1)

 dEndParam

The Parameter of the last displayed point on the ending segment.  (range 0 - 1)

 adKnots

An array of Knot Point parameter values

 adControls

An array data for the Control Points coords

 adWeights

An array of Weights; if no weights are provided the the default of 1 is used to weight each Control Point

 [nMatrix]

Matrix View number.  The MATRIX referenced must precede this primitive, or an error message is displayed asn the program in terminated.

0 (default) 	World Coordinate system is used

 [hLevel]

Handle to the level for the entity

 [nColor]

Color of the entity

0-63 	Number in the system color palette

 [nStyle]

The line style:

1 	Solid

2 	Dashed

3 	Center Line

4 	Phantom line

0 	Use current system line type

 [nGroup]

Group reference number

1-256 	Group number

0 	No group assignment

 [nSubGroup]

Subgroup reference number

1-256 	Subgroup number

0 	No subgroup assignment

 [nPen]

Pen number

1-8 	Pen number

0 	Use current system pen number

 [nWidth]

Line width

1-15 	Odd line width

0 	Use current system line width

Comments

If you wish to specify a group, you must include both the group and the subgroup number.  If either of these arguments is missing or set to zero(0), both of them will be ignored.


NURBSFITPNTS

 NURBSFITPNTS integer  nDegree, integer  nRational, integer  nPeriodic, integer  nClosed, integer  nCurveform, integer  nKnottype, double  nStartParam, double  nEndParam, word  csFits, integer  [nMatrix], integer  [nColor], integer  [nLevel], integer  [nStyle], integer  [nGroup], integer  [nSubGroup], integer  [nPen], integer  [nWidth]

The NURBSPLINE data primitive describes NURBSpline created Fit points

Parameters

 nDegree

The degree of the curve.

0-25 	The valid range for the degree of the curve

 nRational

The value specifying whether the B-Spline is rational or not

0 	Not rational

1 	Rational

 nPeriodic

The value specifying if B-Spline is  perodic (or non-periodic)

0 	Not periodic

1 	Periodic

 nClosed

Value specifying if the B-Spline is closed (or open).

0 	Open

1 	Closed

 nCurveform

The form (shape) of the Curve

0 	default; unspecified form

1 	polyline form

2 	circular form

3 	elliptical form

4 	parabolic form

5 	hyperbolic form

6 	intersecting form

 nKnottype

The type of Knot

0 	default type, this includes non-uniform case

1 	unclamped and uniform

2 	clampled and uniform

3 	distinct knot values are equally spaced

 nStartParam

The Parameter of the first displayed point on the starting segment

 nEndParam

The Parameter of the last displayed point on the ending segment.

 csFits

An array of  doubles data for each x,y and z of a Fit Points

 [nMatrix]

Matrix View number.  The MATRIX referenced must precede this primitive, or an error message is displayed asn the program in terminated.

0 (default) 	World Coordinate system is used

 [nColor]

Color of the entity

0-63 	Number in the system color palette

 [nLevel]

Level number

 [nStyle]

The line style:

1 	Solid

2 	Dashed

3 	Center Line

4 	Phantom line

0 	Use current system line type

 [nGroup]

Group reference number

1-256 	Group number

0 	No group assignment

 [nSubGroup]

Subgroup reference number

1-256 	Subgroup number

0 	No subgroup assignment

 [nPen]

Pen number

1-8 	Pen number

0 	Use current system pen number

 [nWidth]

Line width

1-15 	Odd line width

0 	Use current system line width

Comments

If you wish to specify a group, you must include both the group and the subgroup number.  If either of these arguments is missing or set to zero(0), both of them will be ignored.


ON GOTO

ON GOTO

This provides a multiple branch based on a computed value.  A computed negative or zero value goes to the first label specified.  Values of 1, 2, 3, etc., go to the second, third, fourth, etc. labels, respectively. Any positive value for which there is no label goes to the last label in the list (even if it's the first and only label). Any value that matches a "null" label (e.g., label1, label3) "drops through" and executes the statement following the ON GOTO.

Example

ON value GOTO [lab1, ...]


PALETTE

 PALETTE int  nStart, int  nCount, string  arrayname

Provides a means of setting one or more colors in the CADKEY color palette.  Each color is defined as a combination of red, green, and blue intensities.  The values range between 0 and 255, where 0 is off and 255 is full intensity.

Parameters

 nStart

The starting index to change (0-63)

 nCount

The number of colors to set values for

 arrayname

The two dimensional array containing color values.  This is an nx3 array where n is the number of indices  nCount. For index 'i' in array "rgb", rgb[i][0] is the red, rgb[i][1] is the green, and rgb[i][2] is the blue value of the desired color.


PANDOWN

 PANDOWN double  dPercent, integer  [nViewport]

Pan a viewport down

Return Value

@error set as follows

0 	The operation completed successfully

1 	The viewport number is invalid.

2 	The part document does not exist.

Parameters

 dPercent

The percentage of the viewport size by which to move the viewport.

 [nViewport]

Viewport number:

-1 	All viewports

0 (default) 	Primary viewport

>0 	Designated viewport


PANLEFT

 PANLEFT double  dPercent, integer  [nViewport]

Pan a viewport left

Return Value

@error set as follows

0 	The operation completed successfully

1 	The viewport number is invalid.

2 	The part document does not exist.

Parameters

 dPercent

The percentage of the viewport size by which to move the viewport.

 [nViewport]

Viewport number:

-1 	All viewports

0 (default) 	Primary viewport

>0 	Designated viewport


PANRIGHT

 PANRIGHT double  dPercent, integer  [nViewport]

Pan a viewport right

Return Value

@error set as follows

0 	The operation completed successfully

1 	The viewport number is invalid.

2 	The part document does not exist.

Parameters

 dPercent

The percentage of the viewport size by which to move the viewport.

 [nViewport]

Viewport number:

-1 	All viewports

0 (default) 	Primary viewport

>0 	Designated viewport


PANUP

 PANUP double  dPercent, integer  [nViewport]

Pan a viewport up

Return Value

@error set as follows

0 	The operation completed successfully

1 	The viewport number is invalid.

2 	The part document does not exist.

Parameters

 dPercent

The percentage of the viewport size by which to move the viewport.

 [nViewport]

Viewport number:

-1 	All viewports

0 (default) 	Primary viewport

>0 	Designated viewport


PAUSE

 PAUSE string  [format], value  [val1], ...

Displays a text string on the CADKEY prompt line and waits for the user to press <Enter>, BACKUP, or ESCAPE before continuing. The text displayed may either be a default message (if PAUSE has no parameters) or user-defined text. The default message appears as follows:
 Press RETURN to continue
 To define PAUSE text, the format control string, along with any required value parameters, must be supplied. The format string is processed in the same manner as the PRINT statement (i.e., values are converted as per field specifiers) even though output is to the prompt line. The total length of the text string, including the expanded variables in the string, should not exceed 68 characters or truncation may occur.

Parameters

 [format]

Format control string

 [val1]

First value to output based on first field specifier

...

Value field, one for each field specifier

Comments

System Variables Set:
@KEY (ivar)     Code for last key hit:
 -3 - ESC
 -2 - F10
 -1 - CR (<Enter>)


POINT

 POINT double  x, double  y, double  z, integer  [nMatrix], vname  [hLevel], integer  [nColor], integer  [nGroup], integer  [nSubGroup], integer  [nPen]

The POINT primitive describes an X, Y, Z location in Construction coordinates, or MATRIX(view) coordinates.
 When a point entity is written to a CADL file, a POINT primitive is produced.  If the 2D construction mode is in effect, there will be an associated MATRIX view created first which the POINT will reference.  If the 3D construction mode is in effect, no MATRIX will be created.

Parameters

 x

X value

 y

Y value

 z

Z value

 [nMatrix]

MATRIX primitive reference number. The MATRIX primitive referenced must precede this primitive or an error message is displayed and the program terminates.

0 (default) 	Current Construction Coordinate system is used

 [hLevel]

Level handle

 [nColor]

Color

0-63 	Number in the system color palette

 [nGroup]

Group reference number

1-256 	Group number

0 	No group assignment

 [nSubGroup]

Subgroup reference number

1-256 	Subgroup number

0 	No subgroup assignment

 [nPen]

Pen number

1-8 	Pen number

0 	Use current system pen number

Comments

If you wish to specify a group, you must include both the group and the subgroup number.  If either of these arguments is missing or set to zero(0), both of them will be ignored.


POLYLINE

 POLYLINE integer  nPoints, word  dArrayName, integer  nStyle, integer  [nMatrix], vname  [hLevel], integer  [nColor], integer  [nStyle], integer  [nGroup], integer  [nSubGroup], integer  [nPen], integer  [nWidth], integer  [nFill], integer  [nFill], integer  [nFill]

A POLYLINE primitive describes a polyline by listing the points that make up the entity. Although a polyline is normally thought of as a planar figure, there is no restriction that the vertices must lie in a plane.
 When a POLYLINE primitive is read from a CADL file, this primitive is stored in the system's database as a polyline entity.
 When a polyline entity is written to a CADL file, it is output as a POLYLINE primitive.

Parameters

 nPoints

Number of points in the polyline

 dArrayName

Name of one-dimensional data array containing polyline data as follows:
arrayname [0] = x  (first point in world coordinates)
[1] = y
[2] = z
..
[(n-1)*3]     = x  (last point in world coordinates)
[(n-1)*3+1] = y
[(n-1)*3+2] = z

 nStyle

Polyline style:

1 	Open polyline

2 	Closed polyline

3 	Filled polyline

 [nMatrix]

Matrix View number.  The MATRIX referenced must precede this primitive, or an error message is displayed asn the program in terminated.

0 (default) 	World Coordinate system is used

 [hLevel]

Level handle

 [nColor]

Color of the entity

0-63 	Number in the system color palette

 [nStyle]

The line style:

1 	Solid

2 	Dashed

3 	Center Line

4 	Phantom line

0 	Use current system line type

 [nGroup]

Group reference number

1-256 	Group number

0 	No group assignment

 [nSubGroup]

Subgroup reference number

1-256 	Subgroup number

0 	No subgroup assignment

 [nPen]

Pen number

1-8 	Pen number

0 	Use current system pen number

 [nWidth]

Line width

1-15 	Odd line width

0 	Use current system line width

 [nFill]

Fill color

0-255 	Red fill color value

 [nFill]

Fill color

0-255 	Green color value

 [nFill]

Fill color

0-255 	Blue color value

Comments

If you wish to specify a group, you must include both the group and the subgroup number.  If either of these arguments is missing or set to zero(0), both of them will be ignored.


pow(a, b)

double pow(a, b) double  a, double  b

Returns the value of a raised to the power of b (ab).

Parameters

 a

Any value

 b

Any value.

Example

x = pow (3, 2.5)

 x will be equal to 15.5885


PRINT

 PRINT string  format, value  [val1], ...

Allows the user to write characters, integers, and floating point numbers to the current standard output device in a variety of ways through the use of a format string. PRINT is a more flexible alternative to the WRITE statement.
 The format string contains any number of field specifiers, used to describe how values should be converted and written to the output device. For each specifier, a value is parsed from the statement and written out accordingly. If there is no matching value for a format specification or there is an error in its evaluation, the characters "???" are output in lieu of the value. Unlike the WRITE statement, only one element of an array can be output at a time. Refer to the Introduction section of this CADL guide for a description of field specifiers.
 The device through which output is written is the standard output device. At each CADL invocation, the output device is usually the system console (as with CADKEY). However, if the output redirection symbol (>) is used when CADKEY is initiated, the output device will be the redirection name (see the system's manual for more information on input/output redirection). The output device can be changed at any time to another device or to a file by using the SET DEVOUT command. The new device or file will be in effect until  CADL processing is completed, another SET DEVOUT is processed, or a CLOSE DEVOUT command is processed.

Parameters

 format

Format control string.

 [val1]

First value to output based on first field specifier

...

Value field, one for each field specifier

Comments

System Variables Set:
@ERROR (ivar)    Error code:
0 = No error
1 = DEVOUT not open


PROJECT

 PROJECT double array  adPoint, int  [nMatrix]

Project a point into a plane.  The z value of the coordinate will be set to zero after the projection.  This function is often used in conjunction with GetProjectionMatrix to determine where a point is on a specific construction plane.

Parameters

 adPoint

The point to project

 [nMatrix]

Matrix of the plane to project to, if -1 no operation is performed.  Default is 0, current CPlane.


PROMPT

 PROMPT string  format, value  [val1], ...

Displays a text string on the CADKEY prompt line but does not pause for user input. A format control string must be supplied; additional value parameters are optional.  The resulting text string must not exceed 68 characters or truncation will occur.

Parameters

 format

Format control string.

 [val1]

First value to output based on first field specifier

...

Value field, one for each field specifier


READ

 READ string  fname, integer  mode, variable  var1, variable  [var2]

Causes data to be read from an ASCII file and set into specified variables. The data file consists of numeric values separated by commas. White space, Carriage Returns, and Line Feeds (new lines) may optionally be inserted before or after the numbers. For each variable specified, a number is extracted from the data file. This continues until either all variables are processed or the end of the data file is reached. At the completion of READ processing, the system variable, @NREAD, contains the number of variables set.
 If the filename is not a full path, it is relative to the CADL program.

 The READ command supports two read modes:

Return Value

System Variables Set:
@ERROR (ivar)  Error code:
0 = No error
1 = Can't open data file

@NREAD (ivar)  Number of data items read

Parameters

 fname

Data file specification.  This must include the extension of the data file being used.

 mode

Open mode:

0 	Read from beginning of file.

1 	Read from current file position (if currently opened), otherwise, start from the beginning.

 var1

Name of first variable

 [var2]

Name of second variable

Comments

If a READ command attempts to read beyond the end of the file, an error message will be displayed and the program will abort.  The message states that the datafile has a bad format, this simply means that the CADL program is looking for data past the end of the file and indicated either a problem with the CADL programs logic, or the data in the datafile specified.

Sample file Reading from a datafile

0 	Read from the beginning of the file

1 	Read from the current position
 For open mode 1, a file is considered currently opened only if a previous READ (or WRITE involving the same data file) has been processed within the same CADL execution. This is because all data files are closed when processing of a CADL file (or files if CHAINed or DOSUBed) is complete.


REDO

REDO

Redoes one action in the Undo/Redo system of CADKEY


REDRAW

REDRAW

Update the screen after view manipulation commands


REGISTERPATH

 REGISTERPATH string  pathname, int CADL::  RegisterPath, string  display, string  default

Register a path to be managed by CADKEY and displayed to the user in the Tools-Options-Directories page.

Return Value

The success or failure of the operation, stored in @error.

0 	The registration was successful.

-1 	A path with that name is already registered.

-2 	One or more of the parameters were invalid.

Parameters

 pathname

The name of the path.  This string shall be used for lookups in later functions and shall be used as the name in the registry.  The string should follow the rules for variable names.

 RegisterPath

The base path for this path when it is a relative path

0 	The support path

1 	The user data path

 display

The text displayed to the user in the Directories page.

 default

The default value for the path.  This is used if the user has not entered a value for this path.  If the path is absolute, it is used as-is.  If it is a relative path, it is appended to the selected base path.


REM

REM

Identifies remarks. This keyword, as well as any following text, is ignored by the system when a CADL file is executed.

Comments

In CADL Version 20, the C++ style line Comments "//" are also valid.  These can be used at any place in a line to comment out the rest of the text on that line of the program.

Example

REM string

PAUSE "Display this text" // do not display this text


ROTATE2DAXIS

 ROTATE2DAXIS double  dAngle, double var  x, double var  [y], double var  [z]

Rotate the coordinate clockwise, as if the xy-plane was rotated about the z axis by  ang radians.  Note that this rotation may be the opposite of what is expected.

This uses the Inverse Rotation Formulas.

Parameters

 dAngle

Angle point is to be rotated by

 x

The x coordinate to be modified, this may also be a double array of three values representing the coordinate to modify, in which case the next two parameters  [y] and  [z] are skipped.  Otherwise they are required as the other two elements of the coordinate.

 [y]

The y coordinate to be modified

 [z]

The z coordinate to be modified

u =  x cos(ang) + y sin(ang)

v = -x sin(ang) + y cos(ang)


ROTATE2DAXISOFFSET

 ROTATE2DAXISOFFSET double  dAngle, double var  x, double var  [y], double var  [z], double  xOff, double  yOff, double  zOff

Rotate the coordinate clockwise, as if the xy-plane was rotated about the z axis, centered at the specified rotation offset by  ang radians. Note that this rotation may be the opposite of what is expected.

This uses the Inverse Rotation Formulas.

Parameters

 dAngle

Angle point is to be rotated by

 x

The x coordinate to be modified, this may also be a double array of three values representing the coordinate to modify, in which case the next two parameters  [y] and  [z] are skipped.  Otherwise they are required as the other two elements of the coordinate.

 [y]

The y coordinate to be modified

 [z]

The z coordinate to be modified

 xOff

The x offset of the rotation origin

 yOff

The y offset of the rotation origin

 zOff

The z offset of the rotation origin

u =  x cos(ang) + y sin(ang)

v = -x sin(ang) + y cos(ang)


ROTATECCW

 ROTATECCW double  dAngle, integer  [nViewport]

Rotate a viewport counter-clock-wise

Return Value

@error set as follows

0 	The operation completed successfully

1 	The viewport number is invalid.

2 	The part document does not exist.

3 	The part is in layout mode, and can not be rotated

Parameters

 dAngle

Angle in degrees by which to rotate the viewport

 [nViewport]

Viewport number:

-1 	All viewports

0 (default) 	Primary viewport

>0 	Designated viewport


ROTATECW

 ROTATECW double  dAngle, integer  [nViewport]

Rotate a viewport Clock-wise

Return Value

@error set as follows

0 	The operation completed successfully

1 	The viewport number is invalid.

2 	The part document does not exist.

3 	The part is in layout mode, and can not be rotated

Parameters

 dAngle

Angle in degrees by which to rotate the viewport

 [nViewport]

Viewport number:

-1 	All viewports

0 (default) 	Primary viewport

>0 	Designated viewport


ROTATEDOWN

 ROTATEDOWN double  dAngle, integer  [nViewport]

Rotate a viewport down

Return Value

@error set as follows

0 	The operation completed successfully

1 	The viewport number is invalid.

2 	The part document does not exist.

3 	The part is in layout mode, and can not be rotated

Parameters

 dAngle

Angle in degrees by which to rotate the viewport

 [nViewport]

Viewport number:

-1 	All viewports

0 (default) 	Primary viewport

>0 	Designated viewport


ROTATELEFT

 ROTATELEFT double  dAngle, integer  [nViewport]

Rotate a viewport to the left

Return Value

@error set as follows

0 	The operation completed successfully

1 	The viewport number is invalid.

2 	The part document does not exist.

3 	The part is in layout mode, and can not be rotated

Parameters

 dAngle

Angle in degrees by which to rotate the viewport

 [nViewport]

Viewport number:

-1 	All viewports

0 (default) 	Primary viewport

>0 	Designated viewport


ROTATERIGHT

 ROTATERIGHT double  dAngle, integer  [nViewport]

Rotate a viewport to the right

Return Value

@error set as follows

0 	The operation completed successfully

1 	The viewport number is invalid.

2 	The part document does not exist.

3 	The part is in layout mode, and can not be rotated

Parameters

 dAngle

Angle in degrees by which to rotate the viewport

 [nViewport]

Viewport number:

-1 	All viewports

0 (default) 	Primary viewport

>0 	Designated viewport


ROTATEUP

 ROTATEUP double  dAngle, integer  [nViewport]

Rotate a viewport up

Return Value

@error set as follows

0 	The operation completed successfully

1 	The viewport number is invalid.

2 	The part document does not exist.

3 	The part is in layout mode, and can not be rotated

Parameters

 dAngle

Angle in degrees by which to rotate the viewport

 [nViewport]

Viewport number:

-1 	All viewports

0 (default) 	Primary viewport

>0 	Designated viewport


SAVECPLANE

 SAVECPLANE string  name, vname  [number]

Save the active CPlane so it can be recalled later.

Parameters

 name

The name for the cplane

 [number]

Optional variable to receive the number of the saved cplane.


SaveDimFile

 SaveDimFile string  csFilename

Saves a dimension settings file (*.dim) from the active part

Parameters

 csFilename

Path and file name to save as


SAVEDISPVIEW

 SAVEDISPVIEW string  name, int  [vport], vname  [number]

Saves a display view so it can be recalled later.

Parameters

 name

The name for the view

 [vport]

The number of the viewport to save. Use -1, the default, to save the active viewport.

 [number]

Optional variable to receive the number of the saved display view.


SAVEPART

 SAVEPART   [newPathName]

This function saves the part, optionally with a different name

Return Value

@error set as follows

CKNoError 	The part was successfully saved.

CKError 	An error occured attempting to save the part.

CK_NO_PART 	The part no longer exists

Parameters

 [newPathName]

Optional full pathname to the new location for the saved file


SCALE

 SCALE integer  nViewport, double  [dScale], double  [xc], double  [yc]

Rescales the system part displayed.  This performs the same function as using the system's Immediate Mode command, or activating the Scale option in the Status Window.

Return Value

@error set as follows

0 	The operation completed successfully

1 	The viewport number is invalid.

2 	The part document does not exist.

Parameters

 nViewport

Viewport number:

-1 	All viewports

0 (default) 	Primary viewport

>0 	Designated viewport

 [dScale]

Represents the viewing scale factor. When this parameter is not present, the old scale factor is assumed. Must be > 0.001 and < 10,000

 [xc]

New X screen center. When this parameter is not present, the old screen center is assumed.

 [yc]

New Y screen center. When this parameter is not present, the old screen center is assumed.

Comments

To supply a new screen center both  xc and  cy must be given


SET

 SET word  KeyWord, double  dValue ...

The SET command allows for a number of system patameters to be set.

Parameters

 KeyWord

Specifies what parameter is being set.  May be exactly one of the following:

A0REP 	Set the mode for displaying + or - signs in front of a zero angular dimension tolerance value. When turned on, the sign is not displayed.

ANG_REP 	Set the representation angular dimensions are displayed in. 3 - degrees 4 - degrees minutes seconds 5 - Radians 6 - Gradians

ARR1STYLE 	Set the current style of the first arrowhead.

ARR2STYLE 	Set the current style of the second arrowhead.

ARRDIR 	Set the current direction of the arrowheads: in (0), out (1), or auto (2).

ARR_GAP 	Set the arrowhead gap factor. When this factor is multiplied by the dimension height, it results in the rise that the witness line makes above the leader line.

ALTMODE 	Set the mode for angular dimension tolerance. Values are as follows:
 0 - No tolerance.
 1 - Basic tolerance, drawn surrounded by box.
 2 - Plus tolerance above minus tolerance.
 3 - Tolerances are the same, uses +/- symbol.
 4 - Upper and lower limits instead of value.
 5 - Upper and lower limits on one line.

ATOL_MAX 	Set the maximum tolerance value for angular dimensions.

ATOL_MIN 	Set the minimum tolerance value for angular dimensions.

AUTOCNTR 	Set the mode for automatically centering dimension text. When turned on, the dimension text is automatically centered.

AUTOMAN 	Set the mode for automatically dimensioning text. When turned on, the text is automatically placed in the dimension. When turned off, the text must be entered manually.

EDITVALUE 	Set the mode for using a manually entered value for the dimension display, or using the actual calculated value.  When turned on the manually entered value is used.

COLOR 	Set the current drawing color number

CONST_3D 	Set the 3d construction mode.  (true = 3d, false = 2d)

CPLANE 	Set the current CPlane number

DECDMS 	Set the representation for the angle measurement format.
 3 - decimal degree format
 4 - degree, minute, second format

DECIMAL_POINT 	Set the "Decimal Point" format character

DEC_RND_ANG 	Set the round off factor for angular dimensions, when the unit of the dimension is fractional, or feet and inches.

DEC_RND_DUAL 	Set the round off factor for dual dimensions, when the unit of the dimension is fractional, or feet and inches.

DEC_RND_LIN 	Set the round off factor for linear dimensions, when the unit of the dimension is fractional, or feet and inches.

DEPTH 	Set the construction plane depth

DETAILSTD 	Set the standard being used for detailing.
 0 - No standard
 1 - ANSI standard
 2 - ISO standard
 3 - DIN standard
 4 - JIS standard
 5 - KS standard

DEVIN 	Sets the CADL input filename, which is read via the INPUT command.  The new file will be in effect until either CADL processing is completed, a CLOSE DEVIN is processed, or another SET DEVIN is processed.  If the filename is not a full path, it is relative to the CADL program.  If the optional second parameter is non-zero, the file will be opened in binary mode, with no translation of newlines.

DEVOUT 	Sets the CADL output filename, which is written via the PRINT command.  The new file will be in effect until either CADL processing is completed, a CLOSE DEVOUT is processed, or another SET DEVOUT is processed.  If the filename is not a full path, it is relative to the CADL program.  If the optional second parameter is non-zero, the file will be opened for appending.  Otherwise, the file will be truncated open opening.  If the optional third parameter is non-zero, the file will be opened in binary mode, with no translation of newlines.

DIGANGLE 	Digitization Rotation in degrees

DIMALIGN 	Sets the text alignment of dimension entities. On and the text will line up with the dimensions leader lines.

DIMFILL 	Set the current dimension text fill mode.

DIMHALIGN 	Set the horizontal alignment for dimension text.

DIMJUSTIFY 	Set the justification of dimension text.
 0 - Left Justification
 1 - Center Justification
 2 - Right Justification

DIMLBLDISP 	Set the dual dimension label display flag

DIMMIRROR 	Set the current dimension text mirror mode. All subsequently created dimensions will have this mirror mode.

DIMMODE_ANG 	Set the angular dimension mode, or the system of measurement.
 3 - degree format
 4 - degree, minute, second format

DIMMODE_LIN 	Set the linear dimension mode, or the system of measurement.
 0 - decimal format
 1 - fractional format
 2 - feet and inches format

DIMMODIFIER 	Sets the modifier for the design intent of the dimension and describes a prefix that appears between the user-specified prefix and the text of the dimension.
 0 - NoMod,
 1 - Diameter,
 2 - SphericalDiameter,
 3 - Radius,
 4 - SphericalRadius,
 5 - ControlledRadius,
 6 - Square,
 7 - ArcLength,
 8 - PlateThickness

DIMSHORT 	Set the mode for short leaders for radial and diametral dimensions. When turned on, short leaders are used, otherwise, normal leaders are used.

DIMSLANT 	Set the current dimension text slant angle. The angle ranges from 31 (extreme slant to the left) through -31 (extreme slant to the right), with 0 being the midpoint (no slant).

DIMSPACE 	Set the dimension text line spacing factor

DIMSTRIKE 	Set the current dimension text strikethrough mode.

DIMULINE 	Set the current dimension text underline mode.  All subsequently created dimensions will have this underline mode.

DIMUNIT 	Sets the units for linear dimensions as follows
 0 - User defined Units 1 - Inches
 2 - Millimeters
 3 - Feet
 4 - Centimeters
 5 - Yards
 6 - Meters

DIMVALIGN 	Set the vertical alignment for dimension text.

DIM_COMPONENTS 	Sets the Use Component attributes for detail entities flag.

DISPVIEW 	Number of new display view, optional viewport number

DUALDIM 	Set the dual dimension use flag.

DUALREP 	Set the dual dimension representation.

DUALLBLDISP 	Set the dual dimension label display flag

DUALPLACE 	Set the placement mode of dual dimensions.

DUALREP 	Set the representation of the dual dimension.

DUALRND 	Set the rounding factor for dual dimensions.

DUALPREC 	Set the precison of dual dimensions.

DUALSCALE 	Get the scale factor for dual dimensions.

DUALUNITS 	Sets the units to use for dual dimensions.

FILLCOLOR 	Set the current fill color value.  If the high order byte is set, this is an index into the entity color palette, otherwise it is an actual RGB value.

FRACT_RND_DUAL 	Set the round off factor for dual dimensions, when the unit of the dimension is fractional, or feet and inches.

FRACT_RND_LIN 	Set the round off factor for linear dimensions, when the unit of the dimension is fractional, or feet and inches.

GRID 	Set the display of the grid on or off.

GRIDINC 	Set the grid parameters: x spacing, y spacing, x offset and y offset

L0REP 	Set the mode for displaying + or - signs in front of a zero linear dimension tolerance value. When turned  on, the sign is not displayed.

LDR_DIST 	Set the gap from the dimension text to a solid leader line.  Used in conjunction with the CK_SET_LDR_DISTOPT flag.

LDR_DISTOPT 	Set the meaning of the leader distance value.
 0 - value is a percentage of text height.
 1 - value is an absolute value.

LDZERO_ANG 	Set the mode for displaying leading zeros in angular dimensions. When turned on, keeps the leading zeros.

LDZERO_DUAL 	Set the mode for displaying leading zeros in dual dimensions. When turned on, keeps the leading zeros.

LDZERO_LIN 	Set the mode for displaying leading zeros in linear dimensions. When turned on, keeps the leading zeros.

LEADER 	Set the current leader display style. All subsequently created leaders will be this style. Possible values are:
 0 - both leader lines.
 1 - first leader line.
 2 - second leader line.
 3 - no leader line.
 4 - solid leader line.
 5 - 1st leader line to be solid.
 6 - 2nd leader line to be solid.
 7 - solid leader with no arrowheads.

LEVEL 	Set the level to be the active one.

LIMIT 	Sets the current line segment termination mode of the CADKEY line creation functions.
 0 - the line endpoints will be coincident with the positions specified.
 1 - line segments are extended through positions to the intersection with the boundary of the viewport of definition.

LINESTYLE 	Sets the current line style.  All subsequently created geometry will have this line style.

LINEWIDTH 	Sets the current line width.  All subsequently created geometry will have with this width.

LTLMODE 	Set the tolerance mode for linear dimensions. Values are as follows:
 0 - No tolerance.
 1 - Basic tolerance, drawn surrounded by box.
 2 - Plus tolerance above minus tolerance.
 3 - Tolerances are the same, uses +/- symbol.
 4 - Upper and lower limits instead of value.
 5 - Upper and lower limits on one line.

LTOL_MAX 	Set the maximum tolerance value for linear dimensions

LTOL_MIN 	Set the minimum tolerance value for linear dimensions

MODBRKATRIB 	Set the modify break attribute option

MODBRKGROUP 	Set the modify break group rules option

MODBRKLEVEL 	Set the modify break level override

NOTEANG 	Set the angle of a vector along which all subsequently created note, disknote, and label text is drawn.  The angle ranges from 0.o°, a horizontal vector running from left to right, through 360.0°, measured in a counter-clockwise direction.

NOTEFILL 	Set the current note text fill mode. All subsequently created notes, disk notes, and labels will have this fill mode.

NOTEHALIGN 	Set the horizontal alignment for note text.

NOTEHT 	Set the current note text height. All subsequently created notes, disk notes, and labels will have this height assigned.

NOTEJUSTIFY 	Set the justification of note text.
 0 - Left Justification
 1 - Center Justification
 2 - Right Justification

NOTELINE 	Set the current note text line spacing factor. The product of this factor and the character height is equal to the distance between the lines of text. All subsequently created notes and disk notes will use this factor.

NOTEMIRROR 	Set the current note text mirror mode.  All subsequently created notes, disk notes, and labels will have this mirror mode.

NOTESLANT 	Set the current note text slant angle. The angle ranges from 31 (extreme slant to the left) through -31 (extreme slant to the right), with 0 being the midpoint (no slant).

NOTESPACE 	Set the spacing for the note text lines.

NOTESTRIKE 	Set the current note strikethrough mode.

NOTEULINE 	Set the current note text underline mode.  All subsequently created notes, disk notes, and labels will have this underline mode.

NOTEVALIGN 	Set the vertical alignment for note text.

PAR_DIR 	Set the note paragraph direction

PEN 	Set the current pen number.

POSSNAP 	Set the position snap flag.

POSSNAP_CTR 	Set the center snap flag.

POSSNAP_END 	Set the endpoint snap flag.

POSSNAP_MID 	Set the midpoint snap flag.

POSSNAP_PNT 	Set the point snap flag.

POSSNAP_QUAD 	Set the quadrant snap flag.

POSSNAP_SIZE 	Set the position snap search radius.

POSSNAP_X2D 	Set the 2D intersection snap flag.

POSSNAP_X3D 	Set the 3D intersection snap flag.

PRECISION_ANG 	Set the decimal precision for angular dims in degrees

PRECISION_DUAL 	Set the decimal precision for dual dims

PRECISION_LIN 	Set the decimal precision for linear dims

QTRIM 	Enable the quick trim mode

SELLIST 	Set the selection list mode

SELTOGGLE 	Set the selection toggle key

SNAP 	Set the snap mode on or off.

SNAPINC 	Set the snap parameters: x spacing, y spacing, x offset and y offset

TEXTASP 	Set the width/height ratio of note text characters. A value of 0.5 will produce characters of normal aspect ratio. A value > 0.5 causes the characters to be compressed horizontally. A greater value causes expansion. All subsequently created text entities will have this aspect ratio assigned.

TOL_SCALE 	Set the text scale factor for double-up tolerancing.

TRZERO_ANG 	Set the trailing zeros mode for angular dimensions. When turned on, keeps the trailing zeros.

TRZERO_DUAL 	Set the trailing zeros mode for dual dimensions. When turned on, keeps the trailing zeros.

TRZERO_LIN 	Set the trailing zeros mode for linear dimensions.  When turned on, keeps the trailing zeros.

UNIT 	Set the drawing units of the model.

UNITSCALE 	Sets the scale of the part units for UserDefined units.  If the units are not user defined, they will be changed to UserDefined.  The scale is the number of UserUnits per inch.

VERSEL 	Enable selection verification mode

WITANGLE 	Set the angle by which to sheer the dimension witness lines.

WIT_GAP 	Set the witness line gap factor. When this factor is multiplied by the dimension height, it results in the distance (gap) between the witness line and its reference point.

WITNESS 	Set the display of witness lines in dimensions. All subsequently created dimensions will use this witness line display mode. Possible display mode values are:
 0 - Both
 1 - First
 2 - Second
 3 - None

WORLD_COORD 	Set the world construction mode. (1 = world, 0 = cplane)

XFCPYOPT 	Sets the copy option

XFGRPOPT 	Use the group option

XFJPTOPT 	Set the join option

XFJPTRUL 	Resolve the ambiguity

XFJPTCPY 	Join using the copy option

XFLEVOPT 	Use the Active level

 dValue ...

The value(s) to set the system parameter(s) to.


SETATTR

 SETATTR   hEntity,   Value1,   Value2,   ...

Sets the attributes of the specified entity.  The parameters correspond one-to-one to the attributes as defined by the most recent DEFATTR command.  If a parameter is omitted, the corresponding attribute is left unchanged.  Parameters which do not apply to a particular entity type are ignored.

Parameters

 hEntity

The entity to be acted upon.  If not provided, the attributes will be applied to all entities in the selection list.

 Value1

The first attribute value

 Value2

The second attribute value

 ...

and so on

Comments

Below are the ranges of allowable values for the vauious attributes.

COLOR (integer) 	1 - 64

FCOLOR (long) 	Hex RGB value in the form 0x00BBGGRR. where the range for each value is 0x00 - 0xFF.

GRPNUM (integer) 	0 - 127

LINETYPE (integer) 	1 - 4

LINEWIDTH (integer) 	1 - 15 odd

PEN (integer) 	1 - 8

SUBGRP (integer) 	0 - 255

TEXTANGLE (double) 	0.0 - 360.0

TEXTASP (double) 	0.01 - 100.0

TEXTFILL (integer) 	0 or 1

TEXTLINE (double) 	any value

TEXTSLANT (double) 	and value

TEXTSTRIKE (integer) 	0 or 1

TEXTHT (double) 	0.0005 - 10000.0

TEXTULINE (integer) 	0 or 1

TEXTMIRROR (integer) 	0 or 1

LEVEL (handle) 	valid level handle


SETCPLANE

 SETCPLANE vname  data

Set the active CPlane's matrix

Parameters

 data

A double array containing 16 values indicating the 4x4 matrix for the cplane, or an HENTITY containing a Plane entity used to define the cplane.


SETDIMFONT

 SETDIMFONT string  sFont

Sets the dimension font to the named font

Parameters

 sFont

Name of the font to set


SETDIMFONT

 SETDIMFONT string  sFont

Sets the dimension font to the named font

Parameters

 sFont

Name of the font to set


SETDIMLABEL

 SETDIMLABEL string  sLabel

Sets the Label for the dimensions to display

Parameters

 sLabel

Label to set


SETDISPVIEW

 SETDISPVIEW vname  data, int  [nVPort]

Set the display view of a viewport

Parameters

 data

A double array containing 16 values indicating the 4x4 matrix for the display view, or an HENTITY containing a Plane entity used to define the view.

 [nVPort]

Which viewport to change, or -1 (default) for the active viewport.


SETDUALLABEL

 SETDUALLABEL string  sLabel

Sets the Label for the dual dimensions to display

Parameters

 sLabel

Label to set


SETGEOTOL

 SETGEOTOL vname  hGeoTol, integer  [nFrames], integer  [bBoundary], integer  [bAllAround], string  [lpszOther], string  [lpszBetween1], string  [lpszBetween2], integer  [nColor], integer  [nPen], double  [dTextHeight], double  [dTextAspect], double  [dWitnessGap], double  [dArrowGap], string  [lpszFontName]

Set data about a GEOTOL entity.

Parameters

 hGeoTol

Handle to a GEOTOL entity

 [nFrames]

The number of frames in the symbol

 [bBoundary]

Is this a boundary-type symbol?

 [bAllAround]

Is the all-around symbol displayed?

 [lpszOther]

The text displayed below the symbol

 [lpszBetween1]

The first half of the between text.  This can not be combined with  lpszOther.

 [lpszBetween2]

The second half of the between text  This can not be combined with  lpszOther.

 [nColor]

The color number for this symbol

 [nPen]

The pen number for this symbol

 [dTextHeight]

The text height for this symbol

 [dTextAspect]

The text aspect ratio for this symbol

 [dWitnessGap]

The gap between witness endpoints and geometry

 [dArrowGap]

The gap between the leader line and geometry

 [lpszFontName]

The name of the font to use.


SETGEOTOLDATUM

 SETGEOTOLDATUM vname  hGeoTol, vname  [hDatum]

Associate a DATUM entity with a GEOTOL entity

Parameters

 hGeoTol

Handle to a GEOTOL entity

 [hDatum]

Handle to a DATUM entity, default removes the datum


SETGEOTOLFRAME

 SETGEOTOLFRAME vname  hGeoTol, integer  nFrameNumber, integer  [nFrameType], integer  [nSymbolType], integer  [nTolModifier], string  [lpszTolerance], integer  [nMaterialCond], string  [lpszMaximum], integer  [bProjected], string  [lpszProjected], integer  [bStatistical], integer  [bFreeState], integer  [bTangentPlane], integer  [bEnvelope], integer  [bReciprocity

Set the data for a single frame of a GEOTOL

Parameters

 hGeoTol

Handle to a GEOTOL entity

 nFrameNumber

The number of the frame (1-3)

 [nFrameType]

The frame type (single/composite)

0 	Standard frame.

1 	The top frame in a composite pair.

2 	The bottom frame in a composite pair.

3 	The top frame in a three-frame composite.

4 	The bottom frame in a three-frame composite.

5 	The bottom frame in a three-frame composite.

 [nSymbolType]

The symbol displayed by the frame

33 	TruePosition, position of a feature.  (Also called Position)

34 	Concentricity, control of the axis of a feature relative to a datum axis.

35 	Symmetry, control of of the symmetry of a noncylindrical size feature by its median line.

36 	Cylindricity, circularity and paralleism control on the elements of a surface.

37 	Straightness, straightness of surface elements, or of an axis or center plane.

38 	Flatness, form variations of a flat surface.

39 	Parallelism, orientation of two parallel features.

40 	Circularity, control on the surface of a circular feature at individual cross sections.

41 	Perpendicular, constraint of perpendicularity, also called Squareness or Normality.

42 	Angularity, constraint of angularity in combination with an angular dimension.

43 	SurfaceProfile, a three-dimensional surface control along the length and width of a feature.

44 	LineProfile, two-dimensional surface control along the length of a feature.

45 	CircularRunout, circular runout surface control.

46 	TotalRunout, a total runout surface control.

 [nTolModifier]

The tolerance zone modifier

1 	The diameter of a circle

2 	The diameter of a sphere

3 	The radius of a circle

4 	The radius of a sphere

5 	Radius of an arc with no reversals

 [lpszTolerance]

The tolerance string for the frame

 [nMaterialCond]

The material condition modifier

24 	Maximum Material Condition.

25 	Regardless of Feature Size.

26 	GD&T Least Material Condition.

 [lpszMaximum]

The max value for perp and parallel

 [bProjected]

Is this a projected tolerance zone?

 [lpszProjected]

Projected tolerance zone symbol

 [bStatistical]

Is this a statistical tolerance?

 [bFreeState]

Does this apply at free state?

 [bTangentPlane]

Is this applied in a tangent plane?

 [bEnvelope]

Does this obey the envelope principle?

 [bReciprocity

Reciprocity?


SETGEOTOLFRAMEDATUM

 SETGEOTOLFRAMEDATUM vname  hGeoTol, integer  nFrameNumber, integer  nDatumNumber, vname  [hDatum1], string  [lpszDatum1, integer  [nMaterialCond1], vname  [hDatum2], string  [lpszDatum2], integer  [nMaterialCond2]

Assigns a DATUM or string to a GEOTOL datum reference.

Parameters

 hGeoTol

Handle to a GEOTOL entity

 nFrameNumber

The number of the frame (1-3)

 nDatumNumber

Datum number in the frame (1-3)

 [hDatum1]

Handle to a DATUM entity

 [lpszDatum1

Text identifying the datum

 [nMaterialCond1]

Material condition modifier

24 	Maximum Material Condition.

25 	Regardless of Feature Size.

26 	GD&T Least Material Condition.

 [hDatum2]

Handle to a 2nd DATUM entity

 [lpszDatum2]

Text identifying the 2nd datum

 [nMaterialCond2]

Second material condition modifier

24 	Maximum Material Condition.

25 	Regardless of Feature Size.

26 	GD&T Least Material Condition.


SETGEOTOLLEADERS

 SETGEOTOLLEADERS vname  hGeoTol, integer  nLeaderStyle, integer  [nOrientStack], integer  [nArrowDir], vname  [hSymbolLoc], multi vname  [hLocations]

Set the leaders for a GEOTOL

Parameters

 hGeoTol

Handle to a GEOTOL entity

 nLeaderStyle

The style of leader to use

0 	no leader is displayed

1 	standard label leader with witness

2 	standard label leader without the witness

3 	attached to another entity (no actual leader)

4 	multiple leaders off of common stem

5 	horizontal/vertical leader

6 	"gap" leader that looks like a linear dimension

7 	leader that looks like a circular dimension

 [nOrientStack]

Orientation or stacking type, depending on  nLeaderStyle

1 	Stacked above the other entity.

2 	Stacked to the right of the other entity.

3 	Stacked below the other entity.

4 	Stacked to the left of the other entity.

0 	Horizontal orientation

1 	vertical orientation

2 	parallel orientation

 [nArrowDir]

Arrow direction

0 	Inward

1 	Outward

2 	Auto

 [hSymbolLoc]

Associative symbol location

 [hLocations]

Handles to locations for leaders


SETLEVEL

 SETLEVEL HLevel  hLevel

Sets this to be the active level.

Parameters

 hLevel

The Level handle


SETLEVELNUMBER

 SETLEVELNUMBER HLevel  hLevel, int  nNumber

Sets the number of the given level.

Parameters

 hLevel

The Level handle

 nNumber

The number to set the Level to.


SETNOTE

 SETNOTE double  [height], double  [aspect], double  [rotation], string  [font], double  [slant], int  [fill], double  [linespace], int  [underline], int  [mirror], int  [strike]

SETNOTE sets the various current note text parameters such as height, aspect ratio, font, etc.  This performs the same function as using the DETAIL, SET function of the system.  All subsequently created notes are assigned these attributes.

Parameters

 [height]

Text height in working units

 [aspect]

Aspect ratio of text (width/ht) must be >= 0.01 and <= 100

 [rotation]

Rotation angle (in degrees) must be >= 0 and <= 360

 [font]

Name of the font to use for notes

 [slant]

Slant angle in degrees

 [fill]

Fill flag

0 	No fill

1 	Fill font

 [linespace]

Line spacing factor. The distance between lines of text equals this factor times the character height.

 [underline]

Underline flag

0 	No underline

1 	Underline

 [mirror]

Mirror text flag

0 	Not mirrored

1 	Mirrored

 [strike]

Strikethrough flag

0 	No strikethrough

1 	Strikethrough


SETPATH

 SETPATH string  pathname, string  newpath

Set the value of a registered path.

Return Value

The success or failure of the operation

0 	The path has been set.

-1 	The path was not found in the set of registered paths.

-2 	An error occurred while setting the path.

Parameters

 pathname

The name of the path, as passed to REGISTERPATH

 newpath

The new value of the path.  If this parameter is not provided, then the path will be removed from the registry.

If a path is provided, and the start of the path matches the current support path, ignoring case, the support path part will be removed.

If the new path value matches the default value for the path, ignoring case, then the path will be removed from the registry.


SETPREFIX

 SETPREFIX string  sString

Sets the prefix for new dimensions to display

Parameters

 sString

Text to set


SETSTDPROPFILE

 SETSTDPROPFILE string  [PartNumber], string  [Description], string  [Creator], string  [Keywords], string  [LastAuthor], string  [Revision], string  [Material], string  [Vendor], string  [Comments]

Sets the standard properties for the active design file

Parameters

 [PartNumber]

standard property

 [Description]

standard property

 [Creator]

standard property

 [Keywords]

standard property

 [LastAuthor]

standard property

 [Revision]

standard property

 [Material]

standard property

 [Vendor]

standard property

 [Comments]

standard property


SETSTDPROPPART

 SETSTDPROPPART string  [PartNumber], string  [Description], string  [Creator], string  [Keywords], string  [LastAuthor], string  [Revision], string  [Material], string  [Vendor], string  [Comments]

Sets the standard properties for the active part

Parameters

 [PartNumber]

standard property

 [Description]

standard property

 [Creator]

standard property

 [Keywords]

standard property

 [LastAuthor]

standard property

 [Revision]

standard property

 [Material]

standard property

 [Vendor]

standard property

 [Comments]

standard property


SETSUFFIX

 SETSUFFIX string  sString

Sets the suffix for new dimensions to display

Parameters

 sString

Text to set


SETUSERPROPFILE

 SETUSERPROPFILE string  [sName1], string  [sValue1], string  [sName2], string  [sValue2],   [...]

Sets the user properties for the active design file

Parameters

 [sName1]

Property name 1

 [sValue1]

Property value 1

 [sName2]

Property name 2

 [sValue2]

Property value 2

 [...]

etc.


SETUSERPROPPART

 SETUSERPROPPART string  [sName1], string  [sValue1], string  [sName2], string  [sValue2],   [...]

Sets the user properties for the active design file

Parameters

 [sName1]

Property name 1

 [sValue1]

Property value 1

 [sName2]

Property name 2

 [sValue2]

Property value 2

 [...]

etc.


sin(x)

double sin(x) double  x

The sine of the angle x, a value in the range -1 to 1.

Parameters

 x

Any angle value, in degrees.

Example

y = sin(16)

 y will be equal to 0.275637


sinh(x)

double sinh(x) double  x

The hyperbolic sine of the angle x; it can be any double-precision value.

Parameters

 x

Any angle value in degrees.

Example

y = sinh(34)

 y will be equal to 0.628857


sizeof(xxx)

integer sizeof(xxx) vname  xxx

An integer representing the size of the item specified where:

Parameters

 xxx

The name of a variable or array.

Example

n = sizeof (footage)

0 	undefined

1 	defined single variable

>1 	defined array of n elements


SPLINE

 SPLINE word  [csTypeCode], word  [csArrayname], integer  [nNumberPoints], integer  [nMatrix], integer  [nLevel], integer  [nColor], integer  [nStyle], integer  [nGroup], integer  [nSubGroup], integer  [nPen], integer  [nWidth]

The SPLINE data primitive describes a 2D or 3D cubic parametric spline in one of two ways.

Parameters

 [csTypeCode]

Spline type descriptor, a character string type code specifying the type of spline and data being supplied. The format of this type code consists of a combination of the following character codes:

The first character describes the form of data, where: P = node points C = coefficients

The second character describes the dimension of the spline, where: 2 = 2D 3 = 3D

The third and fourth characters describe the start and end conditions of the spline: N = natural (zero curvature) V = slope of the tangent vector at the start or end point C = closed spline; end conditions are automatically defined

The N and V characters are required only when using P for the first character of the typecode.

For example, P2NV describes a 2D spline primitive defined by node points, with natural curvature at the start point and a tangent vector describing the curvature at the end point.

P2NN 	2-D - spline defined by points with natural-natural ends.

P2VN 	2-D - spline, defined by with vector-natural ends.

P2NV 	2-D - spline, defined by pointswith natural-vector ends.

P2VV 	2-D - spline, defined by pointswith vector-vector ends.

P2C 	2-D - closed spline, defined by points.

P3NN 	3-D - spline, defined by points with natural-natural ends.

P3VN 	3-D - spline, defined by points with vector-natural ends.

P3NV 	3-D - spline, defined by points with natural-vector ends.

P3VV 	3-D - spline, defined by points with vector-vector ends.

P3C 	3-D - closed spline, defined by points.

C2 	2-D - spline, defined by coefficients.

C2C 	2-D - closed spline defined by coefficients.

C3 	3-D - spline, defined by coefficients.

C3C 	3-D - closed spline, defined by coefficients

xi = axi * u3 + bxi * u2 + cxi * u + dxi

yi = ayi * u3 + byi * u2 + cyi * u + dyi

zi = azi * u3 + bzi * u2 + czi * u + dzi

where: u = a parameter value between 0 and 1

 [csArrayname]

Name of the array where node or coefficient data is stored.  The format of the data in arrayname is dependent upon the type of spline being represented.

 [nNumberPoints]

Number of node points or coefficient sets in spline.

 [nMatrix]

Matrix View number.  The MATRIX referenced must precede this primitive, or an error message is displayed and the program is terminated.

0 (default) 	World Coordinate system is used

 [nLevel]

Level number

 [nColor]

Color of the entity

0-63 	Number in the system color palette

 [nStyle]

The line style:

0 	Use current system line type

1 	Solid

2 	Dashed

3 	Center Line

4 	Phantom line

 [nGroup]

Group reference number

0 	No group assignment

1-128 	Group number

 [nSubGroup]

Subgroup reference number

0 	No subgroup assignment

1-255 	Subgroup number

 [nPen]

Pen number

0 	Use current system pen number

1-8 	Pen number

 [nWidth]

Line width

0 	Use current system line width

1-15 	Odd line width

Comments

If you wish to specify a group, you must include both the group and the subgroup number.  If either of these arguments is missing or set to zero(0), both of them will be ignored.

Usage 1, csTypecode =
 P2NN : 2D Spline, defined by points with natural-natural ends.
 P2VN : 2D Spline, defined by points with vector-natural ends.
 P2NV : 2D Spline, defined by points with natural-vector ends.
 P2VV : 2D Spline. defined by points with vector-vector ends.
 P2C  : 2D Spline, defined by points, closed.

The csArrayname parameter is a one or two-dimensional array where node points and tangent vector data is stored.  In the case of a closed spline, if the first point in the array is erroneously duplicated at the end of the array, unpredictable results may occur.  If this is a two-dimensional array, the size of the second dimension must be 2 or 3.  The third value is ignored for 2d splines.

The format of the data is as follows:

For  csTypecode =  P2NN:
 [0][0] = X1 (X value for node point #1 in spline's view )
 [0][1] = Y1 (Y value for node point #1 in spline's view )
 ...
 ...
 [n-1][0] = Xn (X value for node point n in spline's view )
 [n-1][1] = Yn (Y value for node point n in spline's view )

For  csTypecode = P2VN or P2NV:
 [0][0] = X1 (X value for node point #1 in spline's view )
 [0][1] = Y1 (Y value for node point #1 in spline's view )
 ...
 ...
 [n-1][0]    =   Xn (X value for node point n in spline's view)
 [n-1][1]    =   Yn (Y value for node point n in spline's view )
 [n][0]      =   XV (X tangent vector component value for start or end in spline's view coordinates)
 [n][1]      =   YV (Y tangent vector component value for start or end in spline's view coordinates)

For  csTypecode =  P2VV:
 [0][0] = X1 (X value for node point #1 in spline's view )
 [0][1] = Y1 (Y value for node point #1 in spline's view )
 ...
 ...
 [n-1][0]    =   Xn (X value for node point n in spline's view)
 [n-1][1]    =   Yn (Y value for node point n in spline's view )
 [n][0]      =  XV1 (X tangent vector component value for start in spline's view coordinates)
 [n][1]      =  YV1 (Y tangent vector component value for start in spline's view coordinates)
 [n+1][0]    =  XV2 (X tangent vector component value for end in spline's view coordinates)
 [n+1][1]    =  YV2 (Y tangent vector component value for end in spline's view coordinates)

For  csTypecode =  P2C (n points will result in a closed spline of n segments):
 [0][0] = X1 (X value for node point #1 in spline's view )
 [0][1] = Y1 (Y value for node point #1 in spline's view )
 ..
 ..
 [n-1][0] = Xn (X value for node point n in spline's view )
 [n-1][1] = Yn (Y value for node point n in spline's view )

Usage 2, csTypecode =
 P3NN   : 3D Spline, defined by points with natural-natural ends.
 P3VN   : 3D Spline, defined by points with vector-natural ends.
 P3NV   : 3D Spline, defined by points with natural-vector ends.
 P3VV   : 3D Spline, defined by points with vector-vector ends.
 P3C    : 3D Spline, defined by points, closed.

The csArrayname parameter is a one or two-dimensional array where node points and tangent vector data is stored.  In the case of a closed spline, if the first point in the array is erroneously duplicated at the end of the array, unpredictable results may occur.  If this is a two-dimensional array, the size of the second dimension must be 3.

The format of the data is as follows:

For  csTypecode =  P3NN:
 [0][0] = X1 (X value for node point #1 in spline's view coordinates)
 [0][1] = Y1 (Y value for node point #1 in spline's view coordinates)
 [0][2] = Z1 (Z value for node point #1 in spline's view coordinates)
 ...
 ...
 [n-1][0] = Xn (X value for node point n in spline's view coordinates)
 [n-1][1] = Yn (Y value for node point n in spline's view coordinates)
 [n-1][2] = Zn (Z value for node point n in spline's view coordinates)

For  csTypecode =  P3VN or  P3NV:
 [0][0] =  X1 (X value for node point #1 in spline's view coordinates)
 [0][1] =  Y1 (Y value for node point #1 in spline's view coordinates)
 [0][2] =  Z1 (Z value for node point #1 in spline's view coordinates)
 ...
 ...
 [n-1][0] = Xn (X value for node point n in spline's view coordinates)
 [n-1][1] = Yn (Y value for node point n in spline's view coordinates)
 [n-1][2] = Zn (Z value for node point n in spline's view coordinates)
 [n][0] = XV (X tangent vector component value for start or end of spline in spline's view coordinates)
 [n][1] = YV (Y tangent vector component value for start or end of spline in spline's view coordinates)
 [n][2] = ZV (Z tangent vector component value for start or end of spline in spline's view coordinates)

For  csTypecode =  P3VV:
 [0][0] = X1 (X value for node point #1 in spline's view coordinates)
 [0][1] = Y1 (Y value for node point #1 in spline's view coordinates)
 [0][2] = Z1 (Z value for node point #1 in spline's view coordinates)
 ...
 ...
 [n-1][0] = Xn (X value for node point n in spline's view coordinates)
 [n-1][1] = Yn (Y value for node point n in spline's view coordinates)
 [n-1][2] = Zn (Z value for node point n in spline's view coordinates)
 [n][0]   = XV1 (X tangent vector component value for start of spline in spline's view coordinates)
 [n][1]   = YV1 (Y tangent vector component value for start of spline in spline's view coordinates)
 [n][2]   = ZV1 (Z tangent vector component value for start of spline in spline's view coordinates)
 [n+1][0] = XV2 (X tangent vector component value for end of spline in spline's view coordinates)
 [n+1][1] = YV2 (Y tangent vector component value for end of spline in spline's view coordinates)
 [n+1][2] = ZV2 (Z tangent vector component value for end of spline in spline's view coordinates)

For  csTypecode =  P3C (n points will result in a closed spline of n segments):
 [0][0] = X1 (X value for node point #1 in spline's view coordinates)
 [0][1] = Y1 (Y value for node point #1 in spline's view coordinates)
 [0][2] = Z1 (Z value for node point #1 in spline's view coordinates)
 ...
 ...
 [n-1][0] = Xn (X value for node point n in spline's view coordinates)
 [n-1][1] = Yn (Y value for node point n in spline's view coordinates)
 [n-1][2] = Zn (Z value for node point n in spline's view coordinates)

Usage 3, csTypecode =
 C2  : 2D Spline defined by coefficients.
 C2C : 2D closed Spline defined by coefficients.

The csArrayname parameter is a one or two-dimensional array where coefficient values are stored. In the case of a closed spline, it is important to ensure that the necessary continuity conditions between the first and last segments are maintained and that the coefficients in the array are defined appropriately.  If this is a two-dimensional array, the size of the second dimension must be 8 or 12.  The 9th through 12th values are ignored for 2d splines.

The format of the data is as follows:

For  csTypecode =  C2,  C2C:
 [0][0] = C1 (ax coefficient for equation of 1st spline segment)
 [0][1] = C2 (bx coefficient for equation of 1st spline segment)
 [0][2] = C3 (cx coefficient for equation of 1st spline segment)
 [0][3] = C4 (dx coefficient for equation of 1st spline segment)
 [0][4] = C5 (ay coefficient for equation of 1st spline segment)
 [0][5] = C6 (by coefficient for equation of 1st spline segment)
 [0][6] = C7 (cy coefficient for equation of 1st spline segment)
 [0][7] = C8 (dy coefficient for equation of 1st spline segment)
 ...
 ...
 [n-1][0] = C1 (ax coefficient for equation of nth spline segment)
 [n-1][1] = C2 (bx coefficient for equation of nth spline segment)
 [n-1][2] = C3 (cx coefficient for equation of nth spline segment)
 [n-1][3] = C4 (dx coefficient for equation of nth spline segment)
 [n-1][4] = C5 (ay coefficient for equation of nth spline segment)
 [n-1][5] = C6 (by coefficient for equation of nth spline segment)
 [n-1][6] = C7 (cy coefficient for equation of nth spline segment)
 [n-1][7] = C8 (dy coefficient for equation of nth spline segment)

Usage 4, csTypecode =
 C3    : 3D Spline defined by coefficients.
 C3C   : 3D Closed Spline defined by coefficients.

The csArrayname parameter is a one or two-dimensional array where coefficient values are stored.  In the case of a closed spline, it is important to ensure that the necessary continuity between the first and last segments are maintained and that the coefficients in the array are defined appropriately.  If this is a two-dimensional array, the size of the second dimension must be 12.

The format of the data is as follows:
 [0][ 0]  = C1  (ax coefficient for equation of 1st spline segment)
 [0][ 1]  = C2  (bx coefficient for equation of 1st spline segment)
 [0][ 2]  = C3  (cx coefficient for equation of 1st spline segment)
 [0][ 3]  = C4  (dx coefficient for equation of 1st spline segment)
 [0][ 4]  = C5  (ay coefficient for equation of 1st spline segment)
 [0][ 5]  = C6  (by coefficient for equation of 1st spline segment)
 [0][ 6]  = C7  (cy coefficient for equation of 1st spline segment)
 [0][ 7]  = C8  (dy coefficient for equation of 1st spline segment)
 [0][ 8]  = C9  (az coefficient for equation of 1st spline segment)
 [0][ 9]  = C10 (bz coefficient for equation of 1st spline segment)
 [0][10]  = C11 (cz coefficient for equation of 1st spline segment)
 [0][11]  = C12 (dz coefficient for equation of 1st spline segment)
 ...
 ...
 [n-1][ 0] = C1  (ax coefficient for equation of nth spline segment)
 [n-1][ 1] = C2  (bx coefficient for equation of nth spline segment)
 [n-1][ 2] = C3  (cx coefficient for equation of nth spline segment)
 [n-1][ 3] = C4  (dx coefficient for equation of nth spline segment)
 [n-1][ 4] = C5  (ay coefficient for equation of nth spline segment)
 [n-1][ 5] = C6  (by coefficient for equation of nth spline segment)
 [n-1][ 6] = C7  (cy coefficient for equation of nth spline segment)
 [n-1][ 7] = C8  (dy coefficient for equation of nth spline segment)
 [n-1][ 8] = C9  (az coefficient for equation of nth spline segment)
 [n-1][ 9] = C10 (bz coefficient for equation of nth spline segment)
 [n-1][10] = C11 (cz coefficient for equation of nth spline segment)
 [n-1][11] = C12 (dz coefficient for equation of nth spline segment)


SPRINT

 SPRINT string var  str, string  format, value  [val1], ...

Allows the user to write characters, integers, and floating point numbers into a string variable through the use of a format string.
 The format string contains any number of field specifiers, used to describe how values should be converted. For each specifier, a value is parsed from the statement and placed into the string variable accordingly. If there is no matching value for a format specification or there is an error in its evaluation, the characters "???" are used in lieu of the value. Refer to the Introduction of this CADL guide for a description of field specifiers.

Parameters

 str

Variable to store return string. Variable name must begin with a '$' character. The returned string will be a null terminated array of characters.

 format

Format control string.

 [val1]

First value to output based on first field specifier

...

Value field, one for each field specifier


sqrt(x)

double sqrt(x) double  x

The square root of x.

Parameters

 x

Any number which is greater than or equal to zero.

Example

y = sqrt(18.67)

 y will be equal to 4.32088


SURFACETEXTURE

 SURFACETEXTURE int  Style, int  LayDir, int  LdrType, double  [Angle], String  [sMaxRough], String  [sMinRough], String  [sCutOff], String  [sRoughWidth], String  [sWaveHeight], String  [sWaveSpace], String  [sRemoved], hLocation  [loc], double  [x], double  [y], double  [z], integer  [nMatrix], vname  [hLevel], string  [strFont], double array  [adTxtAtt], integer array  [iaEntAtt]

Add a surface texture symbol to this part

Parameters

 Style

Style of the basic surface symbol

 LayDir

The lay direction symbol

 LdrType

Which leader style is used

 [Angle]

to place symbol at

 [sMaxRough]

representing the Maximum roughness

 [sMinRough]

representing the Minimum roughness

 [sCutOff]

representing the Cut off

 [sRoughWidth]

representing the Maximum roughness width

 [sWaveHeight]

representing the Wave height

 [sWaveSpace]

representing the Wave height spacing

 [sRemoved]

representing the amount of material removed

 [loc]

the location to place the note at

 [x]

X value of the lower left corner of the first line of the text string in text's view coordinates

 [y]

Y value of the lower left corner of the first line of the text string in text's view coordinates

 [z]

Z value of the lower left corner of the first line of the text string in text's view coordinates

 [nMatrix]

MATRIX primitive reference number. The MATRIX primitive referenced must precede this primitive or an error message is displayed and the program terminates.

0 (default) 	World Coordinate system is used

 [hLevel]

Level handle

 [strFont]

Text font name assigned to the note entity

 [adTxtAtt]

An array of floats that describes the attributes of the dimension text. The array is not required if the value of  Str is NULL. For more detail refer to the System Arrays section.

 [iaEntAtt]

An array of integer values that describes the attributes of the entity.  For more detail refer to the System Arrays section.


SURFTEXTADDARROW

 SURFTEXTADDARROW HEntity  SurfaceTexture, hLocation  [loc], double  [x], double  [y], double  [z]

Add an arrow tip and accompanying leader to a surface texture symbol.

Parameters

 SurfaceTexture

Handle to the SurfaceTexture symbol to add an arrowhead to.

 [loc]

the location to place the note at

 [x]

X value of the lower left corner of the first line of the text string in text's view coordinates

 [y]

Y value of the lower left corner of the first line of the text string in text's view coordinates

 [z]

Z value of the lower left corner of the first line of the text string in text's view coordinates


SWITCH

SWITCH

<Compiled CADL Only>
 The SWITCH statement executes a group of commands based on the value of an expression.  The SWITCH statement uses a computed value to transfer program execution to a section of its body (enclosed within the braces).

First, the expression expr following the SWITCH clause is evaluated. The resulting value is compared with the constant expressions (const-expr) after each of the CASE clauses. The program control is then transferred to the statement following the first CASE clause that matches this value.

If no match is found, and there is a DEFAULT clause, the statement-block following DEFAULT is executed. If the DEFAULT clause is omitted and no match is found, the whole body of the SWITCH statement is skipped and the program continues with the first statement after the SWITCH statement.

If two constant expressions separated by a colon (low:high) follow the CASE clause instead of just one constant expression, the value of the expression expr is checked to be within the range of these numbers. The first number must be the lower bound for the range and the second number must be the upper bound for the range.

Each statement block can be optionally terminated by a BREAK clause. When a BREAK clause is met at the end of the statement block, the program skips over the rest of the SWITCH statement body and continues execution with the first statement that follows it.

If a statement block is not terminated by the BREAK clause, execution continues with the statement block belonging to the next CASE or DEFAULT clause.  A SWITCH statement can contain any number of CASE clauses. The body of the SWITCH statement MUST be enclosed by braces.

Example

SWITCH (expr)

    {

    CASE const-expr

statement-block

[BREAK]

    [CASE low:high

statement-block

[BREAK]

    ]

    [DEFAULT

statement-block

]

    }


tan(x)

double tan(x) double  x

The tangent of x.

Parameters

 x

Any value in degrees.

Example

y = tan(42)

 y will be equal to 0.900404


tanh(x)

double tanh(x) double  x

The hyperbolic tangent of x, a value in the range of -1 to 1.

Parameters

 x

Any value in degrees.

Example

y = tanh(42)

y will be equal to 0.624921


UNDO

UNDO

Undoes one action in the Undo/Redo system of CADKEY


UNREGISTERPATH

 UNREGISTERPATH string  pathname

Remove a path from the list of paths managed by CADKEY.  This is for the current session only, and does not remove the path from the Registry.  To remove a path from the registry, see the SETPATH function.

Return Value

The success or failure of the operation, stored in @error

0 	The removal was successful.

-1 	The path was not found.

Parameters

 pathname

The name of the path, as passed to REGISTERPATH


UpdateDetailEnts

UpdateDetailEnts

Updates the attributes of the detail entities in selection list to the currently active settings of the part.


VECTORMULTIPLY

 VECTORMULTIPLY int  nMat, double array var  adVec

Multiplies the given vector by the matrix refered to by the given matrix number

Parameters

 nMat

Matrix to multiply the vector by

0 	Default, Currently Active CPlane matrix

 adVec

Vector to multiply.  This is changed to be the result after the function is completed


WAIT

 WAIT double  dSeconds

Suspends a CADL file execution for a specified number of seconds.

Parameters

 dSeconds

Number of seconds to wait


WHILE

WHILE

<Compiled CADL Only>
 The WHILE statement provides a loop mechanism that evaluates an expression before every iteration of the loop.  If the expression is true, the commands in the loop are executed. The loop terminates when the expression becomes false.

The body of the WHILE loop is executed as long as the expression (expr) after the WHILE statement is true. In each pass, the expression is evaluated. If the expression is false (zero) the statement-block (enclosed by braces) is skipped and the program continues with the first statement following the loop. If the expression is true (non-zero), the statement-block is executed and the whole process is repeated.

If the statement-block consists of only one statement, it does not have to be enclosed in braces.

Example

WHILE (expr)

    {

    ...

statement-block

    ...

}


WINDOW

 WINDOW double  dX1, double  dY1, double  [dZ1], double  dX2, double  dY2, double  [dZ2], integer  [nViewport]

Window in on a specified region in the given viewport

Return Value

@error set as follows

0 	The operation completed successfully

1 	The viewport number is invalid.

2 	The part document does not exist.

Parameters

 dX1

X value of the first corner of the new region

 dY1

Y value of the first corner of the new region

 [dZ1]

Z value of the first corner of the new region default is 0.0

 dX2

X value of the first corner of the new region

 dY2

Y value of the first corner of the new region

 [dZ2]

Z value of the first corner of the new region default is 0.0

 [nViewport]

Viewport number:

-1 	All viewports

0 (default) 	Primary viewport

>0 	Designated viewport


WITNESS

WITNESS

This primitive has been combined with LEADER in the new LEADERWIT primitive.


WorldToCPlane

 WorldToCPlane double  dX, double  dY, double  dZ

Converts a world coordinate to be CPlane relative

Parameters

 dX

X value of the coordinate to be changed, this may also be a double array of three values representing the coordinate to modify, in which case the next two parameters  y and  z are skipped.  Otherwise they are required as the other two elements of the coordinate.

 dY

Y value of the coordinate to be changed

 dZ

Z value of the coordinate to be changed


WRITE

 WRITE string  fname, integer  mode, variable  var1, variable  [var2], variable  [...]

WRITE complements the READ statement by providing a means of writing out variable values to a data file. Except for arrays, each variable name in the statement causes one value to be written to the file. The manner in which arrays are handled is similar to READ in that the number of values output for an array is determined by the array declaration and the number of dimensions specified.
 If the filename is not a full path, it is relative to the CADL program.

 Four file open modes are supported:

Parameters

 fname

Data file specification

 mode

Open mode:

0 	Overwrite file

1 	Append to end of file

2 	Create new file only

3 	Append to existing file only

 var1

Name of first variable

 [var2]

Name of second variable

 [...]

Other variables as needed

Comments

System Variables Set:
@ERROR Error code:
0 - No error
-1 - File already exists (write mode 2) or file not found (write mode 3)
1 - Cannot open file

@NREAD (ivar)  Number of data items writen to the file

Mode 0 	causes existing file data to be overwritten by new data. If it's the first time the file is accessed (within the current CADL session), writing starts at the beginning of the file.  Otherwise, it continues where the last write left off.

Mode 1 	causes data to be appended to existing file data. If the file doesn't exist, a new one is created.

Mode 2 	ensures that a new data file is created for the WRITE.

Mode 3 	appends data similarly to mode 1, but doesn't create the file if it doesn't exist.


XHATCH

 XHATCH integer  pattern, word  adSolidLines, word  adDashedLines, word  adCenterLines, word  adPhantomLines, integer  [nDouble], integer  [nMatrix], vname  [nLevel], integer  [nColor], integer  [nStyle], integer  [nGroup], integer  [nSubGroup], integer  [nPen]

The XHATCH primitive describes the geometry in a CADKEY cross-hatch entity.  When an XHATCH primitive is read from a CADL file, a cross-hatch entity is created in the database.  When a cross-hatch entity is written to a CADL file, a MATRIX primitive is created first (if necessary) for which the XHATCH primitive may reference as its assigned plane.

Parameters

 pattern

Hatch pattern (range of 1-18)

 adSolidLines

Name of one-dimensional data array containing the hatching line data as follows:
arrayname [0] = x1  (first line of the hatch)
[1] = y1
[2] = x2
[3] = y2
..
[(n-1)*4]   = x1  (last line of the hatch)
[(n-1)*4+1] = y1
[(n-1)*4+2] = x2
[(n-1)*4+3] = y2

 adDashedLines

Name of one-dimensional data array containing the hatching line data as follows:
arrayname [0] = x1  (first line of the hatch)
[1] = y1
[2] = x2
[3] = y2
..
[(n-1)*4]   = x1  (last line of the hatch)
[(n-1)*4+1] = y1
[(n-1)*4+2] = x2
[(n-1)*4+3] = y2

 adCenterLines

Name of one-dimensional data array containing the hatching line data as follows:
arrayname [0] = x1  (first line of the hatch)
[1] = y1
[2] = x2
[3] = y2
..
[(n-1)*4]   = x1  (last line of the hatch)
[(n-1)*4+1] = y1
[(n-1)*4+2] = x2
[(n-1)*4+3] = y2

 adPhantomLines

Name of one-dimensional data array containing the hatching line data as follows:
arrayname [0] = x1  (first line of the hatch)
[1] = y1
[2] = x2
[3] = y2
..
[(n-1)*4]   = x1  (last line of the hatch)
[(n-1)*4+1] = y1
[(n-1)*4+2] = x2
[(n-1)*4+3] = y2

 [nDouble]

Does the pattern given represent a double hatch, default is 0, single hatch

 [nMatrix]

Matrix View number.  The MATRIX referenced must precede this primitive, or an error message is displayed and the program in terminated.

0 (default) 	World Coordinate system is used

 [nLevel]

Level number

 [nColor]

Color of the entity

0-63 	Number in the system color palette

 [nStyle]

The line style:

1 	Solid

2 	Dashed

3 	Center Line

4 	Phantom line

0 	Use current system line type

 [nGroup]

Group reference number

1-256 	Group number

0 	No group assignment

 [nSubGroup]

Subgroup reference number

1-256 	Subgroup number

0 	No subgroup assignment

 [nPen]

Pen number

1-8 	Pen number

0 	Use current system pen number

Comments

If you wish to specify a group, you must include both the group and the subgroup number.  If either of these arguments is missing or set to zero(0), both of them will be ignored.


ZOOM

 ZOOM double  dPercent, integer  [nViewport]

Zooms the specified viewport by the given percent.

Return Value

@error set as follows

0 	The operation completed successfully

1 	The viewport number is invalid.

2 	The part document does not exist.

Parameters

 dPercent

Percent to scale window by, 1.0 leaves it the same

 [nViewport]

Viewport number:

-1 	All viewports

0 (default) 	Primary viewport

>0 	Designated viewport


CHAR

A single alpha-numeric character.
Example:
char letter, digit
letter = 'A'
digit = '9'


DOUBLE

Double precision floating point data
Example:
double x, y
x = 1.00
y = 2.12345678998765432


FLOAT

Floating point data
Example:
float x, y
x = 2.0
y = 10.5


HDRAWINST

Handle to a drawing instance
Primaraly used for retrieval from CAKDEY


HENTITY

Handle to an entity
Primaraly used for retrieval from CAKDEY


HLAYOUT

Handle to a layout
Primaraly used for retrieval from CAKDEY


HLEVEL

Handle to a level
Primaraly used for retrieval from CAKDEY


HLOCATION

Handle to a location
Primaraly used for retrieval from CAKDEY


INT

Integer
Example:
int x, y
x = 1
y = 10


LONG

Long integer
Example:
long x, y
x = 39123
y = 5549


SHORT

Short integer
Example:
short x, y
x = 1
y = 5


SLIST

Array of strings of characters
Example:
slist $$xyz[0]
$$xyz[0] = "menu1"


STRING

Array of characters
Example:
string $title
$title = "menu1"


UCHAR

Unsigned character
Example:
uchar c
c = 'a'


UINT

unsigned integer
Example:
uint x
x = 25


ULONG

unsigned long integer
Example:
ulong x
x = 62234


USHORT

unsigned short integer
Example:
ushort x
x = 8