CADKEY Advanced Design Language (CADL) Guide
CADKEY Advanced Design Language (CADL) Guide
log (x).................................................................................................................. 34
log10 (x).............................................................................................................. 34
pow (a, b)............................................................................................................ 35
sin (x).................................................................................................................. 35
sinh (x)................................................................................................................ 35
sizeof (xxx).......................................................................................................... 36
sqrt (x)................................................................................................................. 36
tan (x).................................................................................................................. 36
tanh (x)................................................................................................................ 37
PROGRAM CONTROL STATEMENTS.........................................................................37
The REM statement............................................................................................. 37
The IF statement................................................................................................. 37
Branching and Looping with Labels.....................................................................38
Program Branching.............................................................................................. 39
Exiting a CADL program......................................................................................39
Suspending CADL Execution...............................................................................39
Calling External Programs or System Processes..................................................39
Declaring the Security Code String.....................................................................40
Compiler-Specific Control Statements.................................................................40
Section Two: Commands............................................................................................ 41
Introduction............................................................................................................ 41
Entity Primitives..................................................................................................... 41
Recognition of Entity Primitives...........................................................................41
Entity Control.......................................................................................................... 42
Drawing Entities.................................................................................................. 42
Deleting Entities.................................................................................................. 42
Aligning Ordinate Dimensions.............................................................................42
Entity Selection................................................................................................... 43
Entity Attributes.................................................................................................. 43
Display Control....................................................................................................... 43
Redrawing Viewports........................................................................................... 43
Scaling................................................................................................................. 43
Clearing a Viewport............................................................................................. 44
Selecting Displayed Levels..................................................................................44
Level Descriptors................................................................................................. 44
Viewport Control..................................................................................................... 44
Normalized Device Coordinate System...............................................................44
Viewport Manipulation......................................................................................... 44
Viewport Information Inquiries............................................................................44
View Manipulation.................................................................................................. 45
Defining a New View............................................................................................ 45
Converting CADL Reference Numbers to CADKEY View Numbers.......................45
View Descriptors.................................................................................................. 45
Setting the Display View and the Construction View...........................................45
Retrieving a System View Matrix.........................................................................45
Coordinate System Transfer................................................................................45
User Interaction...................................................................................................... 46
The Prompt Line.................................................................................................. 46
Menus.................................................................................................................. 46
Data Input........................................................................................................... 46
Getting a 3D Coordinate......................................................................................46
Selecting Attributes............................................................................................. 47
Selecting a Plane................................................................................................. 47
Selecting Entities................................................................................................. 47
Checking the Keyboard Buffer.............................................................................47
Page 2
Page 3
List Boxes............................................................................................................ 57
Extracting List Box Information........................................................................57
Modifying List Box Information.........................................................................57
Check Boxes........................................................................................................ 57
Extracting Check Box Information....................................................................57
Modifying Check Box Information.....................................................................57
Combo Boxes....................................................................................................... 57
Extracting Combo Box Information..................................................................57
Modifying Combo Box Information...................................................................57
Titles.................................................................................................................... 58
Deleting Entities.................................................................................................. 58
Errors In Creation And Modification.....................................................................58
Running the Dialog Box.......................................................................................58
Selecting the Focus............................................................................................. 58
Accessing CDE Modules.......................................................................................... 59
Section Three: Reference........................................................................................... 60
ABORT..................................................................................................................... 60
ADDCOLL................................................................................................................ 60
ADDCOP.................................................................................................................. 60
ADDCTYPE.............................................................................................................. 61
ANGDIM.................................................................................................................. 61
ARC......................................................................................................................... 62
ARRAY..................................................................................................................... 64
AUTO...................................................................................................................... 65
BURSTCOLL............................................................................................................. 65
CALL....................................................................................................................... 66
CALL
atan3, y, x, r............................................................................................... 66
CALL
cdlv2sysv, cv, sv........................................................................................67
CALL
dotprod, x1, y1, z1, x2, y2, z2, r................................................................67
CALL
inq_vp_ndc, vp, x1, y1, x2, y2....................................................................68
CALL
memcpy, dst, didx, src, sidx, cnt................................................................68
CALL
strcat, s1, s2............................................................................................... 68
CALL
strcmp, s1, s2, r......................................................................................... 69
CALL
strcmpi, s1, s2, r........................................................................................69
CALL
strcpy, s1, s2.............................................................................................. 69
CALL
strlen, str, len............................................................................................. 70
CALL
strflt, str, flt................................................................................................ 70
CALL
strint, str, int.............................................................................................. 70
CALL
xfvw, vx, vy, vz, wx, wy, wz.......................................................................70
CALL
xfwv, wx, wy, wz, vx, vy, vz........................................................................71
CALL
xfmvw, m, vx, vy, vz, wx, wy, wz...............................................................71
CALL
xfmwv, m, wx, wy, wz, vx, vy, vz...............................................................72
CDECLOSE.............................................................................................................. 72
CDEOPEN................................................................................................................ 72
CHAIN..................................................................................................................... 73
CIRCLE.................................................................................................................... 73
CIRDIM.................................................................................................................... 75
ck_getfilename....................................................................................................... 76
CLEAR..................................................................................................................... 76
CLEARHST............................................................................................................... 76
CLEARSEL............................................................................................................... 77
CLOSE..................................................................................................................... 77
CLS......................................................................................................................... 78
CMOVE.................................................................................................................... 78
CODE...................................................................................................................... 78
Page 4
CONIC..................................................................................................................... 79
CREAD.................................................................................................................... 80
CWRITE................................................................................................................... 81
DBLSCL................................................................................................................... 82
DEFATTR................................................................................................................. 82
DELCOP................................................................................................................... 83
DELCTYPE............................................................................................................... 84
DELENT................................................................................................................... 84
dg_add_box............................................................................................................ 84
dg_add_button........................................................................................................ 85
dg_add_check......................................................................................................... 85
dg_add_combo....................................................................................................... 86
dg_add_list............................................................................................................. 87
dg_add_note........................................................................................................... 87
dg_add_radio.......................................................................................................... 88
dg_add_text_double............................................................................................... 88
dg_add_text_int...................................................................................................... 89
dg_add_text_string................................................................................................. 89
dg_add_title............................................................................................................ 90
dg_child_dialog....................................................................................................... 90
dg_del_combo_list_text.......................................................................................... 91
dg_del_ent.............................................................................................................. 91
dg_del_list_text....................................................................................................... 91
dg_draw_dialog...................................................................................................... 92
dg_erase_dialog..................................................................................................... 92
dg_free_dialog........................................................................................................ 92
dg_get_check.......................................................................................................... 92
dg_get_combo_list_active.......................................................................................93
dg_get_combo_string............................................................................................. 93
dg_get_flags........................................................................................................... 93
dg_get_list.............................................................................................................. 94
dg_get_list_text...................................................................................................... 94
dg_get_note............................................................................................................ 94
dg_get_radio........................................................................................................... 95
dg_get_text_double................................................................................................ 95
dg_get_text_int....................................................................................................... 95
dg_get_text_string.................................................................................................. 96
dg_init_dialog......................................................................................................... 96
dg_inq_dialog_wh................................................................................................... 97
dg_move_focus....................................................................................................... 97
dg_radio_align........................................................................................................ 97
dg_run_dialog......................................................................................................... 98
dg_set_check.......................................................................................................... 98
dgset_combo_list_active......................................................................................... 99
dg_set_combo_list_text........................................................................................... 99
dg_set_combo_string.............................................................................................. 99
dg_set_flags......................................................................................................... 100
dg_set_list............................................................................................................ 100
dg_set_list_text..................................................................................................... 101
dg_set_note.......................................................................................................... 101
dg_set_radio......................................................................................................... 101
dg_set_radio_text................................................................................................. 102
dg_set_text_double............................................................................................... 102
dg_set_text_int..................................................................................................... 102
dg_set_text_string................................................................................................ 103
Page 5
dg_set_title........................................................................................................... 103
DOSUB.................................................................................................................. 103
DRAWENT............................................................................................................. 104
EXEC..................................................................................................................... 105
EXIT...................................................................................................................... 106
FNOTE................................................................................................................... 106
GENDIM................................................................................................................ 108
GETALL................................................................................................................. 111
GETCOLOR............................................................................................................ 111
GETCOP................................................................................................................ 112
GETCUR................................................................................................................ 113
GETENT................................................................................................................ 115
GETENTID............................................................................................................. 116
GETENTM.............................................................................................................. 117
GETENTXY............................................................................................................ 118
GETFLT.................................................................................................................. 120
GETGROUP........................................................................................................... 120
GETINT.................................................................................................................. 121
GETKEY................................................................................................................. 122
GETLTYPE.............................................................................................................. 123
GETLWIDTH.......................................................................................................... 123
GETMENU............................................................................................................. 124
GETNEXT.............................................................................................................. 125
GETPLANE............................................................................................................. 126
GETPOS................................................................................................................ 128
GETSTR................................................................................................................. 129
GETVIEW.............................................................................................................. 130
GOTO.................................................................................................................... 130
GROUP.................................................................................................................. 131
HALF..................................................................................................................... 131
IF.......................................................................................................................... 132
INPUT.................................................................................................................... 132
INQCTYPE............................................................................................................. 133
INQTCODE............................................................................................................. 133
LABEL................................................................................................................... 133
LEADER................................................................................................................. 135
LEVELS................................................................................................................. 136
LINDIM.................................................................................................................. 137
LINE...................................................................................................................... 138
MAKECOLL............................................................................................................ 139
MODE.................................................................................................................... 139
NEXTCOLL............................................................................................................. 140
NFNOTE................................................................................................................ 140
NLABEL................................................................................................................. 141
NLEADER.............................................................................................................. 142
NNOTE.................................................................................................................. 142
NOTE.................................................................................................................... 143
NWITNESS............................................................................................................ 145
ON GOTO.............................................................................................................. 145
ORDALIGN............................................................................................................. 145
ORDDIM................................................................................................................ 146
PALETTE................................................................................................................ 147
PAUSE................................................................................................................... 148
POINT.................................................................................................................... 148
POLYGON.............................................................................................................. 149
Page 6
POLYLINE............................................................................................................... 150
PRANGE................................................................................................................ 152
PRINT.................................................................................................................... 152
PROMPT................................................................................................................ 153
READ.................................................................................................................... 153
READDEV.............................................................................................................. 154
REDRAW............................................................................................................... 155
REM...................................................................................................................... 155
REMCOLL.............................................................................................................. 156
SCALE................................................................................................................... 156
SET....................................................................................................................... 156
SET arrdir, dir.................................................................................................... 157
SET arrstyle, style.............................................................................................. 158
SET cdlpath, path.............................................................................................. 158
SET collect, mode.............................................................................................. 158
SET collsel, mode.............................................................................................. 158
SET color, num.................................................................................................. 158
SET conaxes, mode........................................................................................... 159
SET const, mode................................................................................................ 159
SET coord, mode............................................................................................... 159
SET curtrack, mode........................................................................................... 159
SET cview, num................................................................................................. 159
SET depth, val................................................................................................... 159
SET devin, fname.............................................................................................. 160
SET devout, fname............................................................................................ 160
SET dimfill, mode.............................................................................................. 160
SET dimfont, font.............................................................................................. 160
SET dimht, height.............................................................................................. 160
SET dimslant, angle........................................................................................... 160
SET draword, val............................................................................................... 161
SET dspaxes, mode........................................................................................... 161
SET grid, mode.................................................................................................. 161
SET gridinc, xinc, yinc, [xalign], [yalign]...........................................................161
SET immcom, mode.......................................................................................... 161
SET leader, style............................................................................................... 162
SET level, num.................................................................................................. 162
SET levelmask, mask......................................................................................... 162
SET limit, mode................................................................................................. 162
SET linetype, type............................................................................................. 162
SET linewidth, width.......................................................................................... 163
SET mask [, ent1, ent2, ...]................................................................................163
SET maskcol, mask............................................................................................ 163
SET maskent, mask........................................................................................... 163
SET masklevel, lev............................................................................................ 164
SET maskltype, mask........................................................................................164
SET masklwidth,................................................................................................ 164
SET maskpen, mask.......................................................................................... 164
SET noteang, angle........................................................................................... 164
SET notefill, mode............................................................................................. 165
SET notefont, font............................................................................................. 165
SET noteht, height............................................................................................. 165
SET noteline, factor........................................................................................... 165
SET noteslant, angle......................................................................................... 165
SET noteuline, mode......................................................................................... 165
SET notpath, path.............................................................................................. 166
Page 7
Page 8
Page 9
10
Page 10
11
Introduction
The CADKEY Advanced Design Language (CADL) is a powerful programming language that
operates within the structure of the CADKEY program. The flexibility of this language allows you
to design and store your own functions and entities within CADKEY, as well as access the
CADKEY database.
The purpose of this section is to help you understand the basic capabilities of the CADL
language. This CADL Guide is divided into the following sections:
This section, Introduction to CADL, describes the various formats used throughout this guide.
Section One: Basics describes those elements which comprise a CADL program file along with
any existing restrictions on their use. This includes register variables, CADL data types, variable
declarations, format specifiers, math functions and program control statements..
Section Two: Commands groups all of the commands into their related categories and gives a
brief description of each of them.
Section Three: Reference is an alphabetic listing of every CADL command, excluding compiler
specific commands.
Section Four: CADL Compiler explains the use of the CCOMP utility and lists the commands and
directives that are specific to compiled programs.
The Appendices list CADL error messages, information held in the system arrays, dialog box
errors, dialog box entity attributes, and includes four samples programs.
______________________________________________________________________________
Page 11
12
backslash
\r
carriage return
double quote \n
new line
backspace
\f
form feed
tab
\a..z results in that character
(ivar)
(cvar)
(var)
(farray) identifies name of an array of double precision floating point numbers. It is similar to
'word'.
(iarray) identifies name of an array of integers. It is similar to 'word'.
Page 12
13
_____________________________________________________________________________
Page 13
14
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 <Enter>.
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,
Page 14
15
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
\n newline
\t tab
\f formfeed
\r carriage return
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 (those which are different are marked with a *). 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'
feet*
a"
inches*
a%b
a (integer) modulus b
xxx = b
numeric
variable assignment
$msg="hello"
string variable assignment
$$msg[x] = "world"
slist element assignment
Page 15
16
Logical Operators
a == b
a != b
a>b
a<b
a >= b
a <= b
a && b
a || b
(a) ? x : y
equal comparison
not equal comparison
greater than comparison
less than comparison
greater than or equal to comparison
less than or equal to comparison
AND operation
OR operation
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 BASIC, FORTRAN, C and 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)
=
[]
Page 16
17
Operation Examples
Example 1:
Statement:
x = 4 / 10 * PI + cos(45)
Result: variable x is assigned the value 1.963744
Example 2:
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 @depth which, in this case, equals
zero.
Example 3:
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. The current list is as follows:
@cdldev
@cdlname[]
@cdlpath[]
@cid
Page 17
18
current color
current system status of 2D/3D construction switch
size of currently accessed copious entity
type code of currently accessed copious entity
current viewport
current construction view number
current working directory path
current construction view matrix
current depth setting
last value entered on the prompt line
current dimension text fill mode
current dimension text font number
current system text height for dimensions
array used by some CADL functions to return integer data for the dimension
entity
array used by some CADL functions to return floating point data for the
dimension entity
current system dimension scale
current dimension text slant angle
array used by some CADL functions to return attributes for the entity
CADL/calculator error number
array used by some CADL functions to return floating point data
array used by some CADL functions to return integer data
character code for last key hit
ID number of last entity added to database
number of the last view added to the database
array used by some CADL functions to return data for the leader line
current system level
displayed levels array mask
current line type
current line width
array used by some CADL functions to return miscellaneous data
current system note text angle
current note text fill mode
current note text font number
current system text height for notes
current note text line spacing factor
current note text slant angle
current note text underline mode
directory path of note files
number of data items read with last CADL READ command
number of items currently in @fltdat array
number of items currently in @intdat array
number of palette colors supported by graphics controller
number of items currently in @strdat array
current number of graphic viewports
current system color palette BLUE values, where: @palb[n] = BLUE value
(between 0 and 255) for color palette index n
current system color palette GREEN values, where: @palg[n] = GREEN value
(between 0 and 255) for color palette index n
current system color palette RED values, where: @palr[n] = RED value
(between 0 and 255) for color palette index n
current pen value
name of most recently accessed plot filename
directory path of plot files
name of most recently accessed part filename
the default directory for part files.
Page 18
19
Page 19
20
char
a single 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
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
Page 20
21
slist
array of strings of characters
Example:
slist $$xyz[0]
$$xyz[0] = "menu1"
string
array of characters
Example:
string $title[6]
$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
Page 21
22
Variable Declarations
Data Typing
When you use a variable for the first time and have done no data typing to it, it is assumed to be
a double precision variable. However, if you wish to create a variable of any other type (i.e., int,
char, etc.) you must data type it in the following manner:
data-type var1 [, var2, ... ]
For example:
int x, y, z
This statement declares x, y, and z as integer variables. They will remain typed as integers until
you use the CLEAR command on them or quit CADKEY or CUTTING EDGE. You cannot
change the data type of a variable once it has been typed unless you use the CLEAR command
and then retype it.
To data type arrays, you use the same format as above. The only difference is shown in the
following example:
int pts[0]
This line types the array, pts, as an integer array. If an array is not data typed, it will default to an
array of doubles. The zero enclosed by brackets after the arrayname on the data type line
signifies that arrayname will be later declared as an array. This is not the actual declaration. To
use the array, you still must use the ARRAY declaration. This line merely states that when
arrayname is declared, it will be an array of the data type you specified.
Declaring ARRAYs
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.
Use the following formulas to calculate the maximum size for two to five dimensional arrays:
Two-dimensional arrays:
Three-dimensional arrays:
maximum
Four-dimensional arrays:
maximum
Five-dimensional arrays:
maximum
( i, j ) i / 2 + i * j <= maximum
( i, j, k ) i * j / 2 + i * j * k <=
( i, j, k, l )
i * j * k / 2 + i * j * k * l <=
( i, j, k, l, m )
i * j * k * l / 2 + i * j * k * l * m <=
Format 2:
ARRAY arrayname[n]
..
arrayname[0] = n1
Page 22
23
arrayname[1] = n2
..
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 singledimensional array; two sets represent a two-dimensional array; three sets represent a threedimensional 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.
Array Declaration 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}
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 [0]
ARRAY data [3][2] = {0, 1, 2, 3, 4, 5}
int data [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
Page 23
24
data [2][1] = 5
To define a three-dimensional array of three rows, two columns, and two planes, you can use
either of the following:
int data [0]
ARRAY data
[3][2][2] = {0,
1, 2, 3,\
4, 5, 6, 7,\
8, 9, 10, 11}
int data [0]
ARRAY data [3][2][2]
data [0][0][0] = 0
data [0][0][1] = 1
data [0][1][0] = 2
data [0][1][1] = 3
data [1][0][0] = 4
data [1][0][1] = 5
data [1][1][0]
data [1][1][1]
data [2][0][0]
data [2][0][1]
=6
=7
=8
=9
data [2][1][0] = 10
data [2][1][1] = 11
Declaring SLISTs
The SLIST data type is very similar to an array except that it is onlya single dimensional list of
strings. To declare an SLIST, use thefollowing format:
SLIST $$listname[numstrings][maxlength]
You can specify the number of strings in the list and the maximum size of every string in that list.
If either numstrings or maxlength is set to zero(0), that field is assumed to be of variable size.
Unlike an ARRAY declaration, you cannot initialize an SLIST. You must set every item in the
SLIST separately. For example:
SLIST $$parts[0][0]
$$parts[0] = "nut"
$$parts[1] = "bolt"
$$parts[2] = "screw"
Page 24
25
Format Specifiers
The format-string controls the interpretation of the input fields and is read from left to right.
Characters that fall outside format specifications are expected to match the sequence of
characters in the input stream; the matched characters are scanned but not stored. If a character
in the input stream conflicts with the format-string, the specifier input terminates. The conflicting
character is left in the stream as if it had not been read.
When the first format specification is found, the value of the first input field is converted
according to the format specification and stored in the location specified by the first argument.
The second format specification causes the second input field to be converted and stored in the
second argument. This process continues through the end of the format-string.
An input field is defined as all characters up to the first white-space character (space, tab, or new
line), or up to the first character that cannot be converted according to the format specification,
or until the field width, if specified, is reached, whichever comes first. If there are too many
arguments for the given format specifications, the extra arguments are ignored. An error is
generated if there are not enough arguments for the given format specifications. The formatstring can contain one or more of the following:
White-space characters (blank (' '), tab ('\t'), or new line ('\n')). A white-space character
causes input to read, but not store, all consecutive white-space in the input up to the next non
white-space character. One white-space character in format-string matches any number
(including 0) and combination of white-space characters.
Non white-space characters, except for the percent-sign character (%). A non whitespace character causes input to read, but not store, a matching non white-space character. If the
next character in the input stream does not match, input terminates.
Format specifications, introduced by the percent sign (%). A format specification causes
input to read and convert characters into values of a specified type. The value is assigned to an
argument in the argument list.
Page 25
26
%[*][width]type
Each field of the format specification is a single character or a number signifying a particular
format option.
*
an asterisk following the percent sign suppresses assignment of the next input field,
which is interpreted as a field of the specified type. The field is scanned but not stored.
width
type
is a character which appears after the last optional format field. This determines whether
the input field is interpreted as a character, a string, or a number. The simplest format
specification contains only the percent sign and a type character (for example, %s).
e and f represent floating-point values consisting of an optional sign (+ or -), a series of one or
more decimal digits possibly containing a decimal point, and an optional exponent ("e" or
"E") followed by an optionally signed integer value with a float argument type.
c
represents a character. White-space characters that are ordinarily skipped are read when
c is specified; to read the next non-white space character, use %1s. A character
argument type is used.
To read strings not delimited by space characters, a set of characters in brackets ([]) can be
substituted for the s (string) type character. The corresponding input field is read up to the first
character that does not appear in the bracketed character set. If the first character in the set is a
caret (^), the effect is reversed: the input field is read up to the first character that does appear in
the rest of the character set.
Page 26
27
%[flags][width][*precision]type
Each parameter is described:
Type is a character which appears after the last optional format field. This character tells to the
program whether a character, string or number is being used. This type character may be used
with the percent sign alone at any time (e.g., %f).
Those other fields listed in the format above are optional. A full description of each is described
in their section headings. Each is briefly described here:
Type characters supported are:
d
represents a floating point type with a signed value having the form [-]dddd.dddd, where
dddd is one or more decimal digits. The number of digits before the decimal point
depends on the magnitude of the number, and the number of digits after the decimal
point depends on the requested precision.
represents a floating point type with a signed value having the form [-]d.dddd e [sign]ddd,
where d is a single decimal digit, dddd is one or more decimal digits, ddd is exactly three
decimal digits, and sign is + or -.
represents a floating point type with a signed value printed in "f" or "e" format, whichever
is more compact for the given value and precision (see below). The "e" format is used
only when the exponent of the value is less than -4 or greater than precision. Trailing
zeros are truncated and the decimal point appears only if one or more digits follow it.
represents a string with an output format of characters printed up to the first null
character ('\0') or until precision is reached.
Flags justify the output and printing of signs, blanks, decimal points, octal and hexadecimal
prefixes. More than one flag can appear in a format specification.
Flag characters supported are:
-
left justifies the result within the field width (default is right justify).
prefixes the output value with a + or - sign if the output value is of a signed type (default
is when sign appears only for negative signed values).
(' ')
(blank) prefixes the output value with a blank if the output value is signed and positive;
the "+" flag overrides the blank flag if both appear, and a positive signed value will be
output with a sign (default is no blank).
Page 27
28
used with the o or x format, the "#" flag prefixes any non-zero output value with 0, or 0x
respectively (default is no prefix).
Used with e format, the "#" flag forces the output value to contain a decimal point in all
cases (default is decimal point appears only if digits follow it).
Used with g format, the "#" flag forces the output value to contain a decimal preventing
the truncation of trailing zeros. Ignored when used with c, d, u, or s types (default is decimal
point appears only if digits follow it). Trailing zeros are truncated.
Width describes the minimum number of characters output.
The width (non-negative decimal integer) controls the number of characters printed. If
the number of characters in the output value is less than the specified width, blanks are added
on the left or the right (depending on whether the "-" flag is specified) until the minimum width is
reached. If width is prefixed with a 0, zeros are added until the minimum width is reached (not
useful for left-justified numbers).
The width specification never causes a value to be truncated; if the number of characters
in the output value is greater than the specified width, or width is not given, all characters of the
value are printed (subject to the precision specification).
Precision describes the maximum number of characters printed for all or part of the output field,
or minimum number of digits printed for integer values.
The precision specification is a non-negative decimal integer preceded by a period (.) which
specifies the number of characters to be printed, or the number of decimal places. Unlike the
width specification, the precision can cause truncation of the output value, or rounding in the
case of a floating point value.
The interpretation of the precision value and the default when precision is omitted
depends on the type:
d/u/o
Precision specifies the minimum number of digits to be printed. If the number of digits in
the argument is less than precision, the output value is padded on the left with zeros.
The value is not truncated when the number of digits exceeds precision. If precision is 0
or omitted entirely, or if the period (.) appears without a number following it, the precision
is set to 1.
The precision specifies the number of digits to be printed after the decimal point. The last
printed digit is rounded. Default precision is six; if precision is 0 or the period (.) appears
without a number following it, no decimal point is printed.
If a percent sign (%) precedes a character that has no relation to the form field, the character is
copied out to output. In other words, a percent sign may be printed as a character by typing %%.
Characters are printed until a null character is encountered.
Page 28
29
Math Functions
Following is a list of functions which are offered by the system and may be used in an expression
to replace a constant numeric value.
abs (x)
Returns the absolute value of a number, x.
Argument:
x can be any constant value, an assigned variable, or an expression.
Example:
x = -2
y = abs(x)
(y will be equal to 2)
Error:
none
acos (x)
Returns the arc cosine of x, in the range of 0 to 180 degrees.
Argument:
The value of x must be between -1 and +1.
Example:
y = acos(0.862)
(y will be equal to 30.4581)
Error:
If the value of x is outside the allowed domain, the error message 'acos: DOMAIN error' is
displayed.
asin (x)
Returns the arc sine of x in the range between -90 and +90 degrees.
Argument:
The value of x must be between -1 and +1.
Example:
y = asin(0.65)
(y will be equal to 40.5416)
Error:
If the value of x is outside the allowed domain, the error message 'asin : DOMAIN error' is
displayed.
atan (x)
Returns the arc tangent of x in the range between -90 and +90 degrees.
Page 29
30
Argument:
x may be any constant value or an assigned variable.
Example:
y = atan(17)
(y will be equal to 86.6335)
Error:
none
atan2 (y, x)
Returns the arc tangent of y/x in a range between -180 and +180 degrees.
Arguments:
Any two values, with the exception that they are not both equal to zero.
Example:
y = atan2(2, 3)
(y will be equal to 33.6901)
Error:
If the values of x and y are both 0, the error message 'atan2 : DOMAIN error' is displayed.
ceil (x)
Returns the value of x rounded up to the nearest integer (the
integer ceiling).
Argument:
x can be any value.
Example:
y = 5.84
x = ceil(y)
(x will be equal to 6)
Error:
none
copsize (type)
Returns an integer representing the size of a specified copious entity item. A value of zero is
returned for any undefined constant.
Argument:
type can be any one of the following constants (either upper or lowercase letters may be
used):
char
- character
Page 30
31
- unsigned character
- integer
- unsigned integer
- short integer
- unsigned short
- long integer
- unsigned long
- float
- double
- copious entity type code
Example:
s = copsize (long)
(s will be equal to 4)
Error:
none
cos (x)
Returns the cosine of the angle x in the range between -1 and +1.
Argument:
Any angle value, x, in degrees.
Example:
y = cos(67.3)
(y will be equal to 0.385906)
Error:
None
cosh (x)
Returns the hyperbolic cosine of the angle x which will be greater than or equal to one(1).
Arguments:
Any angle value, x, in degrees.
Example:
y = cosh(67.3)
(y will be equal to 1.7729)
Error:
none
dms (d, m, s)
Given degree, minute, and second values, this function will return a single value in degrees,
using the following formula:
dms = d + (m/60) + (s/3600).
Page 31
32
Arguments:
Any d, m, or s value
Example:
y = dms (23, 2, 55)
(y will be equal to 23.0653)
Error:
none
exp (x)
Returns the natural exponential function, which is the value e raised to the xth power (ex).
Argument:
x can be any value.
Example:
y = exp(3)
(y will be equal to 20.0855)
Error:
When the resultant value overflows, the value is set to the largest possible double precision
value.
floor (x)
Returns the value of x rounded down the nearest integer (the integer floor).
Arguments:
x can be any value.
Example:
y = 5.84
x = floor(y)
(x will be equal to 5)
Error:
none
fmod (x, y)
Returns the modulus, x mod y. The modulus is the floating point remainder of an integer
division.
Arguments:
x and y can be any values.
Example:
x = 55.32
y = fmod (x, 3)
(y will be equal to 1.32)
Page 32
33
Error:
none
hypot (x, y)
Returns the length of the hypotenuse of a right triangle, which is calculated using sqrt(x2 + y2)
Arguments:
The lengths of the two legs of a right triangle, x and y.
Example:
a = 3.5
b = 6.7
h = hypot(a, b)
(h will be equal to 7.5591)
Error:
none
log (x)
Returns the natural logarithm of x.
Argument:
Any number x which is greater than or equal to zero.
Example:
y = log(4.9)
(y will be equal to 1.58924)
Error:
If x is less than zero, the error message 'log : DOMAIN error' is displayed.
log10 (x)
Returns the base 10 logarithm of x.
Argument:
Any number x which is greater than or equal to zero.
Example:
y = log10(3)
(y will be equal to 0.477121)
Error:
If x is less than zero, the error message 'log10 : DOMAIN error' is displayed.
pow (a, b)
Returns the value of a raised to the power of b (ab).
Arguments:
Page 33
34
sin (x)
Returns the sine of the angle x in a range between -1 and +1.
Arguments:
Any angle value x, in degrees.
Example:
y = sin(16)
(y will be equal to 0.275637)
Error:
none
sinh (x)
Returns the hyperbolic sine of the angle x which will be greater than or equal to zero (0).
Arguments:
Any angle value x, in degrees.
Example:
y = sinh(34)
(y will be equal to 0.628857)
Error:
none
sizeof (xxx)
Determines the size of an array (number of elements) or whether a variable has been defined.
Argument:
xxx is the name of a variable or array.
Returns:
An integer representing the size of the item specified,
where:
0 = undefined
1 = defined single variable
>1 = defined array of n elements
Example:
n = sizeof (foobar)
Page 34
35
Error:
none
sqrt (x)
Returns the square root of x.
Argument:
Any number x which is greater than or equal to zero.
Example:
y = sqrt(18.67)
(y will be equal to 4.32088)
Error:
If sqrt( ) is passed a negative value for x, then the error message 'sqrt : DOMAIN error' is
displayed.
tan (x)
Returns the tangent of x.
Arguments:
Any value x, in degrees.
Example:
y = tan(42)
(y will be equal to 0.900404)
Error:
none
tanh (x)
Returns the hyperbolic tangent of x.
Arguments:
Any value x, in degrees.
Example:
y = tanh(42)
(y will be equal to 0.624921)
Error:
none
Page 35
36
The IF statement
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 > 10 )
y=0
PAUSE "The value of y is %d",y
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).
Page 36
37
GOTO label
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:
i=1
:loop
PAUSE "The value of i is %d",i
i=i+1
IF ( i <= 5 )
GOTO loop
In this example, the PAUSE command will be executed five times.
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:
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
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 DOSUB"
files.
DOSUB transfers control over to a specified CADL file. When the end of that file is reached or an
EXIT statement (see below) 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.
Page 37
38
Page 38
39
WHILE
Page 39
40
Entity Primitives
A data primitive specifies the information for an entity in the database. When executed by the
CADL processor, these primitives are converted to entities and vice versa.
An example of a data primitive found in a CADL file is:
LINE 1.5, 3.0, 0.0, 3.5, 2.0, 0.0, 1, 1, 1, 1, 2, 1
Each value represents an assigned parameter (refer to LINE primitive). Those parameters not
specified are defaulted to the values assigned for each specific argument. Variable assignments
may also be used in describing primitives as explained in Register Variables.
If you wish to use a default parameter for an option, you may use either or both of the following
options:
If a parameter to be omitted falls between other parameters, omit the specific parameter in the
description, but not the commas.
If a parameter falls at the end of a primitive description line, use less than the total number of
parameters permitted for a given command.
For example, in the POINT primitive:
POINT 8.5, 3.0, 22., , 7
the color parameter which is supposed to occur between the 22. and 7 parameters, and the
group number, subgroup number, and pen number which normally occur after the 7 parameter,
are automatically set to default values because they are not specified.
Page 40
41
SUPPRESS - only adds them to the database (does not display them)
The following list specifies all the displayable primitives supported in CADL:
ANGDIM (Angular Dimension)
ARC
CIRCLE
CIRDIM (Circular Dimension)
CONIC
FNOTE, NFNOTE (File Note)
GENDIM (Generic Dimension)
LABEL, NLABEL
LEADER,
NLEADER
LINDIM (Linear Dimension)
LINE, VLINE
NOTE, NNOTE
ORDDIM (Ordinate Dimension)
POINT, VPOINT
POLYGON,
VPOLYGON
POLYLINE
SPLINE
WITNESS,
NWITNESS
XHATCH
Some primitives now have two versions, one preceded by an 'N' (the new style), and one without
(the old style). Both versions will create the same entity but the new versions make use of the
system arrays for input of parameters. The old version may not be supported in future versions
of CADL.
Entity Control
Drawing Entities
To draw a particular entity, use the DRAWENT command.In order to draw the entity, it must be at
least partially within the current viewport bounds, be in the current view and be on a displayed
level. To draw all entities at once, use the REDRAW command.
Deleting Entities
To delete entities, use the DELENT command. With this command you can delete the last entity
found by one of the get entity commands (i.e., GETENT, GETNEXT, etc.), delete a specific entity
by its ID number, or else delete all entities currently in the selection list.
Entity Selection
To select an entity by its ID number, use GETENTID.
Page 41
42
Entity Attributes
DEFATTR, 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 well as the order in which they are to appear. Once defined, SETATTR is called to actually
modify an entity's attributes. The attributes you can set are:
color
fill color
group number
level number
line type
line width
pen number
subgroup number
text rotation angle
text aspect ratio
text fill mode
text font
text height
text line spacing factor
text mirror mode
text slant angle
text underline mode
Display Control
Redrawing Viewports
When you change the scale of a particular viewport, or change which levels are to be displayed,
the effects aren't immediately noticeable. Although the changes were made internally, the
viewport(s) aren't automatically updated. To update them, you need to use the REDRAW
command. REDRAW allows you to redraw a specific viewport or all of them at once.
Scaling
The AUTO command will scale the current part to fit totally inside the selected viewport(s). To
zoom-out, by dividing the current part scale factor by two, use the HALF command. To double
the current scale value of a viewport, or effectively zoom-in, use DBLSCL. To zoom-in on a
specific area within the viewport, you can use the WINDOW command. You can also set the
exact scale factor by using the SCALE command.
All these scaling commands allow you to scale either the primary viewport, a specified viewport,
or all the viewports.
Page 42
43
Clearing a Viewport
The CLS command will clear a specified view port, the primary viewport, or all of them. This
clears only the graphics that are displayed; it doesn't affect the entity data in any way.
Level Descriptors
To set or retrieve the descriptor of an existing level, use the sys_put_name and sys_get_name
commands, respectively.
Viewport Control
Normalized Device Coordinate System
The Normalized Device Coordinate System (NDC) is the system used to place and locate
viewports in graphics area. The graphics area in this system is considered to be one unit in both
the vertical and horizontal direction. This means that any horizontal or vertical coordinate will be
between zero (0.0) and one (1.0).
Viewport Manipulation
To add a viewport to the graphics area, use the sys_addvp command. The new viewport to be
added cannot overlap any other existing viewports or else an error will be returned and the
viewport will not be created. The total number of viewports cannot exceed the limit set in the
configuration program.
To delete a viewport, use the sys_delvp command. It is possible to delete all of the viewports
from the graphics area, which could be useful when you are trying to create a custom
configuration of viewports.
To set the graphics area to one of eight standard viewport configurations, use sys_autovp. When
selecting which of the configurations you wish to set to, you can also pick which viewport will be
considered the primary viewport.
To resize or move a viewport, use sys_movevp. This command allows you to select which
viewport is to be changed, and the new positions for each corner of the viewport.
Page 43
44
View Manipulation
Defining a New View
To define a new view, you must use the VIEW primitive (even if you want to use one of the
predefined views). You supply the primitive with the nine numbers that make up the view matrix
and it returns a CADL reference number for that view.
View Descriptors
To set or retrieve the descriptor of an existing view , use the sys_put_name and sys_get_name
commands, respectively.
Page 44
45
User Interaction
The Prompt Line
Most of the commands in this section include a parameter that allows you to modify the prompt
line. However, you can also output a string to the prompt line at any other time. The two
commands, PROMPT and PAUSE,will output a specified string to the prompt line. The only
difference between the two is that PAUSE will output the string and then wait for the user to hit
<Enter> before giving control back to the program. PROMPT prints out the string and then
immediately returns control to the program.
Menus
The GETMENU command allows you to specify a string to be displayed on the prompt line, up to
nine menu options, which menu item, if any, will be considered the default option, and whether or
not to modify the history line when the user makes a selection.
CLEARHST will clear the history line from a certain position to the end of the line. If no position
is specified, the entire history line will be cleared.
Data Input
GETFLT, GETINT, and GETSTR allow the user to input a float, an integer, or a string,
respectively. Each of these input commands allow you to set the string that will be output on the
prompt line, set a default value and specify up to nine menu choices. Control is returned to the
program when the user either types in a value, selects a menu choice, or else hits ESCAPE or
BACKUP.
Getting a 3D Coordinate
GETPOS displays a text string on the first half of the prompt line along with the position menu,
and then waits until a 3D position is indicated using one of the options provided by the position
menu.
GETCUR allows you a little more control than GETPOS. With GETCUR, you can specify a
cursor style from the following list:
arrow
crosshairs
drag box
rubberband box
rubberband line
You can also display a menu in the menu area. Control returns to your program when the user
either selects a menu item or a 3D position.
Selecting Attributes
GETCOLOR displays a text string on the prompt line and a window of color icons. You specify
whether the number of selectable colors is 16 or 256. It then waits for the user to select one or
more colors.
To allow the user to select a line type from a window of line type icons, you need to use
GETLTYPE. To let the user select a line width, use the GETLWIDTH command.
Page 45
46
Selecting a Plane
GETPLANE allows the user to choose a method for plane selection using plane selection menu.
After the user has selected a method and then selected the plane, control is returned to the
program.
Selecting Entities
GETENT displays a text string on the prompt line, activates the graphics cursor, and waits until a
single entity is selected. To allow the user to select more than one entity, you can use the
GETENTM command. GETENTM invokes the general selection mechanism and waits until one
or more entities are selected. If the selection process was successful, you will need to use
GETNEXT to retrieve the data on each entity in the list. If you need to clear this selected list of
entities, use the CLEARSEL command.
Output Commands
WRITE provides a means of writing out variable values to a data file. To open a file, you can
select from the four following modes: overwrite file if it already exists, append to the end of a file,
create only a new file (no overwrite), and append only to an existing file.
PRINT 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 WRITE. The format string can contain any number of field specifiers,
which are used to describe how values should be converted and written to the output device.
Closing a File
The CLOSE command will close either the standard input device (DEVIN), the standard output
device (DEVOUT), or a data file. Data files are normally closed only at CADL termination or
Page 46
47
whenever the EXEC command is processed. This command can be used to close a data file any
other time. DEVOUT should be closed if DEVIN is to be used to read what was written to
DEVOUT.
Page 47
48
line spacing
factor
rotation angle
slant angle
text height
underlining
Levels Displayed
LEVELS changes the levels displayed by adding or removing either a single level or a range of
levels.
System Parameters
System parameters can be set through CADL file execution through use of the SET command.
The parameters that can be set by this command are as follows:
Directory Paths
CADL directory
note files directory
part files directory
pattern files directory
plot files directory
System Masks
color mask
entity mask
level mask
level mask
line type mask
line width mask
pen mask
selection mask
Dimension Parameters
arrowhead direction
arrowhead style
dimension text fill
mode
dimension text font
dimension text height
dimension text slant
angle
leader style
line type
line width
note fill mode
note font
note rotation angle
Page 48
49
mode
construction
plane
coordinate entry
mode
cursor snap
alignment and
increment
cursor snap mode
cursor tracking
database search
and draw order
decimal precision
display of
construction view
axes
display view axes
grid alignment
and increment
grid mode
immediate mode
command switch
line limit mode
standard input
device
standard output
device
system color
system level
system pen
number
system unit mode
verify selection
mode
view number for
specific viewport
String Functions
To concatenate two strings, you need to use the CALL function, CALL STRCAT. This function
takes in two strings, s1 and s2, and concatenates s2 onto the end of s1. For example:
$s1 = "Hello"
$s2 = " world."
CALL STRCAT $s1, $s2
After this is executed, $s1 will contain the following string:
Page 49
50
Copious Entities
Copious entities are non-displayable data entities that are accessible only through CADL. These
entities are stored in the part file when the part file is saved, so that they are available when the
part file is loaded again. There are three groups of commands that manipulate, respectively:
1. The different types or classes of copious entities.
2. The copious entities under each type.
3.The data stored in each copious entity.
Copious Types
A copious type identifies a group of copious entities by name and type number. Every copious
entity created must belong to an existing copious type.
The command for defining a copious type is ADDCTYPE. There can be a maximum of 256
copious types in a part file at one time.
To delete a copious type, use the DELCTYPE command. You can only delete a copious type
when no copious entities exist of that type.
If you know the name of the copious type and you need to know its type number, use
INQTCODE. If you know the type number and need the name, use INQCTYPE.
Page 50
51
Copious Entities
A copious entity can be created in a part file by defining its size and indicating the copious type
to which it will belong.
To add a copious entity, use ADDCOP. The size of the copious entity will depend on the data that
will be stored in the copious entity. The following types of data can be stored in a copious entity:
characters
integers
unsigned shorts
long integers
double precision floats
copious entity type codes
entity or copious ID's
copious entity sizes
Since these data types can have different sizes on different systems, use the COPSIZE ()
function to determine the size of a data type.
The command to select a copious entity that already exists in the part file is GETCOP copious
commands:selecting a copious entity"
DELCOP will delete a copious entity that is no longer needed in a part file.
Copious Data
After a copious entity has been created, data can be stored in it. The command to write
information to a copious entity is CWRITE. A copious entity must be selected with the GETCOP
command before data can be stored in it.
To read data from an existing copious entity, use the CREAD As with CWRITE, a copious entity
must be selected before its data can be read.
Every time a copious entity is selected for reading or writing, a pointer is set to the beginning of
its data. The pointer is moved forward with every command according to the data being read or
written. However, the pointer can be moved separately using the CMOVE command, either
relative to the current pointer position or to an absolute location within the data.
Collectives
Creating A Collective
To create a collective before any of the entities have been created, use the "SET collect, mode"
command. When you set the mode to 1 (on), any entities created afterwards will be put into a
collective. When all the entities have been created that you wish to be in the collective, set the
mode to 0 (off). This causes all following created entities to be created normally. NOTE: The
SET collect, mode command is subject to removal in future CADL versions.
To create a collective after the entities have already been created, use the command,
MAKECOLL. There are two ways to specify which entities are to be in the collective. The first
way is to specify a list of entity ID's in an array. The second way is to specify a range of entity
ID's by supplying MAKECOLL two ID's, the minimum and maximum.
Page 51
52
Groups
Creating a Group
The GROUP primitive sets up a group with a specified number of subgroups. The GROUP
primitive also requires that you include a group name, a string up to eight characters in length,
and the group reference number. This number is used in other primitive calls to place an entity
in a specified group upon creation.
Page 52
53
Page 53
54
Entity Position
Each entity has an anchor point, specified in text coordinates.
You manipulate attributes with dg_get_flags and dg_set_flags. These commands return and set
the attributes for the specified entity, respectively.
You can also specify attributes bits when you create an entity.
Buttons
The dg_add_button command creates a button.
The button has a space before and after the text, which is centered in the button. Specify the
value of nc, so that dialog boxes that translate into foreign languages still line up correctly.
A button has a flag value DG_RET_ON_SEL(0x0001) specified by default. Buttons take up an
extra cell in each direction around them, for the effect.
Extracting Button Information
There is no information to extract. The dialog box manager tells you that a button has been
pressed.
Boxes
A box is an entity that shows group associations. You create a box with the dg_add_box. There
is no information to extract from a box.
Input Fields
There are three types of input fields: STRINGS, DOUBLES, and INTS. The calculator processes
all input for double fields, so the user can type "3 + 4.57 + @depth" into a double field, and the
computed value is placed in the field.
Page 54
55
Notes
A note is a string of text in the dialog box. If you set the flag value to DG_RET_ON_SEL
(0x0001) for a note, it acts like a button, but without the highlighting effect. Use this for
emulating a hypertext or Rich Text Format (RTF) application.
Radio Buttons
Radio buttons allow the user to choose one option from a multiple option selection. The
application specifies the strings for each choice, and which one is currently chosen. The user
changes the selection by clicking on either the box or the associated text. If the text value
passed to dg_add_radio is omitted, you can add the entries, one at a time, using
dg_set_radio_text
Extracting Radio Button Information
Use the dg_get_radio command to extract information from a radio button. This command
returns the currently selected radio button in the set.
Modifying Radio Button Information
You change the active element with the dg_set_radio command. You set or change the text string
for a field with dg_set_radio_text.
To change the number of buttons, delete the entity and add it again.
List Boxes
List boxes provide the mechanism for selecting a string from a potentially large set of strings. If
the text passed to dg_add_list omitted, the strings can be added later using dg_set_list_text.
Extracting List Box Information
You extract list box information with dg_get_list. This command returns the index of the string
chosen by the user.
To retrieve the actual text string of a selection, use the dg_get_list_text command
Modifying List Box Information
To change the selected item, use dg_set_list. To set or change a list item, use dg_set_list_text. If
list item you select is greater than the number of items in the list, the list expands to the new
amount.
To delete an item from the list, use dg_del_list_text.
Page 55
56
Check Boxes
A check box provides a simple toggle. To add a check box use the dg_add_check command.
Extracting Check Box Information
You extract information from a check box with dg_get_check. This command returns the status
of the specified check box.
Modifying Check Box Information
To change the state of a check box, use dg_set_check.
Combo Boxes
A combo box is a list box with an attached input field. The user selects an item from the list box
or enters a string into the input field. If the Must Exist flag is true, the user must select from the
list. If the input field is used, the typed string will force itself to match one of the list items. If the
text is omitted, use dg_set_combo_list_text to specify the text strings later. To add a combo box
use the dg_add_combo command.
Extracting Combo Box Information
You extract information from a combo box with dg_get_combo_string or
dg_get_combo_list_active. The dg_get_combo_string command returns a string value of the
specified combo box in the @STRDAT system array while dg_get_combo_list_active returns the
list index of the active element of the specified combo box.
Modifying Combo Box Information
To set or change a list item in a combo box, use dg_set_combo_list_text. If the item's number is
greater than the current total number of items, the list expands to the new amount.
To delete an item from the combo list, use dg_del_combo_list_text
To change the input string in a combo box, use dg_set_combo_string and to change the active
list element and the input string in a combo box, use dg_set_combo_list_active.
Titles
Any entity can have a title. You can add a title to any entity after you create it. The r and c
values for this command are relative to the entity not absolute. To add a title use the dg_add_title
command.
Deleting Entities
To remove an entity from a dialog box, use dg_del_ent. After you deletean entity, you can reuse
its index number for a new entity.
Page 56
57
@ERROR is cleared after any successful call, so examine it after every dialog box manager call.
char* (string)
char** (slist for argument only, not for return type)
unsigned int (uint)
unsigned short (ushort)
unsigned long (ulong)
double (double)
For example, if a CDE module has the following definition for a function:
typedef int BOOLEAN;
int my_func1 (double x, double y, double z, BOOLEAN flag);
Page 57
58
Page 58
59
ADDCOLL
Add an entity to a collective or combine collectives.
Format:
ADDCOLL id1, id2
Input Parameters:
id1 (ulong)
ID of an entity in the collective being added to.
id2 (ulong)
ID of the entity to add to the collective. If the entity belongs to another collective,
the two collectives will merge.
Output Parameters:
none
System Variables Set:
@ERROR(ivar) Error Code:
0 = No error
-23 = Entity cannot be made into a collective
ADDCOP
ADDCOP creates a copious entity of a given size. The size of the entity is determined by using
the special calculator function copsize(). Initially, all values in the entity (whether characters,
doubles, integers, etc.) are zero. Once created, values can be written to or read from the entity
using the CWRITE and CREAD commands. There are no restrictions as to the order of the
values; however, values should be read in the same order that they were written, otherwise the
results are unpredictable.
Format:
ADDCOP tcode,size
Input Parameters:
tcode (ival)
Entity type code
size (ival)
Size of entity
Output Parameters:
none
System Variables Set:
@ERROR (ivar)
Error Code:
0 = No error
1 = Type does not exist
Page 59
60
2 = Invalid size
@CID (ivar)
ID assigned to entity
@CTCODE (ivar)
Entity type code
@CSIZE (ivar) Entity size
ADDCTYPE
ADDCTYPE creates a new copious entity type (classification) identified by a specified name (a
character string). Up to 256 types may be defined in any given part file. When a type is created,
a "type code" is assigned and returned. The code is needed later for use with CADL commands
that access copious entities. The purpose of using codes is one of convenience - it's simply
easier to deal with numbers than with strings. Once a code is assigned, it remains so until the
copious entity type is deleted. However, the number of copious entity types and the order in
which they are added affects the assigned code values. This means that it is very unlikely two
parts will have the same code assignments. Consequently, the codes MUST be reestablished at
each invocation of CADL. Use INQTCODE to determine the type code of an existing copious
entity type.
Format:
ADDCTYPE name, tcode
Input Parameter:
name (string) Name of copious entity type to add. Up to 19 characters can be specified.
Output Parameter:
tcode (ivar)
Variable in which to store returned type code. If the type being added already
exists, the existing type code is returned.
System Variables Set:
@ERROR (ivar)
Error Code:
0 = No error
1 = Type already exists
2 = Too many types
ANGDIM
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 VIEW primitive is
created first. In addition to a VIEW 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 refln are optional.
ANGDIM requires two reference lines. The system calculates the angle between the two
reference lines defined in the refln array. If a special value/string is desired in place of the
numeric value of the angle then the string should replace the parameter 'str'.
Format:
ANGDIM
Page 60
61
Input Parameters:
x (double)
X value of the lower left corner of the dimension text in the view coordinates
y (double)
Y value of the lower left corner of the dimension text in the view coordinates
z (double)
Z value of the lower left corner of the dimension text in the view coordinates
str (string)
displayed.
refln(farray)
Array of floats that defines the coordinates of the reference lines. Each ANGDIM
requires two reference lines. For more detail refer to the System Arrays section.
dimval(integer) A flag that defines angle type:
1 = Acute angle (< 180)
0 = Obtuse angle (> 180)
txtinfo(iarray) An array of integer values that describes the information for the dimension text.
The array is not required if the value of 'str' is NULL. For more detail refer to the System Arrays
section.
diminfo1(iarray) An array of integer values that is used for the dimension. For more detail refer to
the System Arrays section.
diminfo2(farray)An array of floats that is used for the dimension. For more detail refer to the
System Arrays section.
txtatt(farray)
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.
entatt(iarray)
An array of integer values that describes the attributes of the entity. For more
detail refer to the System Arrays section.
Output Parameters:
none
System Variables Set:
none
ARC
The ARC primitive describes a circular arc defined in a specifiedplane. 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 VIEW primitive is created first
(if necessary) which the ARC primitive may reference as its definition plane.
Format:
ARC xc, yc, zc, rad, ang1, ang2, [vnum], [col], [lev], [ltype], [grpnum], [subgrp], [pen], [lwdt]
Input Parameters:
xc (double)
X value of arc's center in arc's view coordinates
Page 61
yc (double)
zc (double)
62
rad (double)
Radius value of the arc in the current system units
rad must be >= 0.0005 and <= 10,000
ang1 (double) Starting angle of arc segment
ang1 must be >= 0 and <= 360 degrees
ang2 (double) Ending angle of arc segment
ang2 must be >= 0 and <= 360 degrees
vnum (integer) VIEW primitive reference number. The VIEW primitive referenced must precede
this primitive or an error message is displayed and the program terminates.
0 = Use current system view in effect
col (integer)
Color
0-15 = Number in the system color palette
lev (integer)
Level number
1-255 = System level number
0 = Use current level number
ltype (integer) Line type:
1 = Solid
2 = Dashed
3 = Center Line
4 = Phantom Line
0 = Use current system line type
grpnum (integer)
Group reference number
1-127 = Group number assigned
0 = No group assignment
subgrp (integer)
Subgroup reference number
1-256 = Subgroup number assigned
0 = No subgroup assignment
Note : 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.
pen (integer)
Pen number
1-8 = Pen number
0 = Use current system pen number in effect
lwdt (integer) Line width
1-15 = Odd line width
0 = Use current system line width
Output Parameters:
none
System Variables Set:
none
Page 62
63
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:
Format 2:
ARRAY arrayname[n]
..
arrayname[0] = n1
arrayname[1] = n2
..
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 singledimensional array; two sets represent a two-dimensional array; three sets represent a threedimensional 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
Page 63
64
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
AUTO
AUTO automatically scales the current part to fit in the viewport. This performs the same function
as using the system's Immediate Mode command, except that an automatic redraw is not
performed.
Format:
AUTO [vpnum]
Input Parameter:
vpnum (ival)
Viewport number:
-1 = All viewports
0 or default = Primary viewport
positive number = Designated viewport
Output Parameters:
none
System Variables Set:
none
BURSTCOLL
Remove all entities from collective. Note that you will destroy any information stored on this
collective. Only use this on collectives that you created, or else you will risk corrupting your part.
Format:
BURSTCOLL id
Input Parameter:
id (unsigned long)
Page 64
65
none
CALL
CALL provides a mechanism for invoking an internal CADKEY function. A collection of functions
is provided that helps reduce the size and complexity of CADL files by performing commonly
used operations.
Format:
CALL func, arg1, ...
Input Parameters:
func (word)
Function name (see following pages)
Additional parameters are function-dependent.
Output Parameters:
Function-dependent
System Variables Set:
@ERROR (ivar)
Error Code:
0 = No error
1 = Error accessing an argument
2 = Called function error
CALL Functions
Here is a list of functions accessible through the CALL statement. Except for strings, all input and
output arguments are floating point values, unless otherwise noted. An actual string (e.g., "This is
a string") can be used as an argument if it is passed to the called function, but not returned. For
example, the contents of a string variable can now be directly compared to a string:
call strcmp, $file, "myfile.dat", retval
CALL atan3, y, x, r
Calculate the arc tangent of y/x . This function works correctly in all four quadrants.
Input Parameters:
y - y value
x - x value
Output Parameter:
r - arc tangent of y/x in the range of 0.0 to 2p.
Error:
None
Page 65
66
Calculate the cross product of two vectors, (x1, y1, z1) and (x2, y2, z2).
Input Parameters:
x1 - x value of first vector
y1 - y value of first vector
z1 - z value of first vector
x2 - x value of second vector
y2 - y value of second vector
z2 - z value of second vector
Output Parameters:
rx - x result
ry - y result
rz - z result
Error:
None
Page 66
67
Inquire about the normalized device coordinates (NDC) of a specific viewport based on the entire
screen. (Refer to the SYS_INQVPDEF command)
Input Parameter:
vp - viewport number
Output Parameters:
x1 - x value of lower left corner of viewport
y1 - y value of lower left corner of viewport
x2 - x value of upper right corner of viewport
y2 - y value of upper right corner of viewport
Error:
1 - unknown viewport number
Page 67
68
Page 68
69
Determine the length of the string, str. This length does not include the null terminator.
Input Parameter:
str - string
Output Parameter:
len - length of string
Error:
1 - unable to access a string variable
Page 69
70
Error:
None
Page 70
71
wz - world z value
Output Parameters:
vx - view x value
vy - view y value
vz - view z value
Error:
1 - unable to access view matrix
CDECLOSE
CDECLOSE allows you to close an already opened CADKEY Dynamic Extension (CDE) module
from within the current CADL program. This function is useful when too many CDE modules are
opened.
The file specification is processed as follows: 1) if the specification does not include a path, the
directory of the CDE file is defined in CDEPATH; 2) if a full path is included, the specified
directory is used; 3) if the specification includes a relative path, the specified directory is relative
to the directory of the initial CDE path; except 4) if the relative path begins with either "." or "..".
In this case, the specified directory is relative to the same directory as the CADL program
containing the CDECLOSE command. The ".cde" file extension is always forced. When
specifying a path, the use of forward slashes (/) or backslashes (\) is dependent upon the
operating system under which CADKEY is running. In the event of an error (namely, the specified
file does not exist), execution from within the current CADL file is terminated.
For more information about CDE refer to the CADKEY Software Development Kit (SDK) Manual.
Format:
CDECLOSE fname
Input Parameter:
fname (string) File name of CDE module
Example:
CDECLOSE "primtv"
CDEOPEN
CDEOPEN allows you to open a CDE module from within the current CADL file. After opening a
CDE module, all the functions defined in the definition (.DEF) file can be called as commands in
the CADL program. The CDE module remains in memory, until the CADKEY program is
terminated or the CDE module is closed.
The file specification is processed as follows: 1) if the specification does not include a path, the
directory of the CDE file is defined in CDEPATH; 2) if a full path is included, the specified
directory is used; 3) if the specification includes a relative path, the specified directory is relative
to the directory of the initial CDE path; except 4) if the relative path begins with either "." or "..".
In this case, the specified directory is relative to the same directory as the CADL program
containing the CDEOPEN command. The ".cde" file extension is always forced. When specifying
a path, the use of forward slashes (/) or backslashes (\) is dependent upon the operating system
under which CADKEY is running. In the event of an error (namely, the specified file does not
exist), execution from within the current CADL file is terminated.
Page 71
72
Format:
CDEOPEN fname
Input Parameter:
fname (string) File name of CDE module
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.
Format:
CHAIN fname
File Specification:
The file specification is processed as follows:
1)
2)
If the specification includes a relative path, the specified directory is relative to the
directory of the initial CADL program; except if the relative path begins with either "." or "..". In
this case, the specified directory is relative to the same directory as the CADL program
containing the CHAIN command.
3)
If no path is specified, the directory is assumed to be the same as the initial CADL
program (i.e., the program run from the CADKEY menus).
The ".cdl" file extension is always forced.
When specifying a path, the use of forward slashes (/) or backslashes (\) is dependent upon the
operating system under which CADKEY is running.
In the event of an error (namely, the specified file does not exist), execution from within the
current CADL file is terminated.
CIRCLE
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.
Format:
CIRCLE xc, yc, zc, rad, [vnum], [col], [lev], [ltype], [grpnum], [subgrp], [pen], [lwdt]
Input Parameters:
xc (double)
X value of the circle's center in circle's view coordinates
yc (double)
zc (double)
rad (double)
Page 72
73
CIRDIM
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 VIEW
primitive is created first. In addition to a VIEW primitive, some arrays are created for the CIRDIM
definition.
Page 73
74
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 parameter 'str'.
Format:
CIRDIM
Input Parameters:
x (double)
X value of the lower left corner of the dimension text in the view coordinates
y (double)
Y value of the lower left corner of the dimension text in the view coordinates
z (double)
Z value of the lower left corner of the dimension text in the view coordinates
str (string)
displayed.
refarc(farray) Array of floats that defines the coordinates of the reference arc. Each CIRDIM
requires only one reference arc. For more detail refer to the System Arrays section.
refpnt(farray) Array of floats that defines the coordinates of the reference points. If the CIRDIM
has form 3 (Bent radial circular dimension) , then each CIRDIM requires three reference points.
For more detail refer to the System Arrays section.
form(integer) Dimension form:
1 = Radial circular dimension
2 = Diametral circular dimension
3 = Bent radial circular dimension
txtinfo(iarray) An array of integer values that describes the information for the dimension text.
The array is not required if the value of 'str' is omitted. For more detail refer to the System Arrays
section.
diminfo1(iarray)
An array of integer values that is used for the dimension. For more detail
refer to the System Arrays section.
diminfo2(farray)
An array of floats that is used for the dimension. For more detail refer to
the System Arrays section.
txtatt(farray)
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.
entatt(iarray)
An array of integer values that describes the attributes of the entity. For more
detail refer to the System Arrays section.
Output Parameters:
none
System Variables Set:
None
Page 74
75
ck_getfilename
Retrieves the explicit path and file name of the currently active part in CADKEY. Note that the
name of this function is case-sensitive.
Format:
ck_getfilename $name
Output Parameter:
name (string) A string variable long enough to hold the full path and file name. (recommend
string $name[260])
CLEAR
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.
However, under some conditions, too many unused variables may be defined, preventing new
variables from being created. The CLEAR statement can be used to remove (undefine) selected
variables, or all variables if no arguments are given. Used at the beginning of a CADL file,
CLEAR insures that all variable space is available for use.
Format:
CLEAR [var1,...]
Input Parameter:
var1 (var)
Name of the first variable
CLEARHST
CLEARHST clears the CADKEY history line from the specified position to the end of the line.
Format:
CLEARHST [depth]
Input Parameter:
depth (ival)
The depth from which to clear the history line (1-n). If this is omitted, the entire
history line is cleared.
CLEARSEL
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
Page 75
76
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.
Format:
CLEARSEL [mode]
Input Parameter:
mode (ival)
Clear mode:
0 = Use selection list
1 = All entities in database
CLOSE
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.
Format:
CLOSE fname
Input Parameter:
fname (word) DEVIN, DEVOUT, or filename
System Variables Set:
@ERROR (ivar)
Error Code:
0 = No error
1 = File not open
CLS
CLS clears one or more viewports. Only the display is erased, without a change in entity data.
Format:
CLS [vpnum]
Input Parameter:
vpnum (ival)
Viewport number:
-1 = All viewports
0 or default = Primary viewport
positive number = Designated viewport
System Variables Set:
@ERROR
0 = No error
1 = Invalid viewport
Page 76
77
CMOVE
CMOVE moves the data "pointer" associated with the currently selected copious entity (see
CREAD for an explanation of the "pointer" mechanism).
Format:
CMOVE mode, offset
Input Parameters:
mode (word)
Offset mode:
abs = Absolute
rel = Relative
offset (ival)
Offset to move internal pointer. For absolute moves, offset ranges from 0 to the
size of the entity minus one. For relative moves, a positive offset means a forward move,
negative offset means a backward move.
Output Parameters:
none
System Variables Set:
@ERROR (ivar)
Error Code:
0 = No error ("pointer" moved)
1 = No currently selected entity
2 = Offset out of range
CODE
CODE declares the proper security code string to allow file execution to occur. If this statement
exists in a CADL file, the security code string in the SECURE.DAT file must match the string in
the CODE statement, or execution will not occur. Also, the code statement is invalid unless it is
the first executable statement in the CADL file (LOCAL and REM statements are not executable).
This command is not required unless the default SECURE.DAT file supplied with the CADKEY
installation diskettes has been changed. Refer to the Appendices section of the User Reference
Guide for information on how to change the SECURE.DAT file to permit only properly coded
CADL files to execute.
Format:
CODE "codestr"
CONIC
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 VIEW primitive, that VIEW primitive
must precede the CONIC primitive.
Page 77
78
Format:
CONIC a, b, c, d, e, f, xs, ys, xe, ye, depth, [vnum], [col], [lev], [ltype], [grpnum], [subgrp], [pen],
[lwdt]
Input Parameters:
a (double)
Value of the coefficient A in the quadratic representation of the conic
b (double)
c (double)
d (double)
e (double)
f (double)
xs (double)
X coordinate for the start point of the conic in its view of definition
ys (double)
Y coordinate for the start point of the conic in its view of definition
xe (double)
X coordinate for the end point of the conic in its view of definition
ye (double)
Y coordinate for the end point of the conic in its view of definition
Page 78
79
Note : 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.
pen (integer)
Pen number
1-8 = Pen number
0 = Use current system pen number
lwdt (integer) Line width
1-15 = Odd line width
0 = Use current system line width
CREAD
CREAD reads one or more values (items) sequentially from the currently selected copious entity
and stores it in a specified variable.
When a copious entity is selected, a "pointer" is set to the beginning of its data. Each time
CREAD (or CWRITE) is used, the item(s) are read (or written) and the "pointer" is moved
according to the size of the item and the number of items processed. This continues until the
"pointer" reaches the end of the entity's data. At this point no more items can be processed
unless the "pointer" is moved back via the CMOVE command.
If CREAD is used to read more than one value, the variable must be an array large enough to
contain the number of items requested.
When specifying array variables, the inclusion of the indices is optional. For example, if an array
is defined as xyz[3][3], specifying xyz[2][1] allows only that element to be set ("cnt" can only be
1). If xyz[1] is specified, elements xyz[1][0], xyz[1][1], and xyz[1][2] may be set in that order
("cnt" may be 1, 2, or 3). If only xyz is specified, the entire array (9 elements) may be set,
depending on the count.
Format:
CREAD item, var, [cnt]
Input Parameters:
item (word)
Item to read:
CHAR
INT
USHORT
LONG
DOUBLE
TCODE
ID
SIZE
cnt (ival)
defaults to 1.
Character
Integer
Unsigned short
Long
Double
Copious entity type code
Entity ID (copious or primitive)
Copious entity size
Output Parameter:
var (var)
Page 79
80
CWRITE
CWRITE writes one or more values (items) sequentially from a specified variable to the currently
selected copious entity.
When a copious entity is selected, a "pointer" is set to the beginning of its data. Each time
CWRITE is used, the item(s) are written and the "pointer" is moved according to the size of the
item and the number of items processed.
If more than one value is to be written, the variable must be an array large enough to contain the
number of items requested.
When specifying array variables, the inclusion of the indices is optional. For example, if an array
is defined as xyz[3][3], specifying xyz[2][1] allows only that element to be written ("cnt" can only
be 1). If xyz[1] is specified, elements xyz[1][0], xyz[1][1], and xyz[1][2] may be written in that
order ("cnt" may be 1, 2, or 3). If only xyz is specified, the entire array (9 elements) may be
written, depending on the count.
Format:
CWRITE item, var, [cnt]
Input Parameters:
item (word)
Item to write:
CHAR
INT
USHORT
LONG
DOUBLE
TCODE
ID
SIZE
Character
Integer
Unsigned short
Long
Double
Copious entity type code
Entity ID (copious or primitive)
Copious entity size
var (var)
cnt (ival)
defaults to 1.
Page 80
81
DBLSCL
DBLSCL performs a "zoom-in" on a part by doubling the current part scale factor. This performs
the same function as using the system's Immediate Mode command, except that an automatic
redraw is not performed.
Format:
DBLSCL [vpnum]
Input Parameter:
vpnum (ival)
Viewport number:
-1 = All viewports
0 or default = Primary viewport
positive number = Designated viewport
DEFATTR
DEFATTR 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 well as the order in which they are to appear. Once defined, SETATTR is called to
actually modify an entity's attributes.
Format:
DEFATTR keywd1, [keywd2,...]
Input Parameters:
keywd1 = First attribute keyword
keywd2 = Second attribute keyword
The following attribute keywords are supported:
COLOR
- Color
FCOLOR
- Fill color
GRPNUM
- Group number
LEVEL - Level number
LINETYPE
- Line type
LINEWIDTH
- Line width
PEN
- Pen number
SUBGRP
- Subgroup number
TEXTANG
- Text rotation angle
TEXTASP
- Text aspect ratio
TEXTFILL
- Text fill mode
TEXTFONT
- Text font
TEXTHT
- Text height
TEXTLINE
- Text line spacing factor
TEXTMIR
- Text mirror mode
Page 81
82
Note that if both the group number and the subgroup number are being set, GRPNUM must
come before SUBGRP in the argument list otherwise the results are unpredictable.
DELCOP
Deletes a collective entity type.
Format:
DELCOP [id], [tcode1], ...
Input Parameters:
id (ival)
ID of entity to delete. If omitted, the currently selected entity is deleted (i.e., the
one most recently selected by GETCOP). If set to -1, all entities matching the specified type
codes are deleted. Note that non-existent type codes are effectively ignored in that they will not
match any entities.
tcode1 (ival)
First entity type code for selection. As many as 25 codes may be specified. If no
codes are specified, all entity types are selected.
System Variables Set:
@ERROR (ivar)
Error Code:
0 = No error
1 = Matching ID not found or no currently
selected entity
DELCTYPE
DELCTYPE deletes a copious entity type. An entity type can be deleted only if no entities of that
type exist.
Format:
DELCTYPE name
Input Parameter:
name (string) Name of entity type to delete
System Variables Set:
@ERROR (ivar)
Error Code:
0 = No error
1 = Type does not exist
2 = Entities of specified type exist
Page 82
83
DELENT
DELENT deletes the last entity previously found by one of the get entity commands (i.e.,
GETENT, GETNEXT, etc.). Alternatively, an ID can be supplied to delete a specific entity. If the
ID is set to -1, all entities in the selection list are deleted.
Format:
DELENT [id]
Input Parameter:
id (ival) ID of entity to delete
-1 = All entities in selection list
dg_add_box
The dg_add_box command adds a box entity to the specified dialog box. To visually group
related entities, you draw a box around them. The box is anchored by its upper-left corner and its
width and height are specified by the number of columns and rows, respectively.
Format:
dg_add_box dhandle, index, row, col, numrows, numcols, $text, fcol,
bcol, flags
Input Parameters:
dhandle (long)
index (integer)
row (double)
col (double)
numrows (double)
numcols (double)
$text (string)
fcol (integer)
bcol (integer)
flags (integer)
dg_add_button
The dg_add_button command adds a button entity to the specified dialog box. A button provides
an option to allow you to make further choices or conclude the dialog. You can specify the size of
the button (in number of characters) or you can specify that it automatically size itself to fit the
text by giving the button a size of zero characters. In either case, add a space before and after
the text to be located in the center of the button. The button default flag is
DG_RET_ON_SEL(0x0001).
Format:
dg_add_button dhandle, index, row, col, numcols, $text, fcol, bcol, flags
Page 83
Input Parameters:
dhandle (long)
index (integer)
row (double)
col (double)
numcols (integer)
$text (string)
fcol (integer)
bcol (integer)
flags (integer)
84
dg_add_check
The dg_add_check command adds a check box entity to the specified dialog box. A check box is
used to provide an option that can be toggled. Clicking on a blank check box puts a cross in the
box, indicating that it is selected. A selected check box is toggled back to an "un-checked" state
by clicking on it again.
Format:
dg_add_check dhandle, index, row, col, checked, $text, fcol, bcol, flags
Input Parameters:
dhandle (long)
Dialog box handle (refer to dg_init_dialog)
index (integer)
Unique index for this entity
row (double)
Row position
col (double)
Column position
checked (integer)
Is box initially checked?
0 = Box will not be checked
1 = Box will be checked
$text (string)
Text string
fcol (integer)
Foreground color
bcol (integer)
Background color
flags (integer)
Entity attributes (see Appendix V)
System Variables Set:
@ERROR
Error message:
0 = No error
See Appendix IV for a list of errors.
dg_add_combo
The dg_add_combo command adds a combo box entity to the specified dialog box. A combo box
is a combination of a list of options like a list box and a text input field. An option can either be
selected from the list in the combo box or it can be typed directly into the input field. Normally,
only the input field is displayed in the dialog box. However, the list of options can be displayed
Page 84
85
by clicking on the down-arrow icon. If the 'me' (Must Exist) argument is specified as TRUE, the
selection must either be made from the list in combo box, or the string typed in the input field will
be forced to match one of the strings in the list. The text for the list of options does not have to
be provided at the time the combo box is added to the dialog box. Instead, an slist of null strings
("") can be provided for the text. In this case, the list can be added later by using the
dg_set_combo_list_text command.
Format:
dg_add_combo dhandle, index, row, col, numrows, colwidth, mustexist, $value, num, $$text,
fcol, bcol, flags
Input Parameters:
dhandle (long)
Dialog box handle (refer to dg_init_dialog)
index (integer)
Unique index for this entity
row (double)
Row position
col (double)
Column position
numrows (integer)
Number of rows in the list box
colwidth (integer)
Column width of the list box
mustexist (integer)
Must exist flag:
0 = Choice doesn't have to exist in list
1 = Choice must exist in list
$value (string)
Initial value for input field
num (integer)
Total number of strings in list box
$$text (slist)
Array of string choices
fcol (integer)
Foreground color
bcol (integer)
Background color
flags (integer)
Entity attributes (see Appendix V)
System Variables Set:
@ERROR
Error message:
0 = No error
See Appendix IV for a list of errors.
dg_add_list
The dg_add_list command adds a list box entity to the specified dialog box. A list box allows the
selection of one string from a large set of strings. The available strings are displayed in a box
that can be paged up and down using icons. The text for the list of strings does not have to be
provided at the time the list box is added to the dialog box. Instead, an slist of null strings ("") can
be provided for the text. In this case, the list can be added later by using the dg_set_list_text
command.
Format:
dg_add_list dhandle, index, row, col, numrows, colwidth, num, $$text, fcol, bcol, flags
Input Parameters:
dhandle (long)
index (integer)
row (double)
col (double)
numrows (integer)
colwidth (integer)
num (integer)
$$text (slist)
Page 85
86
Foreground color
Background color
Entity attributes (see Appendix V)
dg_add_note
The dg_add_note command adds a note entity to the specified dialog box. A note entity is a
string of text in the dialog box.
Format:
dg_add_note dhandle, index, row, col, $text, fcol, bcol, flags
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) Unique index for this entity
row (double)
Row position
col (double)
Column position
$text (string)
The note to be displayed
fcol (integer)
Foreground color
bcol (integer) Background color
flags (integer) Entity attributes (see Appendix V)
System Variables Set:
@ERROR
Error message:
0 = No error
See Appendix IV for a list of errors.
dg_add_radio
The dg_add_radio command adds a radio button entity to the specified dialog box. Radio buttons
give a group of options from which only one option can be selected at a time. If the user picks a
new option from the set, the previously selected option is de-selected. The text for the options
does not have to be provided at the time the radio buttons are added to the dialog box. Instead,
an slist of null strings can be provided for the text. In this case, the list can be added later by
using the dg_set_radio_text command.
Format:
dg_add_radio dhandle, index, row, col, picked, num, $$text, fcol, bcol,
flags
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) Unique index for this entity
row (double)
Row position
col (double)
Column position
picked (integer) Radio button which is initially picked
num (integer) Total number of radio buttons
$$text (slist)
Array of text choices
Page 86
87
Foreground color
Background color
Entity attributes (see Appendix V)
dg_add_text_double
The dg_add_text_double command adds an input field for double precision values to the
specified dialog box. The field is initialized to the value provided in the arguments, which is
displayed using the specified format string. The value typed by the user is processed by the
calculator, and the computed value is placed in the field.
Format:
dg_add_text_double dhandle, index, row, col, maxwidth, $fmt, value, fcol, bcol, flags
Input Parameters:
dhandle (long)
index (integer)
row (double)
col (double)
maxwidth (integer)
$fmt(string)
value (double)
fcol (integer)
bcol (integer)
flags (integer)
dg_add_text_int
The dg_add_text_int command adds an input field for integer values to the specified dialog box.
The field is initialized to the value provided in the arguments, which is displayed using the
specified format string. The value typed by the user is processed by the calculator, and the
computed value is placed in the field.
Format:
dg_add_text_int dhandle, index, row, col, maxwidth, $fmt, value, fcol, bcol, flags
Input Parameters:
dhandle (long)
index (integer)
row (double)
col (double)
maxwidth (integer)
$fmt (string)
Page 87
88
dg_add_text_string
The dg_add_text_string command adds an input field for character string values to the specified
dialog box. The field is initialized to the value provided in the arguments, which is displayed
using the specified format string.
Format:
dg_add_text_string dhandle, index, row, col, maxwidth, $fmt, $value, fcol, bcol, flags
Input Parameters:
dhandle (long)
index (integer)
row (double)
col (double)
maxwidth (integer)
$fmt (string)
$value (string)
fcol (integer)
bcol (integer)
flags (integer)
dg_add_title
After an entity has been created, it can be given a title using dg_add_title. The positioning for the
title is specified relative to the entity's anchor point.
Format:
dg_add_title dhandle, index, row, col, $text, fcol, bcol
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) Entity to which to add title
row (double)
Row delta (relative to entity's anchor point)
col (double)
Column delta (relative to entity's anchor point)
$text (string)
Text of the title
fcol (integer)
Foreground color
bcol (integer) Background color
System Variables Set:
@ERROR
Error message:
0 = No error
Page 88
89
dg_child_dialog
A dialog box can be defined as a child of an existing dialog box using dg_child_dialog. The
following are the only restrictions that apply to a child dialog box:
1) It can be displayed only if its parent dialog box is currently being displayed.
2) It must be displayed completely inside the parent dialog box.
3) The anchor point for the dialog box must be specified relative to the top left corner of
the parent dialog box.
When a child dialog box is running, only the entities in the child dialog box are active, although
the entities in the parent dialog box may still be visible.
Format:
dg_child_dialog dhandle, rows, cols, srow, scol, items, $title, fcol, bcol, flags
Input Parameters:
dhandle (long) The parent dialog box handle (refer to dg_init_dialog)
rows (integer) Rows in the dialog box
cols (integer) Columns in the dialog box
srow (double) Row offset location in parent
scol (double) Column offset location in parent
items (integer) Total number of entities in the dialog box
$title (string)
Text to place in the title bar
fcol (integer)
Foreground color for the dialog box
bcol (integer) Background color for the dialog box
flags (integer) Global flags for the dialog box
System Variables Set:
@ERROR
Handle for the child dialog box , usually referred to as 'dhandle' in the rest of the
calls
dg_del_combo_list_text
The dg_del_combo_list_text command removes a string from the list of options in a combo box.
The string to be removed is specified by its number in the list.
Format:
dg_del_combo_list_text dhandle, index, num
Input Parameters:
dhandle (long) The handle of the dialog box to delete(refer to dg_init_dialog)
index (integer) Combo box's index
num (integer) Number of string to remove
System Variables Set:
@ERROR
Error message:
0 = No error
See Appendix IV for a list of errors.
Page 89
90
dg_del_ent
The dg_del_ent command removes an entity from a dialog box. Once an entity is removed, its
index number can be reused for a new entity in that dialog box.
Format:
dg_del_ent dhandle, index
Input Parameters:
dhandle (long) Dialog box to delete entity from (refer to dg_init_dialog)
index (integer) Index of entity to delete
dg_del_list_text
The dg_del_list_text command removes a string from the list of options in a list box. The string
to be removed is specified by its number in the list.
Format:
dg_del_list_text dhandle, index, num
Input Parameters:
dhandle (long) Dialog box to delete from (refer to dg_init_dialog)
index (integer) Index of list box
num (integer) Number of string to delete
System Variables Set:
@ERROR
Error message:
0 = No error
See Appendix IV for a list of errors.
dg_draw_dialog
The dg_draw_dialog command draws the dialog box on the screen. If there are multiple
viewports on the screen, the dialog box overlaps the viewports. The dg_draw_dialog command is
also used to "un-freeze" a dialog box which is currently displayed on the screen.
Format:
dg_draw_dialog dhandle
Input Parameter:
dhandle (long) Dialog box to draw (refer to dg_init_dialog)
System Variables Set:
@ERROR
Error message:
0 = No error
See Appendix IV for a list of errors.
dg_erase_dialog
After the dialog box interaction is finished, it can be erased using the dg_erase_dialog command.
This command does not affect the contents of the dialog box, but merely removes the dialog box
from the screen, restoring the graphics viewports.
Format:
dg_erase_dialog dhandle
Page 90
91
Input Parameter:
dhandle (long) Dialog box to erase (refer to dg_init_dialog)
dg_free_dialog
If a dialog box is not needed anymore, it can be deleted using dg_free_dialog. This will free all
memory associated with the dialog box and release the dialog box handle.
Note: Once freed, you cannot use dg_get_int (or other access functions) to retrieve information
from the dialog.
Format:
dg_free_dialog dhandle
Input Parameter:
dhandle (long) Dialog box to destroy (refer to dg_init_dialog)
dg_get_check
The dg_get_check command returns the status of the specified check box. If the box is checked,
a one (1) is returned. Otherwise the command returns a zero (0).
Format:
dg_get_check dhandle, index
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) Index of the check box
System Variables Set:
@ERROR
Returned status of check box:
0 = Check box is not checked
1 = Check box is checked
dg_get_combo_list_active
The dg_get_combo_list_active command returns the list indexnumber of the currently selected
string in the combo box.
Format:
dg_get_combo_list_active dhandle, index
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) Combo box index
System Variables Set:
Page 91
92
dg_get_combo_string
The dg_get_combo_string command returns the specified character string value of the text input
portion of a combo box.
Format:
dg_get_combo_string dhandle, index
Input Parameters:
dhandle (long) Dialog box that holds the combo box (refer to
dg_init_dialog)
index (integer) Combo box index
System Variables Set:
@STRDAT
The character string displayed in the combo box
dg_get_flags
The dg_get_flags command returns the flags associated with an entity. The entity is specified by
its index number in the dialog box. See Appendix V for the list of flags that can be attached to an
entity.
Format:
dg_get_flags dhandle, index
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) Queried entity's index
System Variables Set:
@ERROR
Flags associated with the specified entity. See
Appendix V.
dg_get_list
The dg_get_list command returns the list index number of the currently selected string in the list
box.
Format:
dg_get_list dhandle, index
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) List box index
System Variables Set:
Page 92
93
dg_get_list_text
The dg_get_list_text command returns the specified character string from a list box. The string is
specified by its index number in the list.
Format:
dg_get_list_text dhandle, index, num
Input Parameters:
dhandle (long) Dialog box that holds the table (refer to dg_init_dialog)
index (integer) List box index
num (integer) String's list index to retrieve
System Variables Set:
@STRDAT
Character string of specified index in the list box
dg_get_note
The dg_get_note command returns the text of a specified note entity.
Format:
dg_get_note dhandle, index
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) Index of the note entity
System Variables Set:
@STRDAT
The character string stored in the note
dg_get_radio
The dg_get_radio command returns the index number of the currently selected button from the
specified radio button set.
Format:
dg_get_radio dhandle, index
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) Radio button set's index
System Variables Set:
@ERROR
The number of the radio button selected
dg_get_text_double
The dg_get_text_double command returns the double precision value in an input field. The input
field is specified by its index number in the dialog box.
Page 93
94
Format:
dg_get_text_double dhandle, index
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) Input field's index
System Variables Set:
@ERROR
The double precision value stored in the input
field
dg_get_text_int
The dg_get_text_int command returns the integer value in an input field. The input field is
specified by its index number in the dialog box.
Format:
dg_get_text_int dhandle, index
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) Input field's index
dg_get_text_string
The dg_get_text_string command returns the character string in an input field. The input field is
specified by its index number in the dialog box.
Format:
dg_get_text_string dhandle, index
Input Parameters:
dhandle (long) Dialog box that holds the input field (refer to dg_init_dialog)
index (integer) Input field's index
System Variables Set:
@STRDAT
The character string stored in the input field
dg_init_dialog
The dg_init_dialog command creates a dialog box and allocates memory for the dialog box. The
total number of entities in the dialog box has to be specified at the time the dialog box is created.
In addition, the width and height of the dialog box (in columns and rows, respectively), its title,
and the placement option are also required. The command returns the handle of this dialog box
Page 94
95
that has to be used for all subsequent action related to this dialog box. If for some reason the
dialog box cannot be created, the command returns a 0.
Format:
dg_init_dialog rows, cols, items, $title, fcol, bcol, plac_opt, flags
Input Parameters:
rows (integer) Rows in the dialog box
cols (integer) Columns in the dialog box
items (integer) Total number of entities in the dialog box
$title (string)
Text to place in the title bar
fcol (integer)
Foreground color for the dialog box
bcol (integer) Background color for the dialog box
plac_opt (integer)
Placement option:
0 = Top left
1 = Top right
2 = Bottom left
3 = Bottom right
4 = Center of graphics area
flags (integer) Global flags for the dialog box
System Variables Set:
@ERROR
Handle for the dialog box , usually referred to as 'dhandle' in the rest of the calls
dg_inq_dialog_wh
The dg_inq_dialog_wh command can be used to inquire the width and height of a dialog box.
When a dialog box handle is supplied, the command returns the width and height of the dialog
box.
Format:
dg_inq_dialog_wh dhandle, width, height
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
Output Parameters:
width (integer) Width of the dialog box
height (integer) Height of the dialog box
dg_move_focus
In a dialog box, some entity always has the focus. Any keyboard input by the user is directed to
that entity. The user can change the focus by using mouse picks, tab keys, etc. The
dg_move_focus command performs the same task without user interaction. If the user makes a
selection that should be followed by interaction with another option in the dialog box, use the
dg_move_focus command to change the focus to this next option. This command can be used
before the dialog box is run to start the dialog box with a particular entity as the focus.
Format:
dg_move_focus dhandle, index
Page 95
96
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) Index of entity to move focus to
System Variables Set:
@ERROR
Error message:
0 = No error
See Appendix IV for a list of errors.
dg_radio_align
The dg_radio_align command realigns the radio buttons to conform to the coordinates supplied
in the 'relrow[]' and 'relcol[]' arrays. The first radio button in the set is repositioned at coordinates
(relrow[0], relcol[0]), the second button at (relrow[1], relcol[1]), etc.
Format:
dg_radio_align dhandle, index, relrow, relcol
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) Unique index for this entity
relrow[] (double)
Array of new row position(s) relative to the original radio button anchor
point within the dialog box (row parameter in dg_add_radio command).
relcol[] (double) Array of new column position(s) relative to the original radio button anchor point
within the dialog box (col parameter in dg_add_radio command)
System Variables Set:
@ERROR
Error message:
0 = No error
See Appendix IV for a list of errors.
dg_run_dialog
After a dialog box has been displayed on the screen, it is activated for user interaction with the
dg_run_dialog command. This command returns the index of the button pressed by the user. If
another entity had the DG_RET_ON_SEL flag associated with it, its selection will also terminate
the running of the dialog box, returning the index of that entity. Note that a dialog box is not
erased from the screen after it has stopped running.
Format:
dg_run_dialog dhandle
Input Parameter:
dhandle (long) The handle of dialog box to run (refer to
dg_init_dialog)
System Variables Set:
@ERROR
The index of the button pressed
Page 96
97
dg_set_check
The dg_set_check command is used to change the state of a check box. If the checked flag is 1,
the box is checked. If it is 0, the box is not checked.
Format:
dg_set_check dhandle, index, checked
Input Parameters:
dhandle (long) Handle for dialog box containing the check box
(refer to dg_init_dialog)
index (integer) Check box's index
checked (integer)
Flag to set the check box:
0 = Check box is not checked
1 = Check box is checked
System Variables Set:
@ERROR
Error message:
0 = No error
See Appendix IV for a list of errors.
dgset_combo_list_active
The dg_set_combo_list_active command is used to change the current selection in the combo
box to the specified string in the list. Also, this changes the string in the input field of the combo
box to that string.
Format:
dg_set_combo_list_active dhandle, index, active
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) Combo list's index
active (integer) Number of list element to set active
System Variables Set:
@ERROR
Error message:
0 = No error
See Appendix IV for a list of errors.
dg_set_combo_list_text
The dg_set_combo_list_text command changes the text of a particular string in the combo box
list. The string to be changed is specified by its list index number. If the index number specified
is greater than the total number of strings in the list, the list expands to that size. This provides
the mechanism to grow a combo box list from within the program.
Format:
dg_set_combo_list_text dhandle, index, num, $text
Input Parameters:
Page 97
98
dg_set_combo_string
The dg_set_combo_string command sets the string displayed in the input field of the combo box.
This string does not have to be from the combo box list.
Format:
dg_set_combo_string dhandle, index, $val
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) Combo box index
$val (string)
Combo box character string
System Variables Set:
@ERROR
Error message:
0 = No error
See Appendix IV for a list of errors.
dg_set_flags
The dg_set_flags command allows the flags associated with an entity to be changed after it has
been added to a dialog box. If the "on" argument is supplied as TRUE, the flags provided with
the dg_set_flags command will be attached to the specified entity. If the "on" argument is
supplied as FALSE, the flags will be removed from the entity.
Format:
dg_set_flags dhandle, index, flags, on
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) Entity index
flags (integer) Entity flags
on (integer)
Flag switch:
0 = Turn flags off
1 = Turn flags on
System Variables Set:
@ERROR
Error message:
0 = No error
See Appendix IV for a list of errors.
Page 98
99
dg_set_list
The dg_set_list command is used to change the current selection in a list box. The new string is
specified by its list index number.
Format:
dg_set_list dhandle, index, active
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) List box index
active (integer) List element to set active
System Variables Set:
@ERROR
Error message:
0 = No error
See Appendix IV for a list of errors.
dg_set_list_text
The dg_set_list_text command changes the text of a particular string in the list box. The string to
be changed is specified by its list index number. If the index number specified is greater than the
total number of strings in the list, the list expands to that size. This provides the mechanism to
grow a list box from within the program.
Format:
dg_set_list_text dhandle, index, num, $text
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) List box index
num (integer) Number of list element being modified
$text (string)
New character string for the list element
System Variables Set:
@ERROR
Error message:
0 = No error
See Appendix IV for a list of errors.
dg_set_note
The dg_set_note command sets the string displayed in the note entity field of the dialog box.
Format:
dg_set_note dhandle, index, $text
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) Note entity index
$text (string)
Text string
Page 99
100
dg_set_radio
The dg_set_radio command is used to change the current selection in a set of radio buttons. The
button to pick is specified by its number in the set.
Format:
dg_set_radio dhandle, index, picked
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) Index of radio button set
picked (integer) Radio button's number to pick
System Variables Set:
@ERROR
Error message:
0 = No error
See Appendix IV for a list of errors.
dg_set_radio_text
The dg_set_radio_text command is used to change the text associated with a radio button in a
set of radio buttons. The radio button to modify is specified by its number in the set.
Format:
dg_set_radio_text dhandle, index, button, $text
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) Index of radio button set
button (integer) Button number to modify text
$text (string)
New text for radio button
System Variables Set:
@ERROR
Error message:
0 = No error
See Appendix IV for a list of errors.
dg_set_text_double
The dg_set_text_double command is used to set the double precision value of an input field.
Format:
dg_set_text_double dhandle, index, val
Page 100
101
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) Input field index
val (double)
New value
System Variables Set:
@ERROR
Error message:
0 = No error
See Appendix IV for a list of errors.
dg_set_text_int
The dg_set_text_int command is used to set the integer value of an input field.
Format:
dg_set_text_int dhandle, index, val
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) Input field index
val (integer)
New value
System Variables Set:
@ERROR
Error message:
0 = No error
See Appendix IV for a list of errors.
dg_set_text_string
The dg_set_text_string command is used to set the character string of an input field.
Format:
dg_set_text_string dhandle, index, $val
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
index (integer) Input field index
$val (string)
New value
System Variables Set:
@ERROR
Error message:
0 = No error
See Appendix IV for a list of errors.
dg_set_title
The dg_set_title command sets the string displayed as a title of the dialog box.
Format:
dg_set_title dhandle, $text
Page 101
102
Input Parameters:
dhandle (long) Dialog box handle (refer to dg_init_dialog)
$text (string)
Title string
System Variables Set:
@ERROR
Error message:
0 = No error
See Appendix IV for a list of errors.
DOSUB
DOSUB 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. Up to
four nested levels of DOSUBs are permitted.
Format:
DOSUB fname
Input Parameter:
fname (word) CADL file you wish to transfer control to
File Specification:
The file specification is processed as follows:
1)
2)
If the specification includes a relative path, the specified directory is relative to the
directory of the initial CADL program; except if the relative path begins with either "." or "..". In
this case, the specified directory is relative to the same directory as the CADL program
containing the DOSUB command.
3)
If no path is specified, the directory is assumed to be the same as the initial CADL
program (i.e., the program run from the CADKEY menus).
The ".cdl" file extension is always forced.
When specifying a path, the use of forward slashes (/) or backslashes (\) is dependent upon the
operating system under which CADKEY is running.
In the event of an error (namely, the specified file does not exist), execution from within the
current CADL file is terminated.
DRAWENT
DRAWENT draws the specified entity if displayable.
To be displayable, the entity must be:
1) at least partially within the current viewport bounds;
2) in the current view (if applicable); and
Page 102
103
3) on a displayed level.
Format:
DRAWENT [id], [erase], [vpnum]
Input Parameters:
id (ival)
Entity ID. If omitted, the currently selected entity is drawn.
If set to -1, then all entities in the selection list
are drawn.
erase (ival)
Erase flag:
1 = Entity drawn using the background color, effectively erasing it from the screen.
0 or omitted = Entity is drawn normally.
vpnum (ival)
Viewport number:
-1 = All viewports
0 or default = Primary viewport
positive number = Only designated viewport
Output Parameters:
none
System Variables Set:
@ERROR (ivar)
Error Code:
0 = No error
1 = ID not found or no entity currently selected
2 = Invalid viewport
EXEC
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). When the EXEC command is entered without parameters, the system shell is run
(C> prompt) in the Protected Mode. To leave, type "Exit."
As a precaution, be sure to save the currently displayed part before executing any of these
commands.
Format:
EXEC [mode, "command(s)"]
Input Parameters:
mode Screen save mode:
1 = (Suppress mode) for commands where no text is sent to the screen or displayed.
Page 103
104
2 = (Normal mode) for commands where text is generated and displayed. The system's
graphics display is saved, then restored after the command or program process is complete. If a
separate mono screen is present and has been previously specified in the configuration program,
the text output is displayed on this screen, eliminating the need to save and restore the system's
graphic image.
3 = (Protected mode) for commands where graphics output is generated. This mode
stores the system's graphics image and restores it afterwards, regardless of whether or not a
separate mono screen is present.
command
The command desired at the prompt, including any parameters, redirection, or
pipes (refer to your system's manual for details on these commands). Each command should be
separated by new lines. Batch commands FOR and IF are allowed.
Notes/Restrictions:
1)
The system frees a specific amount of memory to run system commands, or processes.
The amount that it frees is user-definable, as specified when the configuration program
is run. This memory must be available when control returns to the system, hence no
memory-resident programs should be loaded by the EXEC command. Memory-resident
programs should be run before the system is entered.
2)
The EXEC command does not save the part currently displayed first, so if a program
being run (using EXEC) crashes, the system also crashes and all part data created since
the last save is lost. It is therefore suggested that the current part be filed before a CADL
program with the EXEC command is executed.
3)
Be sure to configure for a one- or two-screen system correctly (using the configuration
program) before using the CADL EXEC command.
4)
Note that when you list/load a cadl file, that file is the default for the next
time you do files, cadl. However, if you do binexec or exec, that filename is
NOT the default for the next time.
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.
Format:
EXIT
FNOTE
The FNOTE primitive is similar to the NOTE primitive except that the characters are strings
defined in a file instead of included as part of the statement.
When an FNOTE primitive is read from a CADL file, a disk note entity is created in the database.
Format:
FNOTE x, y, fname, [rot], [ht], [asp], [vnum], [col], [lev], [font], [grpnum], [subgrp], [pen], [slnt],
[fill], [lnsp], [uln], [mir]
Page 104
105
Input Parameters:
x (double)
X value of the lower left corner of the first line of text string in text's view
coordinates
y (double)
coordinates
Y value of the lower left corner of the first line of text string in text's view
fname (word) Text file specification. Processing of the file specification is as follows:
1) If the specification does not include a path, the directory used is the default directory for CADL
programs (set with the CONFIG program).
2)
If a full path is included, the full path is used.
3)
If the specification includes a relative path, the specified directory is relative to the
current working directory.
rot (double)
The rotation angle of the text about the XY coordinate (in degrees)
rot must be >= 0 and <= 360 degrees
ht (double)
asp (double)
vnum (integer) VIEW primitive reference number. The VIEW primitive referenced must precede
this primitive or an error message is displayed and the program terminates.
0 = Use current view number
col (integer)
The color assigned to the note entity
0-15 = Number in the system color palette
lev (integer)
Level number assigned to the note entity
1-255 = System level number
0 = Current system level number
font (integer) Text font number assigned to the note entity:
-16 through -1 = Font number (new style)
0 = Current system font number
1 = Bold
2 = Slant
3 = Bold box filled
4 = Bold slant filled
5 = Bold box
6 = Bold slant
grpnum (integer)
Group reference number
1-128 = Group number
0 = No group assignment
subgrp (integer)
Subgroup reference number
1-256 = Subgroup number
0 = No subgroup assignment
Note : 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.
pen (integer)
Pen number
1-8 = Pen number
0 = Use current system pen number
Page 105
106
slnt (integer)
Text slant angle (new font style only)
slnt must be >= -31 and <= 31 degrees
fill (integer)
Fill mode (new font style only)
0 = Non-filled text
1 = Filled text
lnsp (double) Line spacing factor. This factor times the character height equals the distance
between lines of text.
uln (integer)
Underline mode
0 = Non-underlined text
1 = Underlined text
mir (integer)
Mirror mode
0 = Non-mirrored text
1 = Mirrored text
GENDIM
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 VIEW primitive is created first (if necessary) which the GENDIM primitive may reference as its
definition plane.
When using a GENDIM primitive to create, all or some of the following entities may be used:
1) nine lines
2) two arcs
3) two arrowhead points
4) text note
Once created, parts of the dimension entity may be selected by choosing one of its components,
such as a line or one of the two arcs, etc. A true CADKEY dimension moves all of the
components. The only time an entity is treated as a whole component is when the generic
selection menu is used.
Those functions that support the generic dimension entity in CADKEY include:
EDIT-BX MOV (window must surround complete dimension)
DETAIL-CHANGE:TXT ATT, TXT POS, ARROWS-STYLE #1 - #4
FILES: PART, PLOT, and CADL
DISPLAY (all)
CONTROL: PRINT, PLOT, VERIFY-ATTRIB, ATTRIB-COLOR, PEN #
DELETE: SINGLE, WINDOW, ALL DSP
X-FORM: all (dimension value is not scaled)
Page 106
107
numarcs (integer)
numarrows (integer)
arrayname (word)
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
y1
x2
y2
Arc data:
xc
yc
rad
ang1
ang2
For example, if the dimension contains one line and one arrowhead, the array is set as follows:
Page 107
108
arrayname
[0] = x1
(line data)
[1] = y1
[2] = x2
[3] = y2
[4] = x (arrowhead data)
[5] = y
[6] = ang
arrowtype (integer)
Arrowhead type:
0 = Style 1
1 = Style 2
2 = Style 3
3 = Style 4
x (double)
coordinates
X value of the lower left corner of the first line of the text string in the view
y (double)
coordinates
Y value of the lower left corner of the first line of the text string in the view
str (string)
A character string.
rot (double)
The rotation angle of the text about the XY coordinate (in degrees)
rot must be >= 0 and <= 360 degrees
ht (double)
asp (double)
vnum (integer) VIEW primitive reference number. The VIEW primitive referenced must precede
this primitive or an error message is displayed and the program is terminated.
col (integer)
The color assigned to the note entity
0-15 = Number in the system color palette
lev (integer)
Level number assigned to the note entity
1-255 = System level number
0 = Current system level number
fnt (integer)
Text font number assigned to the note entity:
-16 through -1 = Font number (new style)
0 = Current system font number
1 = Bold
2 = Slant
3 = Bold box filled
4 = Bold slant filled
5 = Bold box
6 = Bold slant
grpnum (integer)
Group reference number
1-127 = Group number
0 = No group assignment
subgrp (integer) Subgroup reference number
1-256 = Subgroup number
0 = No subgroup assignment
Page 108
109
Note : 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.
pen (integer)
Pen number
1-8 = Pen number
0 = Use current system pen number
slnt (integer)
Text slant angle (new font style only)
slnt must be >= -31 and <= 31 degrees
fill (integer)
Fill mode (new font style only)
0 = Non-filled text
1 = Filled text
GETALL
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.
Format:
GETALL nument, [vpnum]
Input Parameter:
vpnum (ival)
Viewport number:
0 or default = All entities in primary viewport
positive number = Entities within that viewport
Output Parameter:
nument (ivar) Number of entities selected
System Variables Set:
@ERROR (ivar)
Error Code:
0 = No error
1 = Selection error
2 = Bad viewport
GETCOLOR
GETCOLOR displays a text string on the CADKEY prompt line along with a window of color
icons and waits for one or more colors to be selected.
Format:
GETCOLOR prompt, retcol, [ncol], [mflg]
Page 109
110
Input Parameters:
prompt (string) Text string to be displayed on the prompt line. The total length of the text string
must not exceed 68 characters or truncation will occur.
ncol (ival)
Number of selectable colors:
0 = 256 colors
1 = 16 colors
mflg (ival)
Multiple selection flag, which is used only for 16 color selection:
0 = Return single color
1 = Return multiple colors as mask
Output Parameter:
retcol (ivar)
Variable to store the single color selected (0-15 for 16 color selection; 0-255 for
256 color selection) or the color mask where:
bit 0 = color 0
bit 1 = color 1
..
bit 15 = color 15
System Variables Set:
@ERROR (ivar)
Error Code:
0
= No error
1
= Exception error(CR, F10, ESC)
@KEY (ivar)
-3
-2
-1
0
GETCOP
GETCOP selects a copious entity so that its information can be accessed via CWRITE and
CREAD commands. There are two ways in which to select entities; by type code or by ID. The
first method involves specifying what type codes to select. The first entity is selected by using
GETCOP with the ID set to -1. Each subsequent use of GETCOP, with the ID set to -2, selects
the next matching entity. This continues until an error code is returned by GETCOP indicating
that no matching entities remain. Note that non-existent type codes are effectively ignored in that
they will not match any entities. In the second method, the entity ID is given. In this case, only
one entity, the one with the matching ID, is selected.
Format:
GETCOP id, [tcode1], ...
Input Parameters:
id (ival)
Entity ID:
-1 = Selection of the first entity by type code
-2 = Selection of the next entity by type code positive number = Entity ID
tcode1 (ival)
First entity type code for selection. As many as 25 codes may be specified. If no
codes are specified all entity types are selected.
Page 110
111
Entity ID
@CTCODE (ivar)
GETCUR
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.
Format:
GETCUR prompt, style, dspflg, [x], [y], [z], [plc], [rot], [menu1],, [menu9], [depth], [dflt]
Input Parameters:
prompt (string) Text string to be displayed on the prompt line. Optionally, the default menu item
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 menu item, must not exceed 68 characters or
truncation will occur.
style (ival)
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)
Usage of the parameters x, y, z, plc, and rot (described below) is dependent on the
cursor style as shown in the following table. The abbreviations are: WC - world coordinates; VC view coordinates; CC - cursor plane coordinates. A dash indicates that a parameter is not
required.
style
x
x/y/z usage
1
2
3
WC
anchor point
4
VC
anchor point
5
CC
anchor point
6
VC
plc
WC
WC
VC
CC
CC
VC
Yes
Yes
rot
Page 111
VC
VC
Yes
112
Yes
dspflg (ival)
If set to 0, no cross is drawn at the cursor pick position. If set to 1, the position
cross is drawn.
x (fval)
y (fval)
Rotation angle of drag box rot must be >= 0 and <= 360 degrees
menu1 (string) Text string to be displayed in the first CADKEY menu position. The total length of
the text string must not exceed eight characters or truncation will occur.
menu9 (string) Text string to be displayed in the ninth CADKEY menu position. The total length
of the text string must not exceed eight characters or truncation will occur.
depth (ivar)
History depth. A positive value (1 - n) causes the selected menu item to be
displayed in the CADKEY history line at the specified position. If set to 0 or not supplied (the
default), the history line is not modified.
dflt (ivar)
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 dflt is
passed as 3 and <Enter> is typed, @key will contain the value 3 -- the same as if F3 is typed. If
"dflt" 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.
System Variables Set:
@ERROR (ivar)
Error Code:
0 = No error
1 = Exception error (CR, F10, or ESC)
@KEY (ivar)
-3
-2
-1
0
1
2
.
.
9
Page 112
113
@XVIEW (fvar)
@YVIEW (fvar)
@ZVIEW (fvar)
@XCVIEW (fvar)
@YCVIEW (fvar)
@ZCVIEW (fvar)
@XWORLD (fvar)
@YWORLD (fvar)
@ZWORLD (fvar)
GETENT
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.
Format:
GETENT prompt, enttype, [id], [fdat], [idat], [sdat], [mdat]
Input Parameter:
prompt (string) Text string to be displayed on the prompt line. The total length of the text string
must not exceed 68 characters or truncation will occur.
Output Parameters:
enttype (ivar) Returned type code for entity selected. See Entity Information in the Appendices
for a list of entity codes.
id (ivar)
Entity ID
fdat (fvar)
Variable name of array in which to return 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 @FLTDAT.
idat (ivar)
Variable name of array in which to return 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.
sdat (cvar)
Variable name of array in which to return 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.
Page 113
114
mdat (fvar)
Variable name of array in which to return entity's miscellaneous data. The
sizeof() function can be used to determine the number of elements in the array. If this parameter
is omitted, the data will be put into @MSCDAT.
System Variables Set:
@ERROR (ivar)
Error Code:
0 = No error
1 = Selection error
2 = Entity too large for system arrays
3 = Can't create variable array
@KEY (ivar)
Code for last key hit:
3 = ESCAPE
2 = F10
1 = CR (<Enter>)
0 = Entity selected
@NUMINT (ivar)
@INTDAT[] (ivar)
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 for
information on the contents of @INTDAT for each entity type.
@NUMFLT (ivar)
@FLTDAT[] (fvar)
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 @FLTDAT for each entity type.
@NUMSTR (ivar)
@STRDAT[] (cvar)
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[] (var)
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.
GETENTID
GETENTID selects the entity having the given ID. The numeric entity type code is returned in
the specified variable. Other entity data is returned in specified variable arrays or system
variable arrays.
Format:.
GETENTID id, enttype, [fdat], [idat], [sdat], [mdat]
Input Parameter:
id (ival) Entity ID
Output Parameters:
Page 114
115
enttype (ivar) Returned type code for entity selected. See Entity Information in the Appendices
for a list of entity codes.
fdat (fvar)
Variable name of array in which to return 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 @FLTDAT.
idat (ivar)
Variable name of array in which to return 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.
sdat (cvar)
Variable name of array in which to return 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.
mdat (fvar)
Variable name of array in which to return entity's miscellaneous data. The
sizeof() function can be used to determine the number of elements in the array. If this parameter
is omitted, the data will be put into @MSCDAT.
System Variables Set:
@ERROR (ivar)
Error Code:
0 = No error
1 = Selection error
2 = Entity too large for arrays
3 = Can't create variable array
@NUMINT (ivar)
@INTDAT[] (ivar)
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.
@NUMFLT (ivar)
@FLTDAT[] (fvar)
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 @FLTDAT for each entity type.
@NUMSTR (ivar)
@STRDAT[] (cvar)
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[] (var)
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 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.
Page 115
116
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.
Format:
GETENTM selopt, nument
Input Parameter:
selopt (ival)
Entity selection option:
1 = Single
2 = Chain
3 = Window
4 = Polygon
5 = Group
6 = Plane
7 = All Displayed
Output Parameter:
nument (ivar) Number of entities selected
System Variables Set:
@ERROR (ivar)
Error Code:
0 = No error
1 = Selection error
@KEY (ivar)
-3
-2
-1
0
GETENTXY
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.
Format:
GETENTXY x, y, enttype, [vpnum], [id], [fdat], [idat], [sdat], [mdat]
Input Parameters:
x (fval)
X view position of the entity
y (fval)
vpnum (ival)
Viewport number:
0 or default = Primary viewport
positive number = Specified viewport is used
Page 116
117
Output Parameters:
enttype (ival) Returned type code for the entity selected. See Entity Information in the
Appendices for a list of entity codes.
id (ivar)
Entity ID
fdat (fvar)
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 @FLTDAT.
idat (ivar)
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.
sdat (cvar)
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.
mdat (fvar)
Variable name of array in which to return the entity's miscellaneous data. The
sizeof() function can be used to determine the number of elements in the array. If this parameter
is omitted, the data will be put into @MSCDAT.
System Variables Set:
@ERROR (ivar)
Error Code:
0 = No error
1 = Selection error
2 = Entity too large for system arrays
3 = Illegal viewport number
4 = Can't create variable array
@KEY (ivar)
-3
-2
-1
0
@NUMINT (ivar)
@INTDAT[] (ivar)
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 for
information on the contents of @INTDAT for each entity type.
@NUMFLT (ivar)
@FLTDAT[] (fvar)
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 @FLTDAT for each entity type.
@NUMSTR (ivar)
@STRDAT[] (cvar)
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.
Page 117
118
@MSCDAT[](var)
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.
GETFLT
GETFLTdisplays 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.
Format:
GETFLT prompt, defflt, retflt, [menu1], ..., [menu 9], [depth]
Input Parameters:
prompt (string) Text string to be displayed on the prompt line. Optionally, the default value
"defflt" may be displayed in the prompt string if the format specifier %f 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, must not exceed 68 characters or truncation will occur.
defflt (fval)
Default floating point value. If <Enter> is pressed without supplying a value, this
value is returned.
menu1 (string) Text string to be displayed in the first CADKEY menu position. The total length of
the text string must not exceed eight characters or truncation will occur.
menu9 (string) Text string to be displayed in the ninth CADKEY menu position. The total length
of the text string must not exceed eight characters or truncation will occur.
depth (ivar)
History depth. A positive value (1 - n) causes the selected menu item to be
displayed in the CADKEY history line at the specified position. If set to 0 or not supplied (the
default), the history line is not modified.
Output Parameter:
retflt (fvar)
Variable to store return value
System Variables Set:
@ERROR (ivar)
Error Code:
0 = No error
1 = Exception exit (F10 or ESC)
@KEY (ivar)
-3
-2
0
1
2
.
.
9
Page 118
119
GETGROUP
GETGROUP retrieves group name and subgroup flags for the specified group. The data is
returned via @INTDAT and @STRDAT.
Format:
GETGROUP grpnum
Input Parameter:
grpnum (ival) Group number (1-127)
Output Parameters:
none
System Variables Set:
@ERROR (ivar)
Error code:
0 = No error
1 = Invalid group number
2 = Cannot create system array
@NUMINT (ivar)
@INTDAT[0-31] (ivar)
Subgroup flags
@NUMSTR (ivar)
@STRDAT (cvar)
Group name
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.
GETINT
GETINT 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.
Format:
GETINT prompt, defint, retint, [menu1], ..., [menu9], [depth]
Input Parameters:
prompt (string) Text string to be displayed on the prompt line. Optionally, the default value
"defint" may be displayed in the prompt string if the format specifier %d is included in the prompt
Page 119
120
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
number, must not exceed 68 characters or truncation will occur.
defint (ival)
is returned.
Default integer value. If <Enter> is pressed without supplying a value, this value
menu1 (string) Text string to be displayed in the first CADKEY menu position. The total length of
the text string must not exceed eight characters or truncation will occur.
menu9 (string) Text string to be displayed in the ninth CADKEY menu position. The total length
of the text string must not exceed eight characters or truncation will occur.
depth (ivar)
History depth. A positive value (1 - n) causes the selected menu item to be
displayed in the CADKEY history line at the specified position. If set to 0 or not supplied (the
default), the history line is not modified.
Output Parameter:
retint (ivar)
Variable to store return value
System Variables Set:
@ERROR (ivar)
Error code:
0 = No error
1 = Exception exit (F10 or ESC)
@KEY (ivar)
-3
-2
0
1
2
.
.
9
GETKEY
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>).
Format:
GETKEY [wflag]
Input Parameter:
wflag (ival)
Wait flag:
0 or default = System keyboard buffer is checked with "no wait" (i.e., if no key is
available, @ERROR is set to 1).
1 = CADL waits until a key is pressed if the system keyboard buffer is empty.
Output Parameters:
none
Page 120
121
GETLTYPE
GETLTYPE displays a text string on the CADKEY prompt line along with a window of line type
icons and waits for one or more line types to be selected.
Format:
GETLTYPE prompt, rettype, [mflg]
Input Parameters:
prompt (string) Text string to be displayed on the prompt line. The total length of the text string
must not exceed 68 characters or truncation will occur.
mflg (ival)
Multiple selection flag:
0 (default) = Return single line type
1 = Return multiple line types as mask
Output Parameter:
rettype (ivar)
Variable to store the single line type selected (1-4) or the line type mask where:
bit 0 = Solid
bit 1 = Dashed
bit 2 = Center line
bit 3 = Phantom line
System Variables Set:
@ERROR (ivar)
Error code:
0 = No error
1 = Exception error (CR, F10, ESC)
@KEY (ivar)
-3
-2
-1
0
GETLWIDTH
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.
Format:
GETLWIDTH prompt, retwdt, [mflg]
Input Parameters:
prompt (string) Text string to be displayed on the prompt line. The total length of the text string
must not exceed 68 characters or truncation will occur.
Page 121
122
mflg (ival)
Multiple selection flag:
0 (default) = Return single line width
1 = Return multiple line widths as mask
Output Parameter:
retwdt (ivar)
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
System Variables Set:
@ERROR (ivar)
Error code:
0 = No error
1 = Exception error (CR, F10, ESC)
@KEY (ivar)
-3
-2
-1
0
GETMENU
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.
Format:
GETMENU prompt, [menu1], [menu2], ..., [menu9], [depth], [dflt]
Input Parameters:
prompt (string) Text string to be displayed on the CADKEY prompt line. The total length of the
text string must not exceed 68 characters or truncation will occur. Optionally, the default menu
item "dflt" may be displayed in the prompt string if the format specifier %s is included in the
prompt string (refer to Basics for details on format specifiers).
menu1 (string) Text string to be displayed in the first CADKEY menu position. The total length of
the text string must not exceed eight characters or truncation will occur.
menu9 (string) Text string to be displayed in the ninth CADKEY menu position. The total length
of the text string must not exceed eight characters or truncation will occur.
depth (ival)
History depth. If set to positive value (1-n), causes the selected menu item to be
displayed in the CADKEY History Line at the specified position. If set to 0 or the default, history
line is not modified.
dflt (ival)
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 dflt is passed as 3 and <Enter>
Page 122
123
is typed, @key will contain the value 3, the same as if F3 is typed. If dflt 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.
System Variables Set:
@ERROR (ivar)
Error code:
0 = No error
1 = Exception exit (CR, F10, or ESC)
@KEY (ivar)
-3
-2
-1
1
2
.
.
9
GETNEXT
GETNEXT 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.
Format:
GETNEXT enttype, [selnum], [id], [fdat], [idat], [sdat], [mdat]
Input Parameter:
selnum (ival) Entity selection number. Must be in the range of 1-n where n is the number of
entities returned by GETENTM.
Output Parameters:
enttype (ivar) Returned type code for entity selected. See Entity Information in the Appendices
for a list of entity codes.
id (ivar)
Entity ID
fdat (fvar)
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 @FLTDAT.
Page 123
124
idat (ivar)
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.
sdat (cvar)
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.
mdat (fvar)
Variable name of array in which to return the entity's miscellaneous data. The
sizeof() function can be used to determine the number of elements in the array. If this parameter
is omitted, the data will be put into @MSCDAT.
System Variables Set:
@ERROR (ivar)
Error code:
0 = No error
1 = Syntax error
2 = Entity too large for arrays
3 = No more entities or entity number out of
range
4 = Can't create variable array
@NUMINT(ivar)
@INTDAT[](ivar)
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 for
information on the contents of @INTDAT for each entity type.
@NUMFLT(ivar)
@FLTDAT[](fvar)
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 of
this guide for information on the contents of @FLTDAT for each entity type.
@NUMSTR(ivar)
@STRDAT[](cvar)
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 of this
guide for information on the contents of @STRDAT for each entity type.
@MSCDAT[] (var)
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.
GETPLANE
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 or CUTTING EDGE User Reference Guide.
The data for the plane selected is returned in either a specified array variable or a system array
variable (default).
Format:
GETPLANE prompt, dspflg, [rtnpln]
Page 124
125
Input Parameters:
prompt (string) Text string to be displayed on the CADKEY prompt line. The total length of the
text string must not exceed 68 characters or truncation will occur.
dspflg (ival)
If set to 0, no plane icon is drawn. If set to 1, a plane icon (or figure) is drawn
representing the orientation of the plane.
Output Parameter:
rtnpln (fvar)
Name of variable for returned plane data. If not supplied, plane data is returned
in @FLTDAT. 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 14 elements.
System Variables Set:
@ERROR (ivar)
Error code:
0
= No error
1
= Exception exit (F10 or ESC)
2
= Cannot create system array
@KEY (ivar)
-3
-2
0
@NUMFLT (ivar)
@FLTDAT[0](fvar)
@FLTDAT[1-9] (fvar)
View matrix
@FLTDAT[1]
@FLTDAT[4]
@FLTDAT[7]
@FLTDAT[2]
@FLTDAT[5]
@FLTDAT[8]
@FLTDAT[3]
@FLTDAT[6]
@FLTDAT[9]
|
|
|
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 following characteristics apply to the view rotation matrix:
1. It is orthogonal in the linear algebraic sense (i.e., its transpose is its inverse).
2. It has a positive determinant.
Refer to the CADL Appendices for matrix examples.
@FLTDAT[10-13] (fvar) Planar coefficients:
[10] = a
[11] = b
[12] = c
[13] = d
Represent these coefficients of the general plane equation:
ax + by + cz + d = 0
Page 125
126
GETPOS
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).
Format:
GETPOS prompt, defopt
Input Parameters:
prompt (string) Text string to be displayed on the prompt line. The total length of the text string
must not exceed 38 characters or truncation will occur.
defopt (ival)
Default position menu option (1-9). This may be overridden by the user when the
menu is displayed.
System Variables Set:
@ERROR (ivar)
Error code:
0 = No error
1 = Exception exit (CR, F10, or ESC)
@KEY (ivar)
-3
-2
-1
1
2
.
.
9
@XVIEW (fvar)
@YVIEW (fvar)
@ZVIEW (fvar)
@XWORLD (fvar)
@YWORLD (fvar)
@ZWORLD (fvar)
@XCVIEW (fvar)
@YCVIEW (fvar)
@ZCVIEW (fvar)
GETSTR
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
Page 126
127
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.
Format:
GETSTR prompt, defstr, retstr, [menu1], ..., [menu9], [depth]
Input Parameters:
prompt (string)
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, must not exceed 68 characters or truncation will occur.
defstr (string)
is returned.
Default string. If <Enter> is pressed without supplying a string, the default string
menu1 (string) Text string to be displayed in the first CADKEY menu position. The total length of
the text string must not exceed eight characters or truncation will occur.
menu9 (string) Text string to be displayed in the ninth CADKEY menu position. The total length
of the text string must not exceed eight characters or truncation will occur.
depth (ivar)
History depth. A positive value (1 - n) causes the selected menu item to be
displayed in the CADKEY history line at the specified position. If set to 0 or not supplied (the
default), the history line is not modified.
Output Parameter:
retstr (cval)
Variable to store return string. Variable name must begin with a '$' character. The
returned string will be a null terminated array of characters.
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
.
.
9
= F9
GETVIEW
GETVIEW retrieves the specified system view matrix and stores it in the retvw array or the
system array @FLTDAT.
Format:
GETVIEW vnum [, retvw]
Page 127
128
Input Parameters:
vnum (ival)
System view number
Output Parameters:
retvw (fval)
Return view matrix. If not supplied, a nine element view matrix is put into
@FLTDAT[0] - @FLTDAT[8]. If retvw is specified, the view matrix is put into that variable
instead. The variable must be an array variable or not have been previously used. On return
from GETVIEW the variable will be one-dimensional and contain nine elements.
System Variables Set:
@ERROR (ivar)
Error code:
0 = No error
1 = View not defined
2 = Cannot create system array
@NUMFLT (ivar)
@FLTDAT[0-8] (fvar)
@FLTDAT[1]
@FLTDAT[4]
@FLTDAT[7]
@FLTDAT[2] |
@FLTDAT[5] |
@FLTDAT[8] |
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 following characteristics apply to the view rotation matrix:
1. It is orthogonal in the linear algebraic sense (i.e., its transpose is its inverse).
2. It has a positive determinant.
GOTO
GOTO 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.
Format:
GOTO label
GROUP
The GROUP primitive is output by the program's CADL, OUTPUT, GRP TBL function. The
GROUP primitive mayalso be read in by a CADL file execution to create a group and subgroup
in the system's database. If the group and subgroup already exist, an attempt is made by the
system to use them. Note that a group and subgroup must be created prior to its first reference in
a CADL primitive.
Page 128
129
If the GROUP primitive is output to a CADL file, a check is performed in the GRP.TXT file to see
if any text data is associated with this particular group. If so, the fields of text data are dumped in
the form of REM GRP statements, with each field of data displayed inside of double quotes in a
REM GRP record.
Format:
GROUP "grpname", grpnum, nsubgrps
Input Parameters:
grpname (string)
A string of up to eight characters, contained in double quotes,
representing the name of the group.
grpnum (integer)
Group reference number
1-127 = Group number
0 = No group assigned
nsubgrps (integer)
Number of subgroups (1-256)
0 = No subgroups assigned
HALF
HALF performs a "zoom-out" on a part by dividing the current part scale factor by two. This
performs the same function as using the system's Immediate Mode command, except that an
automatic redraw is not performed.
Format:
HALF [vpnum]
Input Parameter:
vpnum (ival)
Viewport number:
-1 = All viewports
0 or default = Primary viewport
positive number = Only designated viewport
Output Parameters:
none
System Variables Set:
@ERROR
0 = No error
1 = Invalid viewport
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
if false (zero), the statement following the IF clause is ignored. The program then continues with
the statement following the compound IF statement.
Format:
IF (expr)
statement
Page 129
130
INPUT
INPUT 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 device through which input is read is the standard input device. At each CADL invocation,
the input device is usually the console keyboard (as with CADKEY). However, if the input
redirection symbol (<) is used when CADKEY is initiated, the input device will be the redirection
name (refer to your system's User's Manual for more information on input/output redirection).
The input device can be changed at any time to another device or to a file by using the SET
DEVIN command. The new device or file will be in effect until CADL processing is completed,
another SET DEVIN command is processed, or a CLOSE DEVIN is processed.
If your system is configured for a one monitor setup, anything entered from the keyboard will
appear in the upper left corner.
Format:
INPUT format [, var1, ...]
Input Parameter:
format (string) Format control string
Output Parameter:
var1 (var)
Name of first variable to set based on first field
specifier
System Variables Set:
@ERROR (ivar)
Error code:
0 = No error
1 = DEVIN not open
@NREAD (ivar) Number of fields successfully converted
INQCTYPE
INQCTYPE returns the name of a copious entity type given its type
code.
Format:
INQCTYPE tcode, name
Input Parameter:
tcode (ival)
Entity type code
Page 130
131
Output Parameter:
name(cvar)
String variable in which to store returned name. The variable name must begin
with a '$' character or be defined as string data type. The returned code will be a null terminated
array of characters.
System Variables Set:
@ERROR(ivar) Error code:
0 = No error
1 = Type does not exist
INQTCODE
INQTCODE returns the type code of a copious entity type given its name.
Format:
INQTCODE name, tcode
Input Parameter:
name(cval)
String variable in which to store returned name. The variable name must begin
with a '$' character or be defined as string data type. The returned code will be a null terminated
array of characters.
Output Parameter:
tcode (ival)
Entity type code
System Variables Set:
@ERROR(ivar) Error code:
0 = No error
1 = Type does not exist
LABEL
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 VIEW primitive is created
first (if necessary) which the LABEL primitive may reference as its definition plane.
Format:
LABEL x1, y1, x2, y2, x3, y3, arrowtype, x, y, str, rot, ht, asp, [vnum], [col], [lev], [fnt], [grpnum],
[subgrp], [pen], [slnt], [fill], [uln]
Input Parameters:
x1 (double)
X value of leader 1's first endpoint in label's view coordinates
y1 (double)
x2 (double)
X value of leader 1's second endpoint and the first endpoint of leader 2 in label's
view coordinates
Page 131
132
y2 (double)
Y value of leader 1's second endpoint and the first endpoint of leader 2 in label's
view coordinate
x3 (double)
y3 (double)
arrowtype (integer)
Arrowhead type:
0 = Style 1
1 = Style 2
(The endpoint of leader 2 intersects with the
arrowhead tip.)
x (double)
coordinates
X value of the lower left corner of the first line of the text string in text's view
y (double)
coordinates
Y value of the lower left corner of the first line of the text string in text's view
str (string)
A character string.
rot (double)
The rotation angle of the text about the XY coordinate (in degrees)
rot must be >= 0 and <= 360 degrees
ht (double)
asp (double)
vnum (integer)
VIEW primitive reference number. The VIEW primitive referenced must
precede this primitive or an error message is displayed and the program terminates.
col (integer)
The color assigned to the note entity
0-15 = Number in the system color palette
lev (integer)
Level number assigned to the note entity
1-255 = System level number
0 = Current system level number
fnt (integer)
Text font number assigned to the note entity:
-16 through -1 = font number (new style)
0 = Current system font number
1 = Bold
2 = Slant
3 = Bold box filled
4 = Bold slant filled
5 = Bold box
6 = Bold slant
grpnum (integer)
Group reference number
1-127 = Group number
0 = No group assignment
subgrp (integer)
Subgroup reference number
1-256 = Subgroup number
0 = No subgroup assignment
Page 132
133
Note : 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.
pen (integer)
Pen number
1-8 = Pen number
0 = Use current system pen number
slnt (integer)
Text slant angle (new font style only)
slnt must be >= -31 and <= 31 degrees
fill (integer)
Fill mode (new font style only)
0 = Non-filled text
1 = Filled text
uln (integer)
Underline mode
0 = Non-underlined text
1 = Underlined text
LEADER
A LEADER primitive describes the geometry found in a CADKEY leader dimension entity.
When a LEADER primitive is read from a CADL file, a leader entity is created in the CADKEY
database in the specified view.
When a leader entity is written to a CADL file as a LEADER primitive, a VIEW primitive is
created first (if necessary) which the LEADER primitive may reference as its definition plane.
Format:
LEADER x1, y1, x2, y2, arrowsize, arrowtype, [vnum], [col], [lev], [ltype], [grpnum], [subgrp],
[pen]
Input Parameters:
x1 (double)
X value of endpoint 1 in leader's view
coordinates
y1 (double)
coordinates
x2 (double)
coordinates
y2 (double)
coordinates
arrowsize (double)
Size of arrowhead
arrowtype (integer)
0 = Style 1
1 = Style 2
Arrowhead type:
vnum (integer) VIEW primitive reference number. The VIEW primitive referenced must precede
this primitive or an error message is displayed and the program terminates.
0 = Use current system view in effect
Page 133
134
col (integer)
Color number
0-15 = Number in the system color palette
lev (integer)
Level number
1-255 = System level number
0 = Use current system level
ltype (integer) Line type:
1 = Solid
2 = Dashed
3 = Center line
4 = Phantom line
0 = Use current system line type
grpnum (integer)
Group reference number
1-127 = Group number
0 = No group assignment
subgrp (integer)
Subgroup reference number
1-256 = Subgroup number
0 = No subgroup assignment
Note : 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.
pen (integer)
Pen number
1-8 = Pen number
0 = Use current system pen number
LEVELS
LEVELS changes the levels displayed by adding or removing designated levels. An automatic
redraw is not performed with this command. The format is as follows:
Format:
LEVELS opt, lowlev, [highlev]
Input Parameters:
opt (integer)
Option flag:
0 = Turns off a level
1 = Turns on a level
lowlev (integer) Low level in range of system levels to turn on/off.
lowlev must be >= 1 and <= 255
highlev (integer)
High level in range of system levels to turn on/off. When this parameter
is not used, it is assumed that only one level (lowlev) is to be turned on/off.
highlev must be >lowlev and <= 255
LINDIM
The LINDIM primitive describes a linear dimension entity. All LINDIM data is represented in local
view coordinates.
Page 134
135
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 angle then the string should replace the parameter 'str'.
Format:
LINDIM x, y, z, str, refln, axis, form, [txtinfo], [diminfo1], [diminfo2], [txtatt], [entatt]
Input Parameters:
x (double)
X value of the text position based on the alignment defined in the TXTINFO
array
y (double)
array
Y value of the text position based on the alignment defined in the TXTINFO
z (double)
array
Z value of the text position based on the alignment defined in the TXTINFO
str (string)
displayed.
refln (farray)
Array of floats that defines the coordinates of the reference lines. Each LINDIM
requires one reference line. For more detail refer to the System Arrays section.
axis (double)
Page 135
136
txtatt(farray)
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.
entatt(iarray)
An array of integer values that describes the attributes of the entity. For more
detail refer to the System Arrays section.
LINE
The LINE primitive describes the two endpoints of a line in X, Y, Z world coordinates (model
space), whose length must be greater than or equal to 0.0005, and less than or equal to 10,000.
When a LINE primitive is read from a CADL file, a line entity is added in the database.
When a line entity is written to a CADL file, it is output as a LINE primitive.
Format:
LINE x1, y1, z1, x2, y2, z2, [col], [lev], [ltype], [grpnum], [subgrp], [pen], [lwdt]
Input Parameters:
x1 (double)
X value of line endpoint 1 in world coordinates
y1 (double)
z1 (double)
x2 (double)
y2 (double)
z2 (double)
col (integer)
Color
0-15 = Number in the system color palette
lev (integer)
Level number
1-255 = System level number
0 = Use current system level
ltype (integer) Line type:
1 = Solid
2 = Dashed
3 = Center Line
4 = Phantom line
0 = Use current system line type
grpnum (integer)
Group reference number
1-127 = Group number
0 = No group assignment
subgrp (integer) Subgroup reference number
1-256 = Subgroup number
0 = No subgroup assignment
Page 136
137
Note : 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.
pen (integer)
Pen number
1-8 = Pen number
0 = Use current system pen number
lwdt (integer) Line width
1-15 = Odd line width
0 = Use current system line width
MAKECOLL
Make collective from a list of entity ID's. When the range is specified, the ID list must contain 2
ID's -a minimum and a maximum which identify a range of entities to be made into a
collective.
Format:
MAKECOLL num, id
Input Parameters:
num (integer) Number of entities to put into collective
-1 = flag that indicates that there are 2 IDs in the list that represent range.
id[] (ID) List of entity IDs
MODE
MODE allows the operational mode for CADL file execution to be set, with regard to the
recognition of data primitives. Three keyword modes are available: NORMAL, DRAW, and
SUPPRESS.
Format:
MODE keyword
Input Parameter:
keyword (word)
NORMAL - displays primitives found in a CADL file on the screen and adds them to the
database.
DRAW - displays primitives on the screen (if possible) but DOES NOT add them to the
database.
SUPPRESS - adds primitives to the data base but DOES NOT display them on the
screen.
NEXTCOLL
Get next entity in a collective.
Page 137
138
Format:
NEXTCOLL num, etype, id
Input Parameters:
num (integer) Entity number
-32767 = flag that indicates retrieve the next entity in the collective entity
Output Parameters:
etype (integer) Type of the entity returned
id (ID) ID of the returned entity
System Variables Set:
@ERROR
Error code:
0
= No error
-5
= No more entities or entity number out of range
-6
= Not enough memory for entity extraction
NFNOTE
The NFNOTE primitive is similar to the NNOTE primitive except that the characters are strings
defined in a file instead of included as part of the statement. When an NFNOTE primitive is read
from a CADL file, a disk note entity is created in the database.
When an NFNOTE entity is written to a CADL file as an NFNOTE primitive, a VIEW primitive is
created first. In addition to a VIEW primitive, some arrays are created. These arrays are used for
the NFNOTE definition.
Format:
NFNOTE x, y, z, fname, [txtinfo], [txtatt], [entatt]
Input Parameters:
x (double)
X value of the lower left corner of the first line of text string in text's view
coordinates
y (double)
coordinates
Y value of the lower left corner of the first line of text string in text's view
z (double)
coordinates
Z value of the lower left corner of the first line of text string in text's view
fname (word) Text file specification. Processing of the file specification is as follows: 1) if the
specification does not include a path, the directory used is the default directory for CADL
programs (set with the CONFIG program); 2) if a full path is included, the full path is used; 3) if
the specification includes a relative path, the specified directory is relative to the current working
directory.
txtinfo(iarray) An array of integer values that describes the information for the dimension text.
For more detail refer to the System Arrays section.
txtatt(farray)
An array of floats that describes the attributes of the dimension text. For more
detail refer to the System Arrays section.
Page 138
139
entatt(iarray)
An array of integer values that describes the attributes of the entity. For more
detail refer to the System Arrays section.
NLABEL
An NLABEL primitive describes the geometry and text found in a CADKEY label dimension
entity. All NLABEL data is represented in local view coordinates.
When an NLABEL primitive is read from a CADL file, a label dimension entity is created in the
database.
When a label entity is written to a CADL file as an NLABEL primitive, a VIEW primitive is created
first. In addition to a VIEW primitive, some arrays are created. These arrays are used for the
NLABEL definition.
When an NLABEL primitive is read from a CADL file, all the arrays except witln and ldrln are
optional. NLABEL requires one witness line and at least one leader line. The system allows as
many as five leader lines for every label entity. The string should be placed in the variable 'str'.
Format:
NLABEL x, y, z, str, numwit, witln, numldr, ldrln, [txtinfo], [txtatt], [entatt]
Input Parameters:
x (double)
X value of the lower left corner of the label text in the view coordinates
y (double)
Y value of the lower left corner of the label text in the view coordinates
z (double)
Z value of the lower left corner of the label text in the view coordinates
str (string)
A character string.
NLEADER
An NLEADER primitive describes the geometry found in a CADKEY leader dimension entity. All
NLEADER data is represented in local view coordinates.
Page 139
140
When a leader entity is written to a CADL file as an NLEADER primitive, a VIEW primitive is
created first. In addition to a VIEW primitive, some arrays are created for the NLEADER
definition. When an NLEADER primitive is read from a CADL file, all the arrays except ldrln are
optional. A leader contains one leader line.
Format:
NLEADER ldrln, depth, vwonly, [entatt]
Input Parameters:
ldrln(farray)
Array of floats that defines the coordinates of the leader line. Each NLEADER
requires 1 leader line. For more detail refer to the System Arrays section.
depth(double)
vwonly(integer)
A flag to indicate if the leader is displayed only in the view of definition
or can be seen in other
views.
0 = Display in all views
1 = Display only in view of definition
entatt(iarray)
An array of integer values that describes the attributes of the entity. For more
detail refer to the System Arrays section.
NNOTE
An NNOTE primitive describes the geometry found in a CADKEY note entity. All NNOTE data is
represented in local view coordinates.
When an NNOTE 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 as an NNOTE primitive, a VIEW primitive is created
first. In addition to a VIEW primitive, some arrays are created for the NNOTE definition.
Format:
NNOTE x, y, z, str, [txtinfo], [txtatt], [entatt]
Input Parameters:
x (double)
X value of the lower left corner of the text in the view coordinates
y (double)
Y value of the lower left corner of the text in the view coordinates
z (double)
Z value of the lower left corner of the text in the view coordinates
str (string)
A character string.
txtinfo(iarray) An array of integer values that describes the information for the label text. For
more detail refer to the System Arrays section.
txtatt(farray)
An array of floats that describes the attributes of the dimension text. For more
detail refer to the System Arrays section.
Page 140
141
entatt(iarray)
An array of integer values that describes the attributes of the entity. For more
detail refer to the System Arrays section.
NOTE
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 VIEW primitive is created first (if necessary) which
the NOTE primitive may reference as its assigned plane.
Format:
NOTE x, y, str, [rot], [ht], [asp], [vnum], [col], [lev], [fnt], [grpnum], [subgrp], [pen], [slnt], [fill],
[lnsp], [uln], [mir]
Input Parameters:
x (double)
X value of the lower left corner of the first line of the text string in text's view
coordinates
y (double)
coordinates
Y value of the lower left corner of the first line of the text string in text's view
str (string)
A character string.
rot (double)
The rotation angle of the text about the XY coordinate (in degrees). rot must be
>= 0 and <= 360 degrees
ht (double)
asp (double)
vnum (integer) VIEW primitive reference number. The VIEW primitive referenced must precede
this primitive or an error message is displayed and the program terminates.
0 = Use current system view in effect
col (integer)
The color assigned to the note entity
0-15 = Number in the system color palette
lev (integer)
Level number assigned to the note entity
1-255 = System level number
0 = Current system level number
fnt (integer)
Text font number assigned to the note entity:
-16 through -1 = Font number (new style)
0 = Current system font number
1 = Bold
2 = Slant
3 = Bold box filled
4 = Bold slant filled
5 = Bold box
6 = Bold slant
grpnum (integer)
Page 141
142
NWITNESS
An NWITNESS primitive describes the geometry found in a CADKEY witness dimension entity.
All NWITNESS data is represented in local view coordinates.
When an NWITNESS primitive is read from a CADL file, a witness dimension entity is created in
the database.
When a witness entity is written to a CADL file as an NWITNESS primitive, a VIEW primitive is
created first. In addition to a VIEW primitive, some arrays are created for the NWITNESS
definition.
When an NWITNESS primitive is read from a CADL file, all of the arrays except witln are
optional.
Format:
NWITNESS witln, depth, vwonly, [entatt]
Input Parameters:
witln(farray)
Array of floats that defines the coordinates of the witness line. Each NWITNESS
requires one witness line. For more detail refer to the System Arrays section.
Page 142
depth(double)
143
vwonly(integer)
A flag to indicate if the witness line is displayed only in the view of
definition or can be seen in other views.
0 = Display in all views
1 = Display only in view of definition
entatt(iarray)
An array of integer values that describes the attributes of the entity. For more
detail refer to the System Arrays section.
ON GOTO
ON GOTO 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.
Format:
ON value GOTO [lab1, ...]
ORDALIGN
ORDALIGN allows you to align the given ordinate dimension entity. An ordinate dimension is a
collective entity and therefore, the ID of only one of many ordinates needs to be passed. The
system will align the ordinate dimension automatically.
Format:
ORDALIGN id
Input Parameter:
id (ulong)
Unique ID of the ordinate or the current entity selected
ORDDIM
The ORDDIM primitive describes an ordinate dimension entity.
All ORDDIM data is represented in local view coordinates.
When an ORDDIM primitive is read from a CADL file, an ordinate dimension is created in the
database. An ordinate dimension entity is a collective entity. It is collection of individual ordinate
dimensions.
When an ordinate dimension is written to a CADL file as a ORDDIM primitive, a VIEW primitive
is created first. In addition to a VIEW primitive, some arrays are created for the ORDDIM
definition. An ordinate dimension entity is a collective of many ordinate dimensions. When it is
written to a CADL file, a "SET collective, 1" command is issued along with "SET collective, 0" at
the end. An ORDALIGN command is also written at the end. This command aligns the ordinate
dimension entity with respect to the base point.
When an ORDDIM primitive is read from a CADL file, all the arrays except refpnt are optional.
Three points are required to be defined for each ordinate dimension. These points are defined in
the refpnt array. The system uses these points to calculate the dimension value. If a special
Page 143
144
value/string is desired in place of the numeric value of the ordinate dimension then the string
should replace the parameter 'str'.
Format:
ORDDIM
Input Parameters:
x (double)
X value of the text position based on the alignment defined in the TXTINFO
array
y (double)
array
Y value of the text position based on the alignment defined in the TXTINFO
z (double)
array
Z value of the text position based on the alignment defined in the TXTINFO
str (string)
refpnt(farray) Array of float data that defines the coordinates of the reference point. Each
ORDDIM requires 3 reference points. The order of the points is as follows:
1. Base ordinate dimension point
2. Base ordinate dimension text point
3. Subordinate dimension point
For more detail refer to the System Arrays
section.
axis(double)
PALETTE
PALETTE provides means of setting one or more colors in the CADKEY color graphics palette.
Each color defined is a combination of red, green, and blue intensities. The values range
between 0 and 1, where 0.0 is off and 1.0 is full intensity. Note the effects that this command has
on the system.
Page 144
145
Graphics Display:
1) If a 256-color graphics device is being used, the graphics color is set at the hardware device
level and affects the display of all graphic entities and the screen background color (if color 0 is
set). Refer to the Hardware Setup Guide for a listing of the 256-color graphics devices supported
by CADKEY.
2) If a 16-color graphics device is being used, the appropriate color dither patterns are chosen by
the system to simulate colors, affecting only the display of filled polygons and polylines.
3) If a monochrome graphics device is being used, the appropriate black and white dither
patterns are chosen by the system to simulate colors, affecting only the display of filled polygons
and filled polylines.
On-Line Printing:
1) If a color printer is being used, the appropriate color dither patterns are chosen by the system
to simulate colors affecting only the display of filled polygons, filled polylines and the background
color (if color 0 is set). If colors 1-15 have been redefined (replacing the system defaults), the
printing of entities other than filled polygons and filled polylines will be performed such that the
closest printer base color will be chosen.
2) If a black and white printer is being used, the appropriate black and white color dither patterns
are used to simulate colors, affecting only the display of filled polygons, filled polylines and the
background color (if color 0 is set).
Format:
PALETTE start, numcol, arrayname
Input Parameters:
start (ival)
CADKEY starting color index (0-255)
numcol (ival)
arrayname (word)
Two-dimensional array containing color values. The array is declared as
3 x n where n is the number of color indices. A color value is always expressed as a real number
between 0 and 1, where 0 is no saturation and 1 is full saturation.
For index 'i' in array "rgb", rgb[0][i] is the red value, rgb[1][i] is the green, and rgb[2][i] is the blue.
PAUSE
PAUSE 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
Page 145
146
length of the text string, including the expanded variables in the string, must not exceed 68
characters or truncation will occur.
Format:
PAUSE [ format, val1, ...]
Input Parameters:
format (string) Format control string
val1 (val)
POINT
The POINT primitive describes an X, Y, Z location in world coordinates (model space).
When a POINT primitive is read from a CADL file, a point entity is created in the system
database.
When a point entity is written to a CADL file, a POINT primitive is produced.
Format:
POINT x, y, z, [col], [lev], [grpnum], [subgrp], [pen]
Input Parameters:
x (double)
X value of point in world coordinates
y (double)
Y value of point in world coordinates
z (double)
col (integer)
Color
0-15 = Number in the system color palette
lev (integer)
Level number
1-255 = System level number
0 = Use current system level
grpnum (integer)
Group reference number
1-127 = Group number
0 = No group assignment
subgrp (integer) Subgroup reference number
1-256 = Subgroup number
0 = No subgroup assignment
Note : 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.
Page 146
147
pen (integer)
Pen number
1-8 = Pen number
0 = Use current system pen number
POLYGON
A POLYGON primitive describes a polygon of up to eight vertices. Although a polygon is
normally thought of as a planar figure, there is no restriction that the vertices must lie in a plane.
When a POLYGON primitive is read from a CADL file, this primitive is stored in the system's
database as a polygon entity.
When a polygon entity is written to a CADL file, it is output as a POLYGON primitive.
Format:
POLYGON filltype, fillcol, numpts, arrayname, [col], [lev], [ltype], [grpnum], [subgrp], [pen]
Input Parameters:
filltype (integer) Fill type
1 = Unfilled
2 = Filled
fillcol (integer) Color of polygon if filled. Otherwise, color of outline is specified by the col
parameter. The range of fcol is from 0-255
numpts (integer)
arrayname (word)
arrayname
First and last point need not be identical to force closure; closure is automatic.
col (integer)
Color
0-15 = Number in the system color palette
lev (integer)
Level number
1-255 = System level number
0 = Use current system level
ltype (integer) Line type:
1 = Solid
2 = Dashed
3 = Center line
4 = Phantom line
0 = Use current system line type
grpnum (integer)
Page 147
148
POLYLINE
A POLYLINE primitive describes a polyline made up of up to 837 points. 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.
Format:
POLYLINE numpts, arrayname, width, pstyle, dstyle, fstyle, [col], [lev], [ltype], [grpnum],
[subgrp], [pen], [lwdt]
Input Parameters:
numpts (integer)
arrayname (word)
arrayname
width (double) Line width in CADKEY units (applies to dstyles 2, 3, and 4 only). A zero line
width results in a centerline.
pstyle (integer) Polyline style:
1 = Open polyline
2 = Closed polyline
3 = Filled polyline
dstyle (integer) Display style:
1 = Centerline
2 = Line at width using rounded corners
3 = Line at width using sharp corners
4 = Tool path
fstyle (integer) Fill style (dstyles 2 and 3 only)
Page 148
149
1 = No fill (outline)
2 = Solid filled
col (integer)
Color
0-15 = Number in the system color palette
lev (integer)
Level number
1-255 = System level number
0 = Use current system level
ltype (integer) Line type:
1 = Solid
2 = Dashed
3 = Center line
4 = Phantom line
0 = Use current system line type
grpnum (integer)
Group reference number
1-127 = Group number
0 = No group assignment
subgrp (integer)
Subgroup reference number
1-256 = Subgroup number
0 = No subgroup assignment
Note : 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.
pen (integer)
Pen number
1-8 = Pen number
0 = Use current system pen number
lwdt (integer) Line width
1-15 = Odd line width
0 = Use current system line width
PRANGE
PRANGE allows a range of colors in the CADKEY graphics palette to be set such that a linear
blend is chosen between the start and end RGB values specified. Refer to the PALETTE
command for information on how the usage of this command affects the system.
Format:
PRANGE startpal, numcolors, startred, startgreen, startblue, endred, endgreen, endblue
Input Parameters:
startpal (ival) Starting index in palette for range of colors to set (>= 0 and <= 255)
numcolors (ival)
startred (fval)
startgreen (fval)
Page 149
150
startblue (fval) Starting blue value in range to set (>= 0.0 and <= 1.0)
endred (fval)
endgreen (fval)
endblue (fval)
Ending red value in range to set (>= 0.0 and <= 1.0)
Ending green value in range to set (>= 0.0 and <= 1.0)
Ending blue value in range to set (>= 0.0 and <= 1.0)
@palb[]
PRINT
PRINT 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.
Format:
PRINT format [, val1, ...]
Input Parameters:
format (string) Format control string
val1 (val)
Page 150
151
PROMPT
PROMPT 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.
Format:
PROMPT format [, val1, ...]
Input Parameters:
format (string) Format control string
val1 (val)
READ
READ 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.
Processing of the file specification is as follows:
1)
If the specification does not include a path, the directory used is the default directory for
CADL programs (set with the CONFIG program).
2)
If a full path is included, the specified directory is used.
3)
If the specification includes a relative path, the specified directory is relative to the
current working directory.
The READ command supports two read modes:
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.
Format:
READ fname, mode, var1 [, var2, ...]
Input Parameters:
fname (string) Data file specification
mode (ival)
Open mode:
0 =
Read from beginning of file.
1 =
Read from current file position (if currently opened), otherwise, start from the beginning.
Output Parameters:
Page 151
var2 (var)
152
READDEV
READDEV reads the CADL digitizing device for a coordinate position, optionally waiting for a
function button to be pressed. Coordinates are either two- or three-dimensional and are returned
in x, y, and z. Additional information may also be returned via a, b and c. The number of
dimensions and the nature of any additional information is device dependent.
Format:
READDEV f, x, y, z, [a], [b], [c], [wflg]
Input Parameter:
wflg (ival)
Wait flag. If set to 0, return from READDEV is immediate whether or not a
position is available. If set to 1, return from READDEV occurs when either a function button is
pressed or the CADKEY abort key is pressed.
Output Parameters:
f (ivar) Variable to store function button value
x (fvar) Variable to store X value
y (fvar)
b (fvar)
c (fvar)
Page 152
153
REDRAW
REDRAW performs a redraw on the current system part displayed. This performs the same
function as using the system's Immediate Mode command.
Format:
REDRAW [vpnum]
Input Parameter:
vpnum (ival)
Viewport number:
-1 = All viewports are redrawn
0 or default = Primary viewport redrawn
positive number = Only designated viewport redrawn
System Variables Set:
@ERROR
0 = No error
1= Invalid viewport
REM
REM identifies remarks. This keyword, as well as any following text, is ignored by the system
when a CADL file is executed.
Format:
REM string
REMCOLL
Remove an entity from a collective.
Format:
REMCOLL id
Input Parameters:
id (ID) ID of entity to remove
SCALE
SCALE rescales the system part displayed. This performs the same function as using the
system's Immediate Mode command, or activating the S= option in the Status Window.
Format:
SCALE [scfac], [xc], [yc], [vpnum]
Input Parameters:
scfac (float)
Represents the viewing scale factor. When this parameter is not present, the old
scale factor is assumed. scfac must be > 0.001 and < 10,000
xc (float)
New X screen center. When this parameter is not present, the old X screen
center is assumed.
Page 153
154
yc (float)
New Y screen center. When this parameter is not present, the old Y screen
center is assumed.
vpnum (ival)
Viewport number:
-1 = All viewports
0 or default = Primary viewport
positive number = Designated viewport
System Variables Set:
@ERROR
0 = No error
1 = Invalid viewport
SET
SET allows for a number of system parameters to be set through CADL file execution.
Format:
SET keyword [, val1, val2, ...]
Input Parameters:
keyword - represents one of the following words:
arrdir
arrstyle
cdlpath
collective
collsel
color
conaxes
const
coord
curtrack
cview
depth
devin
devout
dimfill
dimfont
dimht
dimslant
draword
dspaxes
grid
gridinc
immcom
leader
level
levelmask
limit
linetype
linewidth
mask
maskcol
maskent
masklevel
maskltype
masklwidth
maskpen
Page 154
155
noteang
notefill
notefont
noteht
noteline
noteslant
noteuline
notpath
pen
pltpath
precision
prtpath
ptnpath
snap
snapinc
textasp
unit
versel
view
witness
Upper or lower case letters are accepted.
Explanations of each SET command supported are detailed on the following pages.
Page 155
156
Page 156
157
Page 157
158
Sets the current dimension text font. This performs the same function as choosing the DF=
option in the Status Window. All subsequently created dimensions will use the specified font.
Font styles -1 through -16 refer to new style fonts. Use of these fonts allows the fill mode and
slant angle to be set independently. Font styles 1 through 6 are old style fonts defined as follows:
1=
2=
3=
4=
5=
6=
Box
Slant
Bold box filled
Bold slant filled
Bold box
Bold slant
Page 158
159
- Grid X increment
- Grid Y increment
- Grid X alignment
- Grid Y alignment
Controls the alignment position as well as the increment of the grid. If an alignment parameter is
omitted, the default is zero.
Page 159
160
Sets the current line segment termination mode of the CADKEY line creation function. This
performs the same function as using the system's Immediate Mode command. If set to 0, the line
endpoints will be coincident with the positions specified via cursor position, end of entity, etc. If
set to 1, line segments are extended through the specified positions and terminate at the
intersection with the boundary of the viewport of definition.
Solid
Dashed
Center line
Phantom line
Defines the system's current line type for arc, circle, line, polygon, polyline and spline entities.
This performs the same function as using the Immediate Mode command, or using the cursor to
select the L-TYPE= option in the Status Window. All subsequently created entities will have this
line type assigned.
= Point
= Line
= Arc (circle)
= Conic
= Spline (2d and 3d)
= Polygon
= Polyline
= Linear dimension
= Radial dimension
= Diametrical dimension
14 = Angular dimension
15 = Note
16 = Label
17 = Leader
18 = Witness
19 = Cross hatch
20 = Generic dimension
21 = Ordinate dimension
22 = Disk note
= Color 0
= Color 1
= Color 15
Page 160
161
Sets the selection color mask for any subsequent CADL command that invokes the CADKEY
entity selection mechanism (i.e., GETENT, GETENTM, etc.). The mask is reset whenever a
selection occurs or an exit is made from CADL.
0 = Point
bit
1 = Line
bit
2 = Arc
bit
3 = Spline bit
4 = Polygon bit
5 = Polyline bit
6 = Conic
bit
7 = Reserved
8
9
10
11
12
13
14
=
=
=
=
=
=
=
Sets the selection entity mask for any subsequent CADL command that invokes the CADKEY
entity selection mechanism (i.e., GETENT, GETENTM, etc.). The mask is reset whenever a
selection occurs or an exit is made from CADL.
0=
1=
2=
3=
Solid
Dashed
Center line
Phantom line
Sets the selection line type mask for any subsequent CADL command that invokes the CADKEY
entity selection mechanism (i.e., GETENT, GETENTM, etc.). The mask is reset whenever a
selection occurs or an exit is made from CADL.
SET masklwidth,
mask
bit
bit
bit
.
.
bit
0
2
4
= Width 1
= Width 3
= Width 5
14
= Width 15
Sets the selection line width mask for any subsequent CADL command that invokes the
CADKEY entity selection mechanism (i.e., GETENT, GETENTM, etc.). The mask is reset
whenever a selection occurs or an exit is made from CADL.
Page 161
162
Box
Slant
Bold box filled
Bold slant filled
Bold box
Bold slant
Page 162
163
Sets the current text line spacing factor for notes and labels. This factor times the character
height equals the distance between the lines of text. All subsequently created notes, disk notes,
and labels will use this factor.
Page 163
164
- Snap X increment
- Snap Y increment
- Snap X alignment
- Snap Y alignment
Controls the alignment position as well as the increment of the cursor snap. If an alignment
parameter is omitted, the default is zero.
Page 164
165
Both
First
Second
None
Controls the display of witness lines in dimensions. This performs the same function as using the
system's Immediate Mode command or choosing the WIT: option in the Status Window. All
subsequently created dimensions will use this witness line display mode.
SETATTR
SETATTR sets the attributes of the specified entity. The parameterscorrespond one-to-one to the
attributes as defined by the most recentDEFATTR command (refer to DEFATTR). If a parameter
is omitted,the corresponding attribute is left unchanged. Parameters which do not apply to a
particular entity type are ignored. If a visual attribute ischanged, the entity must be redrawn for
the change to appear.
Format:
SETATTR [id], [val1], [val2], ...
Input Parameters:
id (ival)
Entity ID. If omitted, the currently selected entity is used. If set to -1, the
attributes will be applied to all entities in the selection list.val1 First attribute value
val2
0-15
0-255
0-128
1-255
1-4
1-15
1-8
0-256
0.0-360.0
0.01-100.0
0-1
Page 165
166
TEXTFONT (ival):
1-15
TEXTHT (fval):
0.0005-10000.0
TEXTLINE (fval):
any value
TEXTMIR (ival):
0-1
TEXTSLANT (ival):
-31 through +31
TEXTULINE (ival):
0-1
Line types
1=
2=
3=
4=
0 = Disable
1 = Enable
Solid
Dashed
Center line
Phantom line
Please note that setting either GRPNUM or SUBGRP to zero causes both attributes to be set to
zero.
System Variables Set:
@ERROR(ivar)
Error code:
0 = No error
1 = ID not found or no entity currently selected
Example:
DEFATTR COLOR, LTYPE, LWIDTH
SETATTR 23, 5, 1, 1
SETATTR 24, , 1, 1
SETATTR 25, 5, 1, 1
This changes the entities having IDs 23 and 25 to have a color of 5, a solid line type, and a line
width of 1. The entity with ID 24 will have its line type and line width changed similarly but not its
color.
SETCUR
SETCUR sets the display of the current graphics cursor position to the specified view coordinate
position.
Format:
SETCUR x, y, [vpnum]
Input Parameters:
x (float)
Cursor X position
y (float) Cursor Y position
vpnum (ival)
Viewport number:
0 or default = Cursor positioned within primary viewport
positive number = Cursor positioned within the specified viewport
System Variables Set:
@ERROR
0 = No error
1 = Invalid viewport
Page 166
167
SETNOTE
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.
Format:
SETNOTE [ht], [asp], [rot], [font], [slnt], [fill], [lnsp], [uln]
Input Parameters:
ht (float)
Text height in working units
ht must be >= 0.005 and <= 10,000
asp (float)
Aspect ratio of text (width/ht)
asp must be >= 0.01 and <= 100
rot (float)
Rotation angle (in degrees)
rot must be >= 0 and <= 360
font (integer) Font number. A value between -16 and -1 indicates a new style font. A value
between 1 and 6 indicates an old style font where:
1 = Box
2 = Slant
3 = Bold box filled
4 = Bold slant filled
5 = Bold box
6 = Bold slant
slnt (ival)
Slant angle in degrees (ignored if old style font specified)
slnt must be >= -31 and <= 31
fill (ival)
lnsp (fval)
Line spacing factor. The distance between lines of text equals this factor times
the character height.
uln (ival)
Underline flag
0 = No underline
1 = Underline
SPLINE
The SPLINE data primitive describes a 2D or 3D cubic parametricspline in one of two ways:
1)
2)
Using the coefficients of the cubic polynomial equations of each spline segment, where a
segment is a piece of the curve between two node points. For reference, the equation used to
describe a CADKEY cubic parametric spline for any segment is:
xi = axi * u3 + bxi * u2 + cxi * u + dxi
Page 167
168
arrayname (word)
Name of the 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.
The format of the data contained in arrayname is as follows:
For typecode = P2NN:
arrayname
Page 168
169
..
..
[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 typecode = P2VN:
arrayname
Page 169
170
numpts (integer)
Number of node points in spline
(open splines: >= 2 and <= 201,
closed splines: >=3 and <=200 )
depth (double)
vnum (integer) VIEW primitive reference number for spline's definition view. The VIEW
primitive referenced must precede the spline primitive or the spline primitive will be ignored. To
use the current system view set this parameter to 0 (zero).
col (integer)
Color assigned to the spline entity
1-15 = Number in the system color palette
0 = Use current system color
lev (integer)
Level number assigned to the spline entity
1-255 = System level number
0 = Use current system level
ltype (integer) Line type number assigned to spline entity:
1 = Solid
2 = Dashed
3 = Center line
4 = Phantom line
0 = Use current system line type
grpnum (integer)
subgrp (integer)
Note : If you wish to specify a group, you must include both the group and the subgroup
number. If either of these arguments is missing, both of them will be ignored.
pen (integer)
Pen number assigned to spline entity
1-8 = Pen number
0 = Use current system pen number
lwdt (integer) Line width to assign to spline entity.
1-15 (odd only) = Line width
0 = Use current system line width
Usage 2
Format:
SPLINE typecode, arrayname, numpts, [col], [lev], [ltype], [grpnum], [subgrp], [pen], [lwdt]
Input Parameters:
typecode (word)
arrayname (word)
Name of the 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.
The format of the data contained in arrayname is as follows:
For typecode = P3NO:
Page 170
171
arrayname
[0][0] = X1 (X value for node point #1 in world coordinates)
[0][1] = Y1 (Y value for node point #1 in world coordinates)
[0][2] = Z1 (Z value for node point #1 in world coordinates)
...
...
[n-1][0] = Xn (X value for node point n in world coordinates)
[n-1][1] = Yn (Y value for node point n in world coordinates)
[n-1][2] = Zn (Z value for node point n in world coordinates)
For typecode = P3VN or P3NV:
arrayname
[0][0] = X1 (X value for node point #1 in world coordinates)
[0][1] = Y1 (Y value for node point #1 in world coordinates)
[0][2] = Z1 (Z value for node point #1 in world coordinates)
...
...
[n-1][0] = Xn (X value for node point n in world coordinates)
[n-1][1] = Yn (Y value for node point n in world coordinates)
[n-1][2] = Zn (Z value for node point n in world coordinates)
[n][0] = XV (X tangent vector component value for start or end of spline in world coordinates)
[n][1] = YV (Y tangent vector component value for start or end of spline in world coordinates)
[n][2] = ZV (Z tangent vector component value for start or end of spline in world coordinates)
For typecode = P3VV:
arrayname
[0][0] = X1 (X value for node point #1 in world coordinates)
[0][1] = Y1 (Y value for node point #1 in world coordinates)
[0][2] = Z1 (Z value for node point #1 in world coordinates)
...
...
[n-1][0] = Xn (X value for node point n in world coordinates)
[n-1][1] = Yn (Y value for node point n in world coordinates)
[n-1][2] = Zn (Z value for node point n in world coordinates)
[n][0] = XV1 (X tangent vector component value for start of spline in world coordinates)
[n][1] = YV1 (Y tangent vector component value for start of spline in world coordinates)
[n][2] = ZV1 (Z tangent vector component value for start of spline in world coordinates)
[n+1][0] = XV2 (X tangent vector component value for end of spline in world coordinates)
[n+1][1] = YV2 (Y tangent vector component value for end of spline in world coordinates)
[n+1][2] = ZV2 (Z tangent vector component value for end of spline in world coordinates)
For typecode = P3C (n points will result in a closed spline of n segments):
arrayname
[0][0] = X1 (X value for node point #1 in world coordinates)
[0][1] = Y1 (Y value for node point #1 in world coordinates)
[0][2] = Z1 (Z value for node point #1 in world coordinates)
...
...
[n-1][0] = Xn (X value for node point n in world coordinates)
[n-1][1] = Yn (Y value for node point n in world coordinates)
[n-1][2] = Zn (Z value for node point n in world coordinates)
numpts (integer)
Page 171
172
col (integer)
lev (integer)
ltype (integer) For a full description of these parameters, refer to Usage 1.
grpnum (integer)
subgrp (integer)
pen (integer)
lwdt (integer)
Usage 3
Format:
SPLINEtypecode, arrayname, numcoefs, depth, [vnum], [col], [lev], [ltype], [grpnum], [subgrp],
[pen], [lwdt]
Input Parameters:
typecode (word)
C2 (open), C2C (closed)
arrayname (word)
Name of the 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.
The format of the data contained in arrayname is as follows:
For typecode = C2, C2C:
arrayname
[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)
numcoefs (integer) number of coefficient sets supplied ( >= 1 and <= 200 )
depth (double)
vnum (ival)
col (integer)
lev (integer)
For a full description of these parameters, refer to
Usage 1.
ltype (integer)
grpnum (integer)
Page 172
173
subgrp (integer)
pen (integer)
lwdt (integer)
Usage 4
Format:
SPLINE typecode, arrayname, numcoefs, [col], [lev], [ltype], [grpnum], [subgrp], [pen], [lwdt]
Input Parameters:
typecode (word)C3 (open), C3C (closed)
arrayname (word)
Name of the 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.
The format of the data contained in arrayname is as follows:
For typecode = C3, C3C:
arrayname
[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)
numcoefs (integer) number of coefficient sets supplied ( >= 3 and <= 200 )
col (integer)
lev (integer)
For a full description of these parameters, refer to Usage 1.
ltype (integer)
grpnum (integer)
Page 173
174
subgrp (integer)
pen (integer)
lwdt (integer)
SPRINT
SPRINT 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.
Format:
SPRINT str, format [, val1, ...]
Input Parameters:
format (string) Format control string
val1 (val)
Output Parameter:
str (string)
Variable to store return string. Variable name must begin with a '$' character. The
returned string will be a null terminated array of characters.
sys_addvp
The sys_addvp command adds a viewport to CADKEY's drawing area. The viewport is defined
in normalized device coordinates (NDC). If the new viewport overlaps any existing viewports, an
error is returned and the viewport is not added. The total number of viewports cannot exceed the
limit set in the configuration program.
Format:
sys_addvp xl, yl, xu, yu
Input Parameters:
xl (double)
X value of lower left corner in NDC
yl (double)
xu (double)
yu (double)
Page 174
175
sys_autovp
The sys_autovp command sets up CADKEY's graphics area to one of the eight standard
viewport configurations. The code for the desired configuration and the number for primary view
port have to be provided as arguments. If the primary viewport number is out of range, the firs
tviewport is used.
Format:
sys_autovp code, prime
Input Parameters:
code (integer) Viewport configuration code:
0 = Single
1 = 2 Vertical
2 = 2 Horizontal
3 = 2 Left, 1 Right
4 = 1 Left, 2 Right
5 = 2 Bottom, 1 Top
6 = 1 Bottom, 2 Top
7 = Quad
prime (integer) Primary viewport number
System Variables Set:
@ERROR
0
= No error
-26
= Bad viewport code
-32
= Insufficient number of viewports available
sys_delvp
The sys_delvp command deletes a viewport from CADKEY's graphicsarea. If the primary
viewport is deleted, the lowest numbered viewport becomes the primary viewport. It is possible
to delete all viewports from the screen. This could be useful for custom configuration of
viewports.
Format:
sys_delvp vpnum
Input Parameter:
vpnum (integer)
Viewport number
sys_get_name
The sys_get_name command allows you to inquire about the descriptor (name) of an existing
view or level.
Format:
sys_get_name item, number, $name
Input Parameters:
Page 175
176
sys_inqtbsize
The sys_inqtbsize command is used to find out the NDC size of a text box of rows and columns.
This information can be useful when resizing a viewport so that it does not overlap a dialog box.
Format:
sys_inqtbsize numrow, numcol, xsize, ysize
Input Parameters:
numrow (integer)
numcol (integer)
Output Parameters:
xsize (double) NDC x size
ysize (double) NDC y size
System Variables Set:
@ERROR
0
= No error
-26
= Invalid number of rows or columns
-35
= Specified text box is too big
sys_inqvpdef
The sys_inqvpdef command is used to find out the definition coordinates of a viewport, based on
the graphics viewport. The viewport is specified by its number and the NDC coordinates are
returned in the variables provided.
Format:
sys_inqvpdef vpnum, xl, yl, xu, yu
Input Parameter:
vpnum (integer) Viewport number
Output Parameters:
xl (double)
X value of lower left corner
Page 176
xu (double)
177
yu (double)
Y value of upper right corner
System Variables Set:
@ERROR
0
= No error
-32
= Specified viewport doesn't exist
sys_inqvpinfo
The sys_inqvpinfo command is used to find out the viewport configuration mask and the number
of the primary viewport. The viewport configuration is stored as a character bitmask toindicate
which viewports are active. The first bit (bit 0) corresponds to viewport number 1, the second bit
(bit 1) corresponds to viewport number 2 and so on. When the mask is read using the
sys_inqvpinfo command, a 1 in a viewport's bit indicates it is active. When a new viewport is
added, it uses the lowest order bit available. When a viewport is deleted its corresponding bit in
the mask is set to zero. The command also returns the total number of available viewports.
Format:
sys_inqvpinfo mask, prime
Output Parameters:
Mask[32] (char) Viewport mask
prime (integer) Primary viewport number
System Variables Set:
@ERROR
Number of available viewports
sys_movevp
An existing viewport can be resized or moved using the sys_movevp command. The viewport is
specified by its number, and new values for its lower-left and upper-right corners are provided.
To resize a viewport, inquire its coordinates using the INQVPDEF command and reuse these
values for one corner. A viewport cannot be moved or resized to overlap other viewports.
Format:
sys_movevp vpnum, xl, yl, xu, yu
Input Parameters:
vpnum (integer) Viewport number
xl (double)
yl (double)
xu(double)
yu (double)
= No error
Page 177
178
sys_prt_close
** MDI Only function**
The sys_prt_close command part a part file in CADKEY. The part closed is the currently active
part.
Format:
sys_prt_close askSave
Input Parameters:
askSave (integer)
sys_prt_desc_inq
The sys_prt_desc_inq command allows you to read the descriptor (name) of a currently loaded
part file. It is necessary to allocate sufficient memory for the descriptor.
Format:
sys_prt_desc_inq $desc
Input Parameters:
none
Output Parameter:
$desc (string) Part file descriptor
The maximum possible length of $desc is equal to 512. Anything longer than this will be
truncated.
System Variables Set:
@ERROR
-37 = Bad part file opened
-36 = No error
sys_prt_desc_set
sys_prt_desc_set allows you to modify the descriptor (name) of a currently loaded part file.
Format:
sys_prt_desc_set $desc
Input Parameter:
$desc (string) Part file descriptor
The maximum possible length of $desc is equal to 30. Anything longer than this will be
truncated.
Page 178
179
Output Parameters:
none
System Variables Set:
@ERROR
-9
= Error writing to part file
-10
= Error reading from part file
-36
= No error
-37
= Bad part file opened
sys_prt_load
The sys_prt_load command loads a part file in CADKEY.The return values -2, -5, and -25 are
warnings. They indicate the condition of the loaded part file. Other return values are errors. The
part file is not loaded if an error occurs.
Format:
sys_prt_load $fname
Input Parameter:
$fname (string) Part file name
System Variables Set:
@ERROR
0
= No error
-1
= Cannot build part file name
-2
= Locked by someone else
-5
= File is read-only
-7
= No environment space
-8
= Part file open error
-10
= Part file read error
-11
= Seek error
-15
= Unexpected entity
-16
= Work file open error
-17
= Name file open error
-18
= Work file output error
-19
= Name file output error
-20
= Work file input error
-21
= Name file input error
-22
= Wrong part file version
-23
= Not a part file
-24
= Part file not found
-25
= Can't lock file
sys_prt_save
The sys_prt_save command saves a CADKEY part file. The part file can be locked while saving
it by setting the lock flag to 1. If the overwrite flag is set to 1, any existing part file with the same
name will be overwritten.
Format:
sys_prt_save $name, lock, force
Input Parameters:
$fname (string) Part filename
Page 179
180
sys_ptn_load
The sys_ptn_load command loads a pattern file into CADKEY. All options in CADKEY's
interactive pattern load function are available as arguments for this command. The view in
which the pattern is brought in can be specified in two ways. Either the view number of an
existing view can be provided, or a view matrix can be provided as a nine-element onedimensional array. The view matrix must meet all criteria of CADKEY's view matrices. (Refer to
the VIEW command for more detail.)
Format:
sys_ptn_load $fname, $gname, subgrp, lev_opt, lev, scl, rot, vnum, vmat,
x, y, z
Input Parameters:
$fname (string) Pattern filename
$gname (string) Group name
subgrp (integer) Subgroup number
Note : If you wish to specify a group, you must include both the group name and the subgroup
number. If the group name is a null string or the subgroup number is missing, the entities will not
be grouped.
lev_opt (integer)
Level option
1 = Current level
2 = Entity level
3 = New level
4 = Level offset
Page 180
181
lev (integer)
New level number if lev_opt was set to 3; or level offset if option 4 was used
scl (double)
Scale for pattern
rot (double)
Rotation angle in degrees
vnum (long)
View number to use if no view matrix is provided
vmat[9] (double)
View matrix
NULL = use view number
x (double)
X value of base point in view coordinates of specified view
y (double)
Y value of base point in view coordinates of specified view
z (double)
Z value of base point in view coordinates of specified view
System Variables Set:
@ERROR
0
= No error
-1
= Can't build pattern filename
-8
= Pattern file open error
-10
= Pattern file input error
-11
= Seek error
-15
= Unexpected entity
-22
= Wrong pattern file version
-23
= Not a pattern file
-26
= Bad value for fname, gname, subgrp,
lev_opt, lev or scl option
-28
= Bad view matrix
-29
= Bad view number
-30
= Level offset causes invalid level
-31
= No room for new group
sys_ptn_save
The sys_ptn_save command saves a CADKEY pattern file. The entities for the pattern can be
specified by a list of IDs or the selection list. The selection list is built using the GETENTM or
GETALL command. The view in which the pattern is created can be specified in two ways.
Either the view number of an existing view can be provided, or a view matrix can be provided as
a nine-element one-dimensional array. The view matrix must meet all criteria of CADKEY's view
matrices (refer to the VIEW command in the Primitives section for more detail). If the overwrite
flag is set to 1, any existing pattern file with the same name will be over written.
Format:
sys_ptn_save $fname, numid, id, vnum, vmat, x, y, z, force
Input Parameters:
$fname (string)
Pattern filename
numid (integer)
Number of entity IDs
-1 = Use selection list
id[] (ulong)
Entity IDs (NULL when using selection list)
vnum (long)
View number to use if no view matrix is provided
vmat[9] (double)
View matrix (NULL when using view number)
x (double)
X value of base point
y (double)
Y value of base point
z (double)
Z value of base point
force (integer)
Overwrite flag:
0 = Do not overwrite existing pattern file
1 = Overwrite any existing pattern file
System Variables Set:
@ERROR
0
= No error
Page 181
=
=
=
=
=
=
=
=
=
=
182
sys_put_name
sys_put_name allows you to set the descriptor (name) of an existing view or a level.
Format:
sys_put_name item, number, $name
Input Parameters:
item (integer) Item type:
1 = Level name is to be set
2 = View name is to be set
number (long) Level or view number
$name (string) Level or view name
The maximum possible length of name is equal to 30. Any name longer than this will be
truncated.
System Variables Set:
@ERROR
0
= No error
-26
= Bad level or view number
-24
= Level or View not defined
VIEW
The VIEW primitive describes the plane 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 VIEW primitive must precede the planar primitive referencing it. When a CADL file is read in
and executed by the system, a check is performed to see if a new view must be created in the
part database each time a VIEW primitive is encountered.
Format:
VIEW refno, t1, t2, t3, t4, t5, t6, t7, t8, t9
Input Parameters:
refno (integer) View number in CADL for other primitives to reference. This typically should be
used as an index to which views CADL has created. (i.e. 1 for the first view command. 2 for the
second command etc.)
t1 - t9 (double) Elements in the rotation matrix are in the following order:
Page 182
t2
t5
t8
183
t3 |
t6 |
t9 |
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 following characteristics apply to the view 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
|
|
|
cos Y
0
-sin Y
0
1
0
sin Y
0
cos Y
|
|
|
cos Z
sin Z
0
-sin Z
cos Z
0
0
0
1
|
|
|
VLINE
The VLINE primitive describes the two endpoints of a line in X, Y, Z view coordinates.
When a VLINE primitive is read from a CADL file, this primitive is stored in the system's
database as a line entity.
When a line entity is written to a CADL file, it is output as a VLINE primitive provided that 2D
construction mode is in effect. If this switch is set for 3D, line entities are dumped as LINE
primitives. When a VLINE primitive is output, a VIEW primitive is output first (if necessary)
which the VLINE primitive may reference as the view that its coordinates are described in.
The line length itself must be greater than or equal to 0.0005, and less than or equal to 10,000.
Format:
VLINE x1, y1, z1, x2, y2, z2, [vnum], [col], [lev], [ltype], [grpnum], [subgrp], [pen], [lwdt]
Page 183
184
Input Parameters:
x1 (double)
X value of the first endpoint in view coordinates
y1 (double)
z1 (double)
x2 (double)
coordinates
y2 (double)
coordinates
z2 (double)
coordinates
vnum (integer) VIEW primitive reference number. The VIEW primitive referenced must precede
this primitive or an error message is displayed and the program is terminated.
0 = Use current system view in effect
col (integer)
Color
0-15 = Number in the system color palette
lev (integer)
Level number
1-255 = System level number
0 = Use current system level in effect
ltype (integer) Line type:
1 = Solid
2 = Dashed
3 = Center line
4 = Phantom line
0 = Use current system line type in effect
grpnum (integer)
Group reference number
1-127 = Group number
0 = No group assignment
subgrp (integer)
Subgroup reference number
1-256 = Subgroup number
0 = No subgroup assignment
Note : 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.
pen (integer)
Pen number
1-8 = Pen number
0 = Use current system pen number in effect
lwdt (integer) Line width
1-15 = Odd line width
0 = Use current system line width in effect
Page 184
185
VPOINT
The VPOINT primitive describes an X,Y location in view coordinates. When a VPOINT primitive
is read from a CADL file, this primitive is stored in the system's database as a point entity. When
a point entity is written to a CADL file, it is output as a VPOINT primitive provided that 2D
construction mode is in effect. If this switch is set to 3D, the point entities are dumped as POINT
primitives. When a VPOINT primitive is output, a VIEW primitive is output first (if necessary)
which the VPOINT primitive may reference as the view that its coordinates are described in.
Format:
VPOINT x, y, z, vnum, [col], [lev], [grpnum], [subgrp], [pen]
Input Parameters:
x (double)
X value of point in view coordinates
y (double)
z (double)
vnum (integer) VIEW primitive reference number. The VIEW primitive referenced must precede
this primitive or an error message is displayed and the program is terminated.
0 = Use current system view in effect
col (integer)
Color
0-15 = Number in the system color palette
lev (integer)
Level number
1-255 = System level number
0 = Use current system level in effect
grpnum (integer)
Group reference number
1-127 = Group number
0 = No group assignment
subgrp (integer)
Subgroup reference number
1-256 = Subgroup number
0 = No subgroup assignment
Note : 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.
pen (integer)
Pen number
1-8 = Pen number
0 = Use current system pen number in effect
VPOLYGON
A VPOLYGON primitive describes a polygon of up to eightvertices, all of which must lie in a
plane.
When a VPOLYGON primitive is read from a CADL file, this primitive is stored in the system's
database as a polygon entity. All polygon entities are output to CADL as polygon primitives
regardless of the 2D/3D switch.
Page 185
186
Format:
VPOLYGON filltype, fillcolor, numpts, arrayname, depth, [vnum], [col], [lev], [ltype], [grpnum],
[subgrp], [pen]
Input Parameters:
ftype (integer) Fill type
1 = Unfilled
2 = Filled
fcol (integer)
Color of polygon if filled. Otherwise, color of outline is specified by col.
Range of fcol is from 0-255.
numpts (integer)
8,
respectively.
arrayname (string)
follows:
arrayname
First and last point need not be identical to force closure; closure is automatic. Polygon is
created in view defined by vnum at the z position specified by depth.
depth (double) Z depth of polygon
vnum (integer) VIEW primitive reference number. The VIEW primitive referenced must precede
this primitive or an error message is displayed and the program is terminated.
0 = Use current system view in effect
col (integer)
Polygon border color
0-15 = Number in the system color palette
lev (integer)
Level number
1-255 = System level number
0 = Use current system level in effect
ltype (integer) Line type:
1 = Solid
2 = Dashed
3 = Center line
4 = Phantom line
0 = Use current system line type in effect
grpnum (integer)
Group reference number
1-127 = Group number
0 = No group assignment
subgrp (integer)
Subgroup reference number
1-256 = Subgroup number
0 = No subgroup assignment
Page 186
187
Note : 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.
pen (integer)
Pen number
1-8 = Pen number
0 = Use current system pen number in effect
WAIT
WAIT suspends a CADL file execution for a specifiednumber of seconds.
Format:
WAIT numsec
Input Parameter:
numsec (fval)
WINDOW
WINDOW performs a zooming function on the current part displayed, which is the equivalent of
using the Immediate Mode command. An automatic redraw is not performed.
Format:
WINDOW xmin, ymin, xmax, ymax, [vpnum]
Input Parameters:
xmin (float)
X minimum value of window size in display view coordinates
ymin (float)
xmax (float)
ymax (float)
vpnum (ival)
Viewport number:
-1 = All viewports windowed according to indicated coordinates
0 or default = Primary viewport windowed according to indicated coordinates
Positive number = Only designated viewport
System Variables Set:
@ERROR
0 = No error
1 = Invalid viewport
WITNESS
The WITNESS primitive describes the geometry found in a CADKEY witness line entity. When a
WITNESS primitive is read from a CADL file, a witness line entity is created in the database.
When a witness line entity is written to a CADL file, a VIEW primitive is output first (if necessary)
which the WITNESS primitive may reference as its assigned plane.
Page 187
188
Format:
WITNESS x1, y1, x2, y2, [vnum], [col], [lev], [ltype], [grpnum], [subgrp], [pen]
Input Parameters:
x1 (double)
X value of witness line's endpoint 1 in view coordinates
y1 (double)
x2 (double)
y2 (double)
vnum (integer) VIEW primitive reference number. The VIEW primitive referenced must precede
this primitive or an error message is displayed and the program is terminated.
0 = Use current system view in effect
col (integer)
Color
0-15 = Number in the system color palette
lev (integer)
Level number
1-255 = System level number
0 = Use current system level in effect
ltype (integer) Line type:
1 = Solid
2 = Dashed
3 = Center line
4 = Phantom line
0 = Use current system line type in effect
grpnum (integer)
Group reference number
1-127 = Group number
0 = No group assignment
subgrp (integer)
Subgroup reference number
1-256 = Subgroup number
0 = No subgroup assignment
Note: 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.
pen (integer)
Pen number
1-8 = Pen number
0 = Use current system pen number in effect
WRITE
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.
Processing of the file specification is as follows:
Page 188
189
1)
If the specification does not include a path, the directory used is the default directory for
CADL programs (set with the CONFIG program).
2)
If a full path is included, the specified directory is used.
3)
If the specification includes a relative path, the specified directory is relative to the
current working directory.
Four file open modes are supported:
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 -
Mode 3 -
appends data similarly to mode 1, but doesn't create the file if it doesn't exist.
Format:
WRITE fname, mode, var1 [, var2, ...]
Input Parameters:
fname (word) Data file specification
mode (ival)
Open mode:
0 = Overwrite file
1 = Append to end of file
2 = Create new file only
3 = Append to existing file only
var1 (var)
var2 (var)
XHATCH
The XHATCH primitive describes the geometry in a CADKEYcross-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 VIEW primitive is created first (if
necessary) for which the XHATCH primitive may reference as its assigned plane.
Page 189
190
Format:
XHATCH pattern, numlines, arrayname, [vnum], [col], [lev], [ltype], [grpnum], [subgrp], [pen]
Input Parameters:
pattern (integer)
numlines (integer)
arrayname (string)
arrayname
vnum (integer) VIEW primitive reference number. The VIEW primitive referenced must precede
this primitive or an error message is displayed and the program is terminated.
0 = Use current system view in effect
col (integer)
Color
0-15 = Number in the system color palette
lev (integer)
Level number
1-255 = System level number
0 = Use current system level in effect
ltype (integer) Line type:
1 = Solid
2 = Dashed
3 = Center line
4 = Phantom line
0 = Use current system line type in effect
grpnum (integer)
Group reference number
1-127 = Group number
0 = No group assignment
subgrp (integer)
Subgroup reference number
1-256 = Subgroup number
0 = No subgroup assignment
Note : 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.
pen (integer)
Pen number
1-8 = Pen number
0 = Use current system pen number in effect
Page 190
191
______________________________________________________________________________
Page 191
192
Introduction to CCOMP
CCOMP is a stand-alone utility that compiles a CADL file and produces a binary version of that
file. Binary files are executed and run two to four times faster, are smaller, and if other files are
used (CHAIN, DOSUB, #INCLUDE files), they are all compacted into a single file.
If the file doesn't contain any compiler specific commands or any compiler directives, the file just
gets compiled into its binary version. However, if there are compiler specific commands in your
code, CCOMP first preprocesses the file into a version that doesn't have any compiler specific
code in it. Then this new file is compiled into its binary form.
If your program doesn't contain any compiler specific commands or compiler directives, you can
use a .cdl file extension. If it contains either of these, you must use a .cdp extension. A file with
a .cdp file extension is preprocessed before it is compiled, while a .cdl file is compiled without
the preprocessing phase. Keep in mind, however, if your program uses other files, through
CHAIN or DOSUB, and some of these files need to be preprocessed while some don't, you must
use a .cdp extension on all of them. This is because CCOMP assumes the extensions of all
subroutine files are the same as the input file. After a file is compiled, it is given a .cdx file
extension.
When CCOMP preprocesses a .cdp file, it actually creates a .cdl file which is then compiled.
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. Normally CCOMP will delete this intermediate .cdl
file after the .cdx file is create, but you can save it through the use of various options.
CCOMP Files
To compile CADL files, you need two executable files, CCOMP.EXE and CCOMP1.EXE, and one
text file, CCOMP.TXT. Although the two executable files can be either in the current working
Page 192
193
directory or in a directory accessible by the system path, the text file must be in the current
working directory. CCOMP is the file you call to compile a program. CCOMP1 is used by
CCOMP for various compiler functions and the text file contains error messages and a command
option summary.
Using CCOMP
Command Line Usage
The command line usage of CCOMP is:
ccomp [ -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.
Page 193
194
-d
This will cause CCOMP 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 CCOMP 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, CCOMP 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 CCOMP 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 CCOMP 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 CCOMP 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.
Page 194
195
-X
When CCOMP 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 CCOMP 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.
As CCOMP 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 CCOMP 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.
The command ccomp -?? will display the following summary of all of these options:
Usage: ccomp [ -CLMNPXdklsu -Bpath -Dcnst[=def] -Idir -nd -ns ] ifile [ ofile ]
-Bpath
path of base directory
-C
compiler phase only
-Dcnst
define a constant
-Idir
include file directory
-L
list $label and switch variable usage (preprocessor phase)
-M
mixed output to .cdl files
-N
no linking to chain/dosub files (only if -P set)
-P preprocessor phase only
-X exclude #line references to .cdp files in .cdl files
-d
delete .cdl files
(default if -C -M -P and -u NOT set and source is .cdp file; -s overrides default)
-k
process kanji characters
-l
list variable usage (compiler phase)
-nd
no double data optimization
-ns
no string data optimization
-s
save .cdl files
(default if -C -M -P or -u set or source is .cdl file; -d overrides default)
-u
update mode
ifile
input file (.cdp or .cdl forced)
ofile
output file (.cdx forced)
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 CCOMP utility before execution.
Page 195
196
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.
#DEFINE
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.
Format:
#DEFINE identifier substitution-text
#IFDEF
#IFNDEF
#ELSE
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.
Format:
Page 196
197
#IFDEF identifier
#IFNDEF identifier
.
.
.
.
code-block 1
code-block 1
.
.
.
.
[#ELSE OR
[#ELSE
.
.
.
.
code-block 2
code-block 2
.
.
.]
]
#ENDIF
#ENDIF
#DEFINE DEBUG
at the beginning of the program or using the -DDEBUG option with the compiler at runtime.
When the PAUSE command is no longer needed, these options can be removed for compilation
without the debugging code. Notice that the actual definition of the DEBUG identifier is not
important for the #IFDEF directive.
#INCLUDE
The purpose of the #INCLUDE directive is to insert the contents of the file specified by the filespec 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.
Format:
#INCLUDE file-spec
#UNDEF
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.
Page 197
198
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.
Format:
#UNDEF identifier
COMMENT STRING
/* ... */ identifies remarks. These characters, as well as any text included between them, are
ignored by the system when a CADL file is executed. This can also be used to temporarily
prevent a section of code from being compiled.
Format:
/* comment string */
IF...ELSE IF...ELSE
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.
Page 198
199
Format:
IF (expr)
{
statement-block
}
[ ELSE IF (alt-expr)
{
statement-block
}]
[ ELSE
{
statement-block
}]
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
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.
Format:
CONTINUE
DOWHILE
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.
Format:
Page 199
200
DO
{
.
.
statement-block
.
.
} WHILE (expr)
This program segment only proceeds from the menu when either YES or NO is selected.
Escape, Backup and Enter will not break this loop.
EXITLOOP
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.
Format:
EXITLOOP
FOR
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.
Format:
FOR ([expr1]; [expr2]; [expr3])
{
.
.
statement-block
.
Page 200
201
.
}
WHILE
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.
WHILE
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.
Format:
WHILE (expr)
{
.
.
statement-block
.
.
}
LOCAL
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).
Format:
LOCAL var1, var2,
SWITCH
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.
Page 201
202
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.
Format:
SWITCH (expr)
{
CASE const-expr
statement-block
[ BREAK ]
[ CASE low:high
statement-block
[ BREAK ]
]
[ DEFAULT
statement-block ]
}
Page 202
203
APPENDICES
This section contains supplemental information which is referenced within the CADL
documentation.
APPENDIX I:
APPENDIX II:
APPENDIX III:
APPENDIX IV:
APPENDIX V:
APPENDIX VI:
Page 203
204
Bad syntax
The statement contains a syntax error.
CDE Errors
Errors in CDE call.
Page 204
205
Page 205
206
Premature EOF on IF
While processing an IF statement that has a false logical value, the end of the file has been
reached before all true statements could be skipped.
Record overflow
The statement being parsed has overflowed the buffer. Simplify the statement.
String overflow
Text string(s) too long. The total number of characters for text strings exceeds allowable storage.
Shorten strings.
Page 206
207
@DIMINFO1
DIMINFO1 is an array of flag settings and integer values that are used for dimension entities.
Some fields are reserved for future use.
@DIMINFO1[0] This field is reserved for future use
@DIMINFO1[1] Witness lines to be displayed:
0 = Both witness lines to be displayed
1 = First witness line to be displayed
2 = Second witness line to be displayed
3 = No witness lines to be displayed
@DIMINFO1[2] Leader line styles:
0 = Both leader lines
1 = First leader line
2 = Second leader line
3 = No leader lines
4 = Solid leader line
5 = First leader line to be solid
6 = Second leader line to be solid
Page 207
208
7 = No arrows
@DIMINFO1[3] Direction of arrows:
0 = Arrows inward
1 = Arrows outward
@DIMINFO1[4] Dimension mode (the system of measurement):
2 = Decimal system (e.g. 0.3, 13. 523, etc. )
3 = Fractional system (e.g. 3/4, 1/2, etc.)
4 = Feet and inch system
5 = Degrees. This is useful only for angular measurements
6 = Degree, Minutes and Seconds system
@DIMINFO1[5] Dimension units:
0 = Inches
1 = Millimeters
2 = Feet
3 = Centimeters
4 = Yards
5 = Meters
6 = Degrees
@DIMINFO1[6] Tolerance type:
0 = No tolerance
1 = +/- tolerance values in 2 lines
2 = Limits
3 = +/- values in 1 line
4 = +/- values in 2 lines. Top only for dual dimensioning
5 = +/- values in 2 lines Bottom only for dual dimensioning
@DIMINFO1[7] Single line tolerance flag:
0 = DO NOT display the + and - tolerance in one line (if equal)
1 = Display the + and - tolerance value in one line (if equal)
@DIMINFO1[8] ASCII value of the decimal character. It is 46 for '.'
@DIMINFO1[9] Text position flag:
0 = Solid leaders NOT used. Text will be above leader
1 = Solid leaders used. Text will be below leader
@DIMINFO1[10]
Flag for automatic center dimension:
0 = DO NOT center the dimension automatically
1 = Automatically center the dimension
@DIMINFO1[11]
Dimension text alignment flag:
0 = Text is horizontal
1 = Text is aligned with leader lines
2 = Text is at some angle to leader lines (other than horizontal)
@DIMINFO1[12-13]
@DIMINFO1[14]
A flag to display zero tolerance value with or without
+/- signs:
0 = DO NOT display sign
1 = Display the sign
@DIMINFO1[15]
Page 208
209
@DIMINFO1[19-31]
0.
@DIMINFO2
DIMINFO2 is an array of float values that are used for dimension entities.
@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] Scale for the dimension text value.
@DIMINFO2[3] Roundoff factor when the unit of the dimension is fraction or feet and inches.
@DIMINFO2[4] Scale used for the top of dual dimension.
@DIMINFO2[5] Scale used for the bottom of dual dimension.
@DIMINFO2[6] Positive tolerance value.
@DIMINFO2[7] Negative tolerance value.
@DIMINFO2[8] Angle of witness line. The angle to sheer dimension by.
@DIMINFO2[9] Scale factor used when displaying dual tolerances.
@ENTATT
ENTATT contains all the attribute information for a dimension entity.
@ENTATT[0] Construction view for view-dependent entities
Long value - Construction view number
@ENTATT[1] Color assigned to the entity
0 to 15 - Color number in system palette
@ENTATT[2]
Page 209
210
@FLTDAT
The FLTDAT array contains float data for the entity. The system variable @NUMFLT contains
the size of the FLTDAT array. All entities fill this array with various data.
The detail entities such as Linear dimension, Circular dimension, Ordinate dimension, Angular
dimension, Note, File note and Label fill this array with the following data:
@FLTDAT[0]
@FLTDAT[1]
@FLTDAT[2]
Linear and Ordinate dimensions fill FLTDAT with these three elements plus a fourth one:
@FLTDAT[3]
The Leader entity has only one float data while the Witness entity does not have any float data.
@FLTDAT[0]
@INTDAT
The INTDAT array contains integer data for the entity. The INTDAT array can have different
sizes for different entities. For more detail refer to the Entity Information section. The system
variable @NUMINT contains the number of integers in the INTDAT array.
@LDRLN
A LDRLN array contains information about leader lines. The leader lines are used for
dimensions and leader entities. For each leader line there are 17 values. The first subscript in
the array represents the leader line number.
@LDRLN[0][0] X coordinate of first endpoint of leader line in view coordinate system
Page 210
211
@MSCDAT
The MSCDAT array contains miscellaneous information about an entity. In the current version,
for all entities except GENDIM, the array contains only entity ID information.
@MSCDAT[0] Entity ID
@REFARC
A REFARC array contains information about reference arcs. For the current version the
reference arc is used for circular dimensions only. For each reference arc there are five values.
The first subscript in the array represents the reference arc number.
@REFARC[0][0]
@REFARC[0][1]
@REFARC[0][2]
@REFARC[0][3]
@REFARC[0][4]
@REFARC[n-1][0]
@REFARC[n-1][1]
@REFARC[n-1][2]
@REFARC[n-1][3]
@REFARC[n-1][4]
Page 211
212
@REFLN
A REFLN array contains information about reference lines. For the current version the
reference line is used for linear and angular dimensions only. For each reference line there are
four values. The first subscript in the array represents the reference line number.
@REFLN[0][0]
@REFLN[0][1]
@REFLN[0][2]
@REFLN[0][3]
@REFLN[n-1][0] X coordinate of first endpoint of nth reference line in view coordinate system
@REFLN[n-1][1] Y coordinate of first endpoint of nth reference line in view coordinate system
@REFLN[n-1][2] X coordinate of second endpoint of nth reference line in view coordinate system
@REFLN[n-1][3] Y coordinate of second endpoint of nth reference line in view coordinate system
@REFPNT
A REFPNT array contains information about reference points. For the current version the
reference point is used for linear dimensions only. For each reference point there are two
values. A maximum of three reference points is available.
@REFPNT[0][0]
@REFPNT[0][1]
@REFPNT[1][0]
@REFPNT[1][1]
@REFPNT[2][0]
@REFPNT[2][1]
@STRDAT
The STRDAT array contains a text string for a detail entity. STRDAT is also used to return text
from a dialog box. For the current version the text is used for all detail entities except leader and
witness lines. The system variable @NUMSTR contains the size of the STRDAT array.
@STRDAT[0]
@STRDAT[1]
@STRDAT[n]
where n = @NUMSTR - 1.
@TXTATT
A TXTATT array contains information about attributes of the text in a detail entity. For the current
version, the text attributes are used for all detail entities except leader and witness lines.
@TXTATT[0] Font number assigned to the note entity
1 to 16 - Font number
Page 212
213
@TXTINFO
A TXTINFO array contains text information for a detail entity. In the current version, the
TXTINFO array is used for all detail entities except leader and witness lines. The TEXTINFO
array contains six values.
@TXTINFO[0] A flag to display only in the definition view:
0 = Display in all views
1 = Display in view only
@TXTINFO[1] Text format. Only 0 is available in the current version.
0 = Left justified text
@TXTINFO[2] Proportional spacing mode:
0 = NOT proportionally spaced
1 = Proportionally spaced
@TXTINFO[3] Direction of first to last character in a text string.
One option is available in the current version:
0 = Left to right
@TXTINFO[4] A flag for the horizontal text alignment:
0 = Left alignment of text
1 = Center alignment of text
2 = Right alignment of text
@TXTINFO[5] A flag for the vertical text alignment:
0 = Bottom alignment of text
1 = Center alignment of text
Page 213
214
@WITLN
A WITLN array contains information about witness lines. For each witness line there are eight
data. The first subscript in the array represents the witness line number.
@WITLN[0][0] X coordinate of first endpoint of witness line in view coordinate system
@WITLN[0][1] Y coordinate of first endpoint of witness line in view coordinate system
@WITLN[0][2] X coordinate of second endpoint of witness line in view coordinate system
@WITLN[0][3] Y coordinate of second endpoint of witness line in view coordinate system
@WITLN[0][4] Line type assigned to witness line
1 to 4 - Line type number
@WITLN[0][5] Line width assigned to witness line
1 to 15 (odd) - Line width
@WITLN[0][6] Pen number assigned to witness line
1 to 8 - Pen number
@WITLN[0][7] Color number assigned to witness line
0 to 15 - Color number
Page 214
215
1
ANGULAR DIMENSION
2
NOTE (NNOTE)
3
LABEL (NLABEL)
4
LEADER (NLEADER)
WITNESS (NWITNESS)
18
6
XHATCH
7
GENERIC DIMENSION
11
ORDINATE DIMENSION
12
FNOTE (NFNOTE)
14
15
16
17
19
20
21
22
ANGULAR DIMENSION
@NUMINT
@NUMFLT
@NUMSTR
@INTDAT[0]
Entity type (14)
@INTDAT[1]
Group number (1-127 = group number, 0 = none)
@INTDAT[2]
Group instance (1-255 = group instance number, 0 = none)
@INTDAT[3]
Color (0-15)
@INTDAT[4]
Level number (1-255)
@INTDAT[5]
Font number (1-6 = old style number, 0 =
font # in @TXTATT[0])
@INTDAT[6]
Pen (0-7)
@INTDAT[7]
Width (1-15, odd only)
@INTDAT[8]
The flag for inner or outer angle:
0 = Outer angle
1 = Inner angle
@FLTDAT[0]
@FLTDAT[1]
@FLTDAT[2]
@DIMINFO1[]
@DIMINFO2[]
@ENTATT[]
@MSCDAT[]
@REFLN[]
@STRDAT[]
@TXTATT[]
@TXTINFO[]
Page 215
216
ARC/CIRCLE
@NUMINT
(9)
@NUMFLT
@INTDAT[0]
Entity type (3)
@INTDAT[1]
Group number (1-127 = group number, 0 = none)
@INTDAT[2]
Group instance (1-255 = group instance number, 0 = none)
@INTDAT[3]
Color (0-15)
@INTDAT[4]
Level number (1-255)
@INTDAT[5]
Line type:
1 = Solid
2 = Dashed
3 = Center line
4 = Phantom line
@INTDAT[6]
Pen (0-7)
@INTDAT[7]
Width (1-15, odd only)
@INTDAT[8]
Definition view number (1-n)
@FLTDAT[0]
@FLTDAT[1]
@FLTDAT[2]
@FLTDAT[3]
@FLTDAT[4]
@FLTDAT[5]
@MSCDAT[0] Entity ID
CIRCULAR DIMENSION
@NUMINT
@NUMFLT
@NUMSTR
@INTDAT[0]
Entity type (12)
@INTDAT[1]
Group number (1-127 = group number, 0 = none)
@INTDAT[2]
Group instance (1-255 = group instance number, 0 = none)
@INTDAT[3]
Color (0-15)
@INTDAT[4]
Level number (1-255)
@INTDAT[5]
Font number (1-6 = old style number, 0 = font # in @TXTATT[0])
@INTDAT[6]
Pen (0-7)
@INTDAT[7]
Width (1-15, odd only)
@INTDAT[8]
Dimension type:
1 = Radial circular dimension
2 = Diametral circular dimension
3 = Bent radial circular dimension.
@FLTDAT[0]
@FLTDAT[1]
@FLTDAT[2]
Page 216
@DIMINFO1[]
@DIMINFO2[]
@ENTATT[]
@MSCDAT[]
@REFARC[]
@REFPNT[]
@STRDAT[]
@TXTATT[]
@TXTINFO[]
217
CONIC
@NUMINT
@NUMFLT
@INTDAT[0]
Entity type (4)
@INTDAT[1]
Group number (1-127 = group number, 0 = none)
@INTDAT[2]
Group instance (1-255 = group instance number, 0 = none)
@INTDAT[3]
Color (0-15)
@INTDAT[4]
Level number (1-255)
@INTDAT[5]
Line type:
1 = Solid
2 = Dashed
3 = Center line
4 = Phantom line
@INTDAT[6]
Pen (0-7)
@INTDAT[7]
Width (1-15, odd only)
@INTDAT[8]
Definition view number (1-n)
@INTDAT[9]
Conic type:
0 = Point
1 = Line
2 = Circular arc
3 = Elliptical arc
4 = Parabolic arc
5 = Hyperbolic arc
@INTDAT[10] Number of segments (1-2)
@FLTDAT[0] Depth
@FLTDAT[1] 2D rational quadratic coefficients of the first segment
@FLTDAT[2] w(u)=@FLTDAT[7]*u2+@FLTDAT[8]*u+@FLTDAT[9]
x(u)=(@FLTDAT[1]*u2+@FLTDAT[2]*u+@FLTDAT[3])/w(u)
y(u)=(@FLTDAT[4]*u2+@FLTDAT[5]*u+@FLTDAT[6])/w(u)
@FLTDAT[9]
If @INTDAT[10] = 2, six more entries to @FLTDAT are made:
@FLTDAT[10] 2D rational quadratic coefficients of the second segment
@FLTDAT[11] x(u) = (@FLTDAT[10]*u2 + @FLTDAT[11]*u + @FLTDAT[12])/w(u)
y(u) = (@FLTDAT[13]*u2 + @FLTDAT[14]*u + @FLTDAT[15])/w(u)
@FLTDAT[15]
@FLTDAT[16] Start display segment number and u parameter
@FLTDAT[17] End display segment number and u parameter
Page 217
218
GENERIC DIMENSION
@NUMINT
@NUMFLT
@NUMSTR
@INTDAT[0]
Entity type (20)
@INTDAT[1]
Group number (1-127 = group number, 0 = none)
@INTDAT[2]
Group instance (1-255 = group instance number, 0 = none)
@INTDAT[3]
Color (0-15)
@INTDAT[4]
Level number (1-255)
@INTDAT[5]
Old style font number (1-6)
@INTDAT[6]
Pen (0-7)
@INTDAT[7]
Width (1-15, odd only)
@INTDAT[8]
Definition view number (1-n)
@INTDAT[9]
Decimal precision (0-15)
@INTDAT[10] Use zero representation for tolerance (0 = false, 1 = true)
@INTDAT[11] Use leading zeros (0 = false, 1 = true)
@INTDAT[12] Use trailing zeros (0 = false, 1 = true)
@INTDAT[13] Arrowhead type (0-3)
@INTDAT[14] Usage is as dimension (1)
@INTDAT[15] Mirror text (0 = false, 1 = true)
@INTDAT[16] Text path:
0 = Right --> Left
1 = Up --> Down
2 = Left --> Right
3 = Down -> Up
@INTDAT[17] Number of lines (0-9)
@INTDAT[18] Number of arcs (0-2)
@INTDAT[19] Number of arrowheads (0-2)
@INTDAT[20] Form number:
0-49 = User defined
50 = Linear dimension
51 = Radial dimension
52 = Diametrical dimension
53 = Angular dimension
54 = Ordinate dimension
55 = Point dimension (circle surrounds text)
56 = Point dimension (hexagon surrounds text)
57 = Flag note
58 = Balloon note
59-63 = Reserved
@FLTDAT[0]
@FLTDAT[1]
@FLTDAT[2]
@FLTDAT[3]
@FLTDAT[4]
@FLTDAT[5]
Page 218
@FLTDAT[53]
@FLTDAT[54]
@FLTDAT[55]
@FLTDAT[56]
219
Because there are 4 values per line, @NUMFLT equals 21 plus (@INTDAT[17] times 4).
@STRDAT[0]
@STRDAT[1]
.
.
@STRDAT[n]
@MSCDAT[0]
@MSCDAT[1]
@MSCDAT[2]
@MSCDAT[3]
@MSCDAT[4]
@MSCDAT[5]
@MSCDAT[6]
Entity ID
New style font number (0 - 15)
Text slant angle (-31 through 31)
Fill text (0 = false, 1 = true)
Proportionally spaced text (0 = false, 1 = true)
Underlined text (0 = false, 1 = true)
Text line spacing factor
LABEL
@NUMINT
@NUMFLT
@NUMSTR
@INTDAT[0]
@INTDAT[1]
@INTDAT[2]
@INTDAT[3]
@INTDAT[4]
@INTDAT[5]
Page 219
Pen (0-7)
Width (1-15, odd only)
@FLTDAT[0]
@FLTDAT[1]
@FLTDAT[2]
@ENTATT[]
@LDRLN[]
@MSCDAT[]
@STRDAT[]
@TXTATT[]
@TXTINFO[]
@WITLN[]
220
LEADER
@NUMINT
@NUMFLT
@INTDAT[0]
Entity type (17)
@INTDAT[1]
Group number (1-127 = group number, 0 = none)
@INTDAT[2]
Group instance (1-255 = group instance number, 0 = none)
@INTDAT[3]
Color (0-15)
@INTDAT[4]
Level number (1-255)
@INTDAT[5]
Font number (1-6 = old style number, 0 = font # in @TXTATT[0])
@INTDAT[6]
Pen (0-7)
@INTDAT[7]
Width (1-15, odd only)
@INTDAT[8]
View-only flag:
0 = Display in all views
1 = Display only in view of definition
@FLTDAT[0]
@ENTATT[]
@LDRLN[]
@MSCDAT[]
LINE
@NUMINT
@NUMFLT
@INTDAT[0]
Entity type (2)
@INTDAT[1]
Group number (1-127 = group number, 0 = none)
@INTDAT[2]
Group instance (1-255 = group instance number, 0 = none)
@INTDAT[3]
Color (0-15)
@INTDAT[4]
Level number (1-255)
@INTDAT[5]
Line type:
1 = Solid
Page 220
221
2 = Dashed
3 = Center line
4 = Phantom line
@INTDAT[6]
Pen (0-7)
@INTDAT[7]
Width (1-15, odd only)
@FLTDAT[0]
@FLTDAT[1]
@FLTDAT[2]
@FLTDAT[3]
@FLTDAT[4]
@FLTDAT[5]
@MSCDAT[0] Entity ID
LINEAR DIMENSION
@NUMINT
@NUMFLT
@NUMSTR
@INTDAT[0]
Entity type (11)
@INTDAT[1]
Group number (1-127 = group number, 0 = none)
@INTDAT[2]
Group instance (1-255 = group instance number, 0 = none)
@INTDAT[3]
Color (0-15)
@INTDAT[4]
Level number (1-255)
@INTDAT[5]
Font number (1-6 = old style number, 0 = font # in @TXTATT[0])
@INTDAT[6]
Pen (0-7)
@INTDAT[7]
Width (1-15, odd only)
@INTDAT[8]
Dimension type:
1 =
Horizontal linear dimension
2 =
Vertical linear dimension
3 =
Parallel linear dimension
4 =
Radius dimensioned as horizontal linear distance between center of arc/circle and edge
of arc/circle
5 =
Radius dimensioned as vertical linear distance between center of arc/circle and edge of
arc/circle
6 =
Radius dimensioned as linear distance parallel to center and edge of arc/circle
7 =
Diameter dimensioned horizontally
8 =
Diameter dimensioned vertically
9 =
Diameter dimensioned in parallel to reference line.
10 =
Chamfer angle
11 =
Chamfer angle 45 degree style
@FLTDAT[0]
@FLTDAT[1]
@FLTDAT[2]
@FLTDAT[3]
Page 221
222
NOTE
@NUMINT
@NUMFLT
@NUMSTR
@INTDAT[0]
@INTDAT[1]
@INTDAT[2]
@INTDAT[3]
@INTDAT[4]
@INTDAT[5]
@INTDAT[6]
@INTDAT[7]
@FLTDAT[0]
@FLTDAT[1]
@FLTDAT[2]
@ENTATT[]
@MSCDAT[]
@STRDAT[]
@TXTATT[]
@TXTINFO[]
ORDINATE DIMENSION
@NUMINT
@NUMFLT
@NUMSTR
@INTDAT[0]
Entity type (21)
@INTDAT[1]
Group number (1-127 = group number, 0 = none)
@INTDAT[2]
Group instance (1-255 = group instance number, 0 = none)
@INTDAT[3]
Color (0-15)
@INTDAT[4]
Level number (1-255)
@INTDAT[5]
Font number (1-6 = old style number, 0 = font # in @TXTATT[0])
@INTDAT[6]
Pen (0-7)
@INTDAT[7]
Width (1-15, odd only)
@INTDAT[8]
Dimension type:
1 = Horizontal ordinate dimension
2 = Vertical ordinate dimension
3 = Parallel ordinate dimension
Page 222
@DIMINFO1[]
@DIMINFO2[]
@ENTATT[]
@MSCDAT[]
@REFPNT[]
@STRDAT[]
@TXTATT[]
@TXTINFO[]
223
POINT
@NUMINT
@NUMFLT
@INTDAT[0]
@INTDAT[1]
@INTDAT[2]
@INTDAT[3]
@INTDAT[4]
@INTDAT[5]
@INTDAT[6]
@INTDAT[7]
@FLTDAT[0]
@FLTDAT[1]
@FLTDAT[2]
@MSCDAT[0] Entity ID
POLYGON
@NUMINT
@NUMFLT
@INTDAT[0]
Entity type (6)
@INTDAT[1]
Group number (1-127 = group number, 0 = none)
@INTDAT[2]
Group instance (1-255 = group instance number, 0 = none)
@INTDAT[3]
Color (0-15)
@INTDAT[4]
Level number (1-255)
@INTDAT[5]
Border line type:
1 = Solid
2 = Dashed
3 = Center line
4 = Phantom line
@INTDAT[6]
Pen (0-7)
@INTDAT[7]
Width (1-15, odd only)
@INTDAT[8]
Fill type (0 = no fill, 1 = solid fill)
Page 223
224
@INTDAT[9]
Fill Color (1-256 = fill color, 0 = no fill)
@INTDAT[10] Number of vertices (3-8)
@FLTDAT[0] X value of vertex 1 (in world coordinates)
@FLTDAT[1] Y value of vertex 1 (in world coordinates)
@FLTDAT[2] Z value of vertex 1 (in world coordinates)
@FLTDAT[3] X value of vertex 2 (in world coordinates)@FLTDAT[4]
world coordinates)
@FLTDAT[5] Z value of vertex 2 (in world coordinates)
.
.
@FLTDAT[21] X value of vertex 8 (in world coordinates)
@FLTDAT[22] Y value of vertex 8 (in world coordinates)
@FLTDAT[23] Z value of vertex 8 (in world coordinates)
Because there are three values per vertex, @NUMFLT is equal to @INTDAT[10] times three.
@MSCDAT[0] Entity ID
POLYLINE
@NUMINT
@NUMFLT
@INTDAT[0]
Entity type (7)
@INTDAT[1]
Group number (1-127 = group number, 0 = none)
@INTDAT[2]
Group instance (1-255 = group instance number, 0 = none)
@INTDAT[3]
Color (0-15)
@INTDAT[4]
Level number (1-255)
@INTDAT[5]
Border line type:
1 = Solid
2 = Dashed
3 = Center line
4 = Phantom line
@INTDAT[6]
Pen (0-7)
@INTDAT[7]
Width (1-15, odd only)
@INTDAT[8]
Definition view number (1-n)
@INTDAT[9]
Polyline type:
0 = Open
1 = Closed
2 = Filled
@INTDAT[10] Display style:
0 = Centerline
1 = Round ends at width
2 = Square ends at width
3 = Tool path at width
@INTDAT[11] Fill style (display styles 1 and 2):
0 = No fill
1 = Solid fill
2-15 = Pattern
@INTDAT[12] Number of endpoints
Page 224
225
Line width
X value of endpoint 1 (in world coordinates)
Y value of endpoint 1 (in world coordinates)
Z value of endpoint 1 (in world coordinates)
X value of endpoint 2 (in world coordinates)
Y value of endpoint 2 (in world coordinates)
Z value of endpoint 2 (in world coordinates)
Since there are three values per endpoint, @NUMFLT is equal to 1 plus (@INTDAT[12] times
three).
@MSCDAT[0] Entity ID
SPLINE
@NUMINT
@NUMFLT
@INTDAT[0]
Entity type (5)
@INTDAT[1]
Group number (1-127 = group number, 0 = none)
@INTDAT[2]
Group instance (1-255 = group instance number, 0 = none)
@INTDAT[3]
Color (0-15)
@INTDAT[4]
Level number (1-255)
@INTDAT[5]
Line type:
1 = Solid
2 = Dashed
3 = Center line
4 = Phantom line
@INTDAT[6]
Pen (0-7)
@INTDAT[7]
Width (1-15, odd only).
@INTDAT[8]
Dimension flag (0 = 2D, 1 = 3D)
@INTDAT[9]
Cyclic flag (0 = open, 1 = closed)
@INTDAT[10] Definition view number (1-n, for 2D spline only)
@INTDAT[11] Number of segments
@INTDAT[12] Start display segment
@INTDAT[13] End display segment
If @INTDAT[8] equals 0 (2D spline), eight values are defined per spline segment as follows.
Thus, @NUMFLT is equal to (@INTDAT[11]*8) + 1.
@FLTDAT[0] Depth of spline
@FLTDAT[1] Coefficients of first segment
@FLTDAT[8]
@FLTDAT[9] Coefficients of second segment
@FLTDAT[16]
If @INTDAT[8] equals 1 (3D spline), 12 values are defined per spline segment as follows.
@NUMFLT is equal to @INTDAT[11] times 12.
@FLTDAT[0] Coefficients of first segment
@FLTDAT[11]
@FLTDAT[12] Coefficients of second segment
@FLTDAT[23]
Page 225
226
@MSCDAT[0] Entity ID
WITNESS
@NUMINT
@NUMFLT
@INTDAT[0]
Entity type (18)
@INTDAT[1]
Group number (1-127 = group number, 0 = none)
@INTDAT[2]
Group instance (1-255 = group instance number, 0 = none)
@INTDAT[3]
Color (0-15)
@INTDAT[4]
Level number (1-255)
@INTDAT[5]
Font number (1-6 = old style number, 0 = font # in @TXTATT[0])
@INTDAT[6]
Pen (0-7)
@INTDAT[7]
Width (1-15, odd only)
@INTDAT[8]
View-only flag:
0 = Display in all views
1 = Display only in view of definition
@FLTDAT[0]
@ENTATT[]
@MSCDAT[]
@WITLN[]
XHATCH
@NUMINT
@NUMFLT
@INTDAT[0]
Entity type (19)
@INTDAT[1]
Group number (1-127 = group number, 0 = none)
@INTDAT[2]
Group instance (1-255 = group instance number, 0 = none)
@INTDAT[3]
Color (0-15)
@INTDAT[4]
Level number (1-255)
@INTDAT[5]
Line type:
1 = Solid
2 = Dashed
3 = Center line
4 = Phantom line
@INTDAT[6]
Pen (0-7)
@INTDAT[7]
Width (1-15, odd only)
@INTDAT[8]
Definition view number (1-n)
@INTDAT[9]
Hatch pattern value (1-18)
@INTDAT[10] Number of line styles
@INTDAT[11] First line style
@INTDAT[12] Number of lines for first line style
@INTDAT[13] Second line style
@INTDAT[14] Number of lines for second line style
Since there is a style and a count for each line style, @NUMINT is equal to 10 + (@INTDAT[10]
times 2).
Page 226
@FLTDAT[0]
@FLTDAT[1]
@FLTDAT[2]
@FLTDAT[3]
@FLTDAT[4]
@FLTDAT[5]
@FLTDAT[6]
@FLTDAT[7]
227
The value of @NUMFLT is the total of the number of lines for each line style (i.e., @INTDAT[12]
+ @INTDAT[14] + etc).
@MSCDAT[0] Entity ID
Page 227
228
Page 228
229
0x0002
DG_HIDDEN
0x0004
DG_RET_ON_SEL 0x0001
DG_CANCEL
0x0008
DG_DEFAULT
0x2000
DG_ALERT
0x8000
DG_CANCOLOR
0x4000
Page 229
230
Example 1
This is a .CDL file that can be run as is, or can be compiled into a .CDX file.
Commands illistrated: CLEAR; GETPOS; LINE; PAUSE; and POINT.
REMThisprogramallowsthreepositionstobeindicatedandwill
REMcreateapointateachposition.Threelineswillalsobe
REMcreatedtoformatriangle.Thefinalstepcalculatesand
REMdisplaystheperimeterofthetriangle.
CLEAR
defopt=1
GETPOS"Indicatethefirstposition",defopt
x1=@XWORLD
y1=@YWORLD
z1=@ZWORLD
POINTx1,y1,z1
GETPOS"Indicatethesecondposition",defopt
x2=@XWORLD
y2=@YWORLD
z2=@ZWORLD
POINTx2,y2,z2
GETPOS"Indicatethethirdposition",defopt
x3=@XWORLD
y3=@YWORLD
z3=@ZWORLD
POINTx3,y3,z3
dist1=sqrt((x2x1)^2+(y2y1)^2)
dist2=sqrt((x2x3)^2+(y2y3)^2)
dist3=sqrt((x3x1)^2+(y3y1)^2)
LINEx1,y1,z1,x2,y2,z2
LINEx2,y2,z2,x3,y3,z3
LINEx1,y1,z1,x3,y3,z3
perim=dist1+dist2+dist3
PAUSE"Theperimeterofthetriangle=%.4f",perim
:exit
Page 230
231
Example 2
Commands illistrated: CLEAR; GETMENU; LINE; SWITCH; WINDOW; WHILE
/*Asketchprogramusingmenus*/
/*Initialsetupofthescreenandvariables*/
#defineTRUE1
WINDOW4,4,4,4
inc=0.25
xold=0
yold=0
xnew=0
ynew=0
/*Loopformenuselection*/
WHILE(TRUE)
{
GETMENU"Chooseadirection",\
"UP",\
"DOWN",\
"LEFT",\
"RIGHT"
SWITCH(@KEY)
{
CASE3:1/*Exitoption*/
GOTOexit
BREAK
CASE1/*MoveUP*/
ynew=ynew+inc
BREAK
CASE2/*MoveDOWN*/
ynew=ynewinc
BREAK
CASE3/*MoveLEFT*/
xnew=xnewinc
BREAK
CASE4/*MoveRIGHT*/
xnew=xnew+inc
BREAK
}
/*Drawthesketchlineandupdatethecurrentpoint*/
LINExold,yold,0,xnew,ynew,0
xold=xnew
yold=ynew
}
:exit
CLEARinc,xold,yold,xnew,ynew
Page 231