Introduction

CADKEY LISP is a full-featured LISP programming interface to CADKEY. The 
LISP language offers features that qualify it to serve as a CAD programming 
language. The extensive CADKEY LISP function set can run AutoLISP* 
programs with minimal changes. The product includes an application 
development environment, a LISP interpreter, and a command line interface 
dialog.

A Few Features

There are approximately 150 CADKEY LISP functions which provide direct 
access to the CADKEY database and graphics engine. You can directly 
access, utilize, modify, and rewrite entities within CADKEY LISP. You can 
access external data via CADKEY LISP to include in a part file. You can 
create bill of materials files by reading the CADKEY database and writing the 
appropriate information to output files.

CADKEY LISP is a LISP interpreter that was modeled after existing LISP 
implementations in the CAD industry to facilitate the execution of existing 
applications written for different CAD systems. A wide variety of LISP 
programming books exist which provide detailed information on this powerful 
language. Every attempt has been made to maintain the previously defined 
standards; however, some differences do exist. These differences are detailed 
in a section titled "CADKEY LISP and AutoLISP Differences".

CADKEY LISP comes with ADE, an application development environment. 
ADE, which is a text editor complete with multiple windows, dialog boxes, 
and mouse support, assists in developing applications using CADKEY LISP. 
Additionally, CADKEY LISP ADE has a complete On-line Help system. See the 
section titled "Application Development Environment" for further details.
The multiple commands of CADKEY LISP provide functionality for creating, 
modifying, and manipulating geometry and data. These commands are 
detailed in the section titled "CADKEY LISP Commands."

Data Types

CADKEY LISP has eight different data types:
entity names
file handles
integers
lists
points
real numbers
selection sets 
strings

The following is a brief description and example of each data type.

Entity Names
Entity names (ename) are a special CADKEY LISP data type that references 
entities (lines, arcs, circles, etc.). Entity names are returned by functions 
such as entget, entsel and entnext and are used by all functions when 
referencing entities. Entity names are unique variable types.
Example:
(#10 0)

File Handles
File handles (handle) are used to reference any input to or output from a 
specified file and are returned from the open function. File handles are not 
supported in AutoLISP. File Handles are unique variable types.
Example:
#<input/output stream x:filename>

Integers
CADKEY LISP integers are whole numbers, any numeric value that is not a 
floating-point number.
Example:
1, 5, 998332239

Lists
Lists are the primary method of data storage in CADKEY LISP. Lists are 
heavily used for retrieving and making entities.
Example:
(A B C)

Points
Points are lists of three real numbers. The first element in a point list is the 
x-coordinate, the second is the y-coordinate, and the third is the z-
coordinate.
Example:
(1.53  3.66  8.22)

Real Numbers
CADKEY LISP real numbers are floating-point numbers, numbers that 
include a decimal.
Example:
1.5, 5.3, 99933939.88733

Selection Sets
Selection sets can group a series of entities. Selection sets are unique 
variable types. They are used by functions such as ssget, etc. Selection sets 
can be of infinite length but only 256 sets are available.
Example:
#(1 -1)

Strings
Strings are text or characters. They are always enclosed within double 
quotation marks.
Example: 
"Hello", "Enter radius:"

CADKEY LISP and AutoLISP Differences

CADKEY LISP, which is based on the host CADKEY graphics engine, has 
inherent differences from AutoLISP which is based on the host AutoCAD 
graphics engine. The two CAD systems, CADKEY and AutoCAD, have enough 
similarities to allow for implementation of CADKEY LISP. 

The list of differences is quite extensive. For example, AutoCAD defines 
dimensions as "blocks" whereas CADKEY has no blocks. AutoCAD utilizes 
layers whereas CADKEY utilizes levels. CADKEY LISP replicates the behavior 
and structure of AutoLISP as closely as possible. The following lists items 
that differ between CADKEY LISP and AutoLISP.

Auto-loading of CADKEY LISP programs

CADKEY LISP supports the automatic loading of programs much like 
acad.lsp. The file name for automatic loading in CADKEY LISP is ckinit.lsp.

Entity Names
In AutoLISP AutoCAD entity names are hexadecimal values.
In CADKEY LISP entity names are represented by a special data type that 
reflects the CADKEY entity id. When the entity is a complex entity, the 
second value in the ename reflects a vertex counter.

DXF Group Codes
Due to the differences between the AutoCAD database and the CADKEY 
database, the DXF group codes and entity codes are not always the same. 
Where ever possible, the codes map directly from one system to another. See 
the Entity Tables for a complete itemization and definition of each entity.

Evaluating Function Source
In AutoLISP, when using the eval function to return the "code" of a function 
as in (eval a) (setq a (defun b (/) (princ "Hello"))), it returns: (defun b (/) (princ 
"Hello")).
In CADKEY LISP the eval function does not return the "code" of a function.

Entity Handles
Entity handles are directly mapped to the entity number in CADKEY and 
remain constant between editing sessions.

entmake - Auto Creation of Layers
CADKEY LISP does not automatically create a new layer when a new layer 
name is given to entmake, although AutoLISP does.

Unsupported Functions
CADKEY LISP does not support the following AutoLISP functions:
cvunit
draggen
handent
menucmd
nentsel
nentselp
osnap
tablet
tblsearch
tblnext
trans
vports
xformss
initget

Unlike AutoCAD, which allows the user to press <Return> when using the getx 
functions with initget, disallowing null (1) has precedence over arbitrary 
input.

For example, passing initget a "bit" argument of 129 (disallow null and allow 
arbitrary input) and subsequently calling a getx function disallows the user 
from pressing <Return> at the prompt.

initget and Dashed Lines
During use of initget, to restrict certain types of input with subsequent calls 
to getx functions in AutoCAD, a bit value of 32 uses a dashed line for 
drawing rubberband lines or boxes. CADKEY LISP does not support the 
dashed line option.

grdraw
Although CADKEY LISP supports the grdraw function, it does not support 
dashed lines.

command
Unlike AutoLISP, CADKEY LISP allows the execution of CADKEY LISP 
functions within the command function. 
For example: (command "line" (getpoint) (getpoint) "") is permissible in 
CADKEY LISP.

ssfree
CADKEY LISP supports the ssfree function which is not implemented in 
AutoLISP. ssfree releases unneeded selection sets.

ssget
ssget in CADKEY LISP does not support the following options: I, WP, CP and 
F.

tan
Unlike AutoLISP, CADKEY LISP supports tan.

trace
AutoLISP returns only the function name.
CADKEY LISP returns the entire list of functions being "traced".

findfile
The findfile function in CADKEY LISP searches the following directories:
Current working directory (ex: c:\cadkey)
Part file directory (ex: c:\cadkey\prt)
CADKEY environmental variable. (ex: set CADKEY=C:\foo)
DOS path variable.

Unlike AutoLISP, CADKEY LISP does not search the program directory.

Right Mouse Button
In AutoCAD, pressing the right mouse button is the equivalent of pressing 
<Return>.

Run the CADKEY Configuration program and set the right mouse button to 
<Return>.

Selecting an Intersection Using int
In AutoCAD, the int function allows the selection of two entities.
In CADKEY LISP, the int function allows only one point, when you select the 
intersection of two lines.

Colors
The first eight colors (0 - 7) are mapped from AutoCAD colors to CADKEY 
colors. The remainder of the colors are defined as native CADKEY colors.

Transparent Commands
CADKEY LISP does not support transparent commands, which are AutoCAD 
commands that allow you to suspend execution of a currently running 
command to execute another and then return to the first. For example: zoom 
or pan.

Selecting a Circle Midpoint
The selection of the midpoint of a circle is permissible in CADKEY LISP. 
When you select the midpoint of a circle, the point returned is half way 
around the circumference (1 pi). 
This function is not available in AutoLISP.

Ghost Tangets
When you draw a line and select an arc or circle as the tangent first point 
and subsequently select the second point in AutoCAD, AutoCAD waits for 
you to enter the second point before drawing the line. CADKEY LISP does not 
support the ghost tangent feature.

zoom 
CADKEY LISP does not support zoom dynamic or zoom vmax.

undo
CADKEY LISP does not support undo.

POLYLINES
Since CADKEY handles polylines differently from AutoCAD, CADKEY LISP 
cannot support all the features inherent in AutoCAD polylines.
Some of the major differences are:
o       Polylines (created by entmake) cannot have arcs.
o       Half widths are not supported.
o       Polyline vertices do not have a midpoint.
o       The perp osnap modifier is not supported on polylines; CADKEY LISP will 
return the error message, Invalid entity for perp osnap.
o       Starting and ending widths of a polyline must be the same in CADKEY.
o       Valid CADKEY polyline widths are odd numbers between 0 and 15.
o       Polyline widths are measured in pixels.
o       Arcs in polylines are considered separate entities.

alert
Like AutoCAD for DOS, the alert function does not expand tabs in the input 
string. AutoCAD for Windows does, however, expand tabs.

textbox
Unlike AutoCAD, CADKEY does not return descender information for 
characters such as g, p, etc. Thus, the textbox function return values will not 
represent descenders when they are present.

Error Messages
Programs that rely upon a particular syntax to define an error condition in 
AutoLISP should not expect the same error messages to return from CADKEY 
LISP.

CADKEY LISP Commands

This section details the various commands that are available in CADKEY 
LISP. These commands are accessible via the command function in CADKEY 
LISP. Each of these commands has varying arguments.
An example is:
(command "line" fromPt toPt "")

A detailed listing of commands, prompts and structures follows. The text for 
the various prompts is shown to describe the command. 
* Those prompts preceeded by an asterisk indicate that tracking 
(rubberbanding) is utilized to determine this value.

arc
arc creates an arc. 
The following arguments and options are supported:
Arguments: Center/<Start point>
Center/<Start point>:
|       |       |
|       |       +--- Center/End/<second point>:
|       |               |               |               |
|       |               |               |               +---*End point:
|       |               |               |
|       |               |               +--- End point:
|       |               |                               |
|       |               |                         *Angle/Direction/Radius/<Center point>:
|       |               |                               |               |        |
|       |               |                               |               |        +--- *Radius:
|       |               |                               |               +--- *Direction from start point:
|       |               |                               +--- Included angle:
|       |               |
|       |               +--- Center:
|       |                               |
|       |                               +--- *Angle/Length of chord/<end point>:
|       |                                               |               |
|       |                                               |               +--- *Length of chord:
|       |                                               +--- Included angle:
|       +--- Center:
|                       |
|                       +--- Start point:
|                                       |
|                                       +--- Angle/Length of chord/<end point>:
|                                                       |               |
|                                                       |               +--- *Length of chord:
|                                                       +--- Included angle:
+------ End point (continue):

circle
circle creates a circle.
The following arguments and options are supported:
Arguments: 3P/2P/TTR/<Center point>
3P/2P/TTR/<Center point>:
|       |       |       |
|       |       |       +----   *Diameter/<Radius>:
|       |       |                       |
|       |       |                       +--- *Diameter:
|       |       |
|       |       +---------      Tangent spec:
|       |                       Second tangent spec:
|       |                       <Radius>:
|       |
|       +---------------        First point on diameter:
|                               *Second point on diameter:
|
+---------------------  First point:
				Second point:
				*Third point:

color
color changes the current entity-creation color.
The following arguments and options are supported:
Arguments: Color/<Default>

erase
erase accepts either an entity name or selection set and erases, or deletes, 
the specified entities.
The following arguments and options are supported:
(command "erase" ename) - Erases a given entity.
(command "erase" selset) - Erases entities in a selection set.
(command "erase" "all") - Erases all entities.
(command "erase" "l") - Erases the last entity.

line
line accepts the starting (from) point and n number of subsequent (to) points.
Example:
(command "line" frompoint topoint topoint topoint ...)

pan
pan accepts a from point and a to point for moving the current viewport. 
Arguments:      fromPoint, toPoint
Example: 
(command "pan" ‘(0.0 1.0) ‘(5.0 5.0))

pline
pline creates a polyline/arc. 
The starting argument to pline is the starting (from) point. The second 
argument dictates which "branch" to take. The possible second arguments 
are:
Arc/Close/Length/Undo/Width/<Endpoint>

From point:
|
+- Arc/Close/Halfwidth/Length/Undo/Width/<Endpoint>:
	|       |       |                       |               |                       |
	|       |       |                       |               |+--- Starting width<0.000>:
	|       |       |                       |               |+--- Ending width<0.000>:
	|       |       |                       |               |
	|       |       |                       |+--- Length:
	|       |       |                       |
	|       |       |+--- Not implemented
	|       |       |+--- ...
	|       |
	|       |+--- Finished closed polygon.
	|
	+-- Angle/CEnter/CLose/Dir/Halfwidth/Line/Radius/Second pt/Undo/Width/<Endpoint>:
		|               |        |              |       |               |       |               |               |       |
		|               |        |              |       |               |       |               |               |       +Start width:
		|               |        |              |       |               |       |               |               |       +End width:
		|               |        |              |       |               |       |               +--- Second pt:
		|               |        |              |       |               |       |               +--- End pt:
		|               |        |              |       |               |       +--- Radius:
		|               |        |              |       |               |               |
		|               |        |              |       |               |               +--- Angle/<End point>:
		|               |        |              |       |               |                       |
		|               |        |              |       |               |                       +--- Included angle:
		|               |        |              |       |               |                       +--- Direction of chord:
		|               |        |              |       |               
		|               |        |              |       Not implemented.
		|               |        |              |
		|               |        |              +--- Direction from start point:
		|               |        |              +--- End point:
		|               |        |
		|               |        +--- Finished closed arc polyline.
		|               +--- Center point:
		|               +--- Angle/Length/<Endpoint>:
		|                       |               |
		|                       |               +--- Length of chord:
		|                       +--- Included angle:
		|
		+--- Included angle:
				|
				+--- Center/Radius/<Endpoint>:
					|               |
					|               +--- Radius:
					|               +--- Direction of chord:
					+--- Center point:

redraw
redraw redraws the current viewport. 
No arguments are available to the redraw command.

redrawall
redrawall redraws all viewports.
No arguments are available to the redrawall command.

regen
regen regenerates the current viewport. 
No arguments are available to the regen command.

regenall
regenall regenerates all viewports. 
No arguments are available to the regenall command.

text
text accepts the following arguments and options:
(VOID)/Justify/Style/<Start point>:
	|       |               |               |
	|       |               |               +--- Height <xxxx>:
	|       |               |               +--- Rotation angle <xx>:
	|       |               |               +--- Text:
	|       |               |
	|       |               +--- Not supported.
	|       |
	|       +--- Align/Fit/Center/Middle/Right/<<Justification>>:
	|               |       |               |       |       |       |       |
	|               |       |               +       +       +       +       +       Point 
	|               |       |               +       +       +       +       +       Height
	|               |       |               +       +       +       +       +       Angle 
	|               |       |               +       +       +       +       +       Text     
	|               |       |
	|               |       +--- First text line point:
	|               |       +--- Second text line point:
	|               |       +--- Height:
	|               |       +--- Text:
	|               |
	|               +--- First text line point:
	|               +--- Second text line point:
	|               +--- Text:
	|
	+--- Text:

Where <<Justification>> can be any of the following two-letter combinations:
		TL              top left
		TC              top center
		TR              top right
		ML              middle left
		MC              middle center
		MR              middle right
		BL              bottom left
		BC              bottom center
		BR              bottom right

zoom
zoom supports the following arguments and options. 
Example: 
(command "zoom" "all") - Zooms all entities.
Arguments: All/Center/Extents/Left/Previous/Window/<Scale(X)>
All/Center/Extents/Left/Previous/Window/<Scale(X)>:
 |      |               |       |               |               |               +--- Zoom scale
 |      |               |       |               |               |
 |      |               |       |               |               +--- Window corner:
 |      |               |       |               |               +--- Other corner:
 |      |               |       |               |
 |      |               |       |               +--- Zoom previous
 |      |               |       +--- Lower left point:
 |      |               |       +--- Scale or height:
 |      |               |
 |      |               +--- Zoom extents
 |      |
 |      +--- Center point:
 |      +--- Scale or height:
 |
 +--- Zoom all

3dmesh
3dmesh draws a 3D mesh. It accepts an M size and an N size. The command 
is complete when M * N number of points have been supplied.
Arguments:      M, N, (M * N times)
For example: (command "3dmesh" 2 2 ‘(0 0 0) ‘(1 1 1) ‘(2 2 2) ‘(3 3 3))

Complex Entities
Complex entities in CADKEY LISP are entities that have multiple vertices. 
Polylines, polygons, splines and labels are all considered complex entity types 
implemented in CADKEY LISP. The primary difference between complex 
entities and regular entities in CADKEY LISP is the method in which they are 
retrieved, modified and stored in the CADKEY database. To remain 
compatible with AutoLISP from AutoCAD version 12, complex entities utilize 
a method similar to AutoLISP's for creating and modifying entities.

In the following Code Samples, text preceded by a semicolon (;) are 
comments, not actual code.

Making a Complex Entity

Making complex entities in CADKEY LISP is a straightforward procedure.  
The header information for a complex entity must first be passed to the 
primary function for making entities - entmake. Once entmake receives a 
request to begin creating a complex entity, it stores the header information in 
a temporary file. Subsequent calls to entmake must contain the appropriate 
information (vertices for polylines and polygons; label:leaders and 
label:witnesses for labels). Although attributes (color, line type, etc.) on 
complex sub entities can be specified, they will be ignored and the attributes 
specified in the header information used instead. Each call to entmake with a 
complex sub entity forces entmake to write the sub entity information to a 
temporary file. Upon receiving a seqend entity type, entmake retrieves the 
information from the temporary file and creates the complex entity.
When entmake receives a request to create an entity other than a complex 
sub entity during the creation of a complex entity, it aborts the creation of 
the complex entity, deletes the temporary file, and begins creating the new 
entity.

Code Sample
See complex.lsp in the CADKEY \lsp directory for more information.

; This program creates a polyline by prompting the user for points to include as vertices on the 
polyline.

(defun c:poly ( / pt )

	; Create the header of the polyline.
	
	(entmake '(     (0 . "POLYLINE")
			(62 . 1)                ; color
			(40 . 3.0)              ; starting width
			(41 . 3.0)              ; ending width
			(70 . 1)                ; closed
			(76 . 0)                ; display style
			(77 . 1)                ; fill mode
		)
	)
	
	; Get the starting point for the polyline.
	
	(setq pt (getpoint "Starting point for polyline: ") )
	
	; Give this point (vertex) to entmake.
	
	(entmake (list (cons 0 "VERTEX")        (cons 10 pt) ) )
	
	; Gather all remaining points from the user.
	
	(while (not (null pt))
		(setq pt (getpoint "Next point: ") )
		(if (not (null pt))
			(entmake (list (cons 0 "VERTEX") (cons 10 pt) ) )
		)
	)
	
	; Finally, complete the complex entity creation using entmake with a SEQEND.
	
	(entmake        '( (0 . "SEQEND") ) )
	(princ)
)

Retrieving Complex Entities

When retrieving complex entities using entget, CADKEY LISP returns the 
header information regarding a given label/polyline/polygon/spline on the 
first call to entget. The header will consist of the attributes and 
characteristics of the entity. See the "Entity Group Codes" section for header 
information on complex entities. 

Subsequent calls to entnext return complex sub entity information (vertex for 
polylines and polygons, node for splines and label:leader and label:witness 
for labels) as specified in the "Entity Group Codes" section. entnext continues 
to return complex sub entity information until the last sub entity is returned. 
The next call to entnext will return the entity of seqend. When entnext 
returns a seqend, no additional information (either header or vertex/node) is 
available for the specified entity. Entnext is the primary mechanism for 
"stepping" through sub entities.

Code Sample
See complex.lsp in the CADKEY \lsp directory for more information.

;
; This program retrieves a polyline from the database
;
(defun c:polyget ( / ename entity idx )
	
	; Get the entity to be retrieved and the data for it.
	(setq 
		ename (car (entsel "Select polyline to be retrieved: "))
		entity (entget ename)
	)

	(if (/= (cdr (assoc 0 entity)) "POLYLINE")
		(princ "Entity selected is not a polyline.")
		; else
		(progn
			(princ "Header information on polyline: ")
			(setq idx 0)
			
			; Print out each dotted pair in the header.
			(repeat (length entity)
				(princ (nth idx entity))
				(princ "\n")
				(setq idx (1+ idx))
			)

			(princ "\n")
			(princ "Vertices follow...\n")
			(setq
				ename (entnext ename)
				entity (entget ename)
			)
			(while (/= (cdr (assoc 0 entity)) "SEQEND")
				(princ "Vertex at: ")
				(princ (assoc 10 entity))
				(princ "\n")
				(setq 
					ename (entnext ename)
					entity (entget ename)
				)
			)
		)
	)
	(princ)
)

Modifying a Complex Entity

Complex entities can be modified by either changing the header information 
and/or modifying a specified complex sub entity. To modify a specified entity 
use the function entmod. Complex entity header information is modifiable in 
exactly the same way that regular entities are modifiable. Complex sub 
entities in complex entities may be altered using entmod by specifying the 
entity name for a given sub entity.

Code Sample
See complex.lsp in the CADKEY \lsp directory for more information.

;       This program retrieves a polyline from the database and
;       modifies the vertex from which the segment of the polyline
;       was created.  Note: Individual vertices cannot be identified
;       using entget.
(defun c:polymod ( / ename entity pt )
	
	; Get the entity to be retrieved and the data for it.
	(setq
		ename (car (entsel "Select polyline to be modified: ") )
		entity (entget ename)
	)
	(if (/= (cdr (assoc 0 entity)) "POLYLINE")
		(princ "Entity selected is not a polyline.")
		; else
		(progn
			(setq
				idx (getint "Enter vertex number to modify: ")
				pt (getpoint "Enter new vertex point: ")
			)

			; Get the vertices and highlight them.
			(setq
				ename (entnext ename)
				entity (entget ename)
			)

			(while (/= (cdr (assoc 0 entity)) "SEQEND")
				;
				; Find the vertex # 'idx'.  Use code 78.
				(if (= (cdr (assoc 78 entity)) idx)
					(progn
						(setq entity (subst (cons 10 pt) (assoc 10  entity) entity))
						(entmod entity)
					)
				)

				(setq 
					ename (entnext ename)
					entity (entget ename)
				)
			)
		)
	)
	(princ)
)

Entity Names and Complex Entities

Complex entities utilize the standard entity naming structure in CADKEY 
LISP as do all other entities. The primary difference between a complex entity 
name and a "regular" entity name is that complex entities utilize the second 
digit of the entity name as an index into the sub entity table. 

CADKEY LISP provides no method for accessing or changing this variable; 
this is mentioned here for application debugging purposes.

CADKEY LISP Functions

CADKEY LISP functions can broken down into the following categories:

Function Types

Arithmetic Functions
+
-
*
/
1+
1-
abs
atan
atof
atoi
cos
exp
expt
fix
float
gcd
itoa
log
max
min
rem
sin
sqrt
tan

Bitwise Operators

~
boole
logand
logior
lsh

Debugging and Errors

*error*
trace
untrace

Entity Manipulation

entdel
entget
entlast
entmake
entmod
entnext
entsel
entupd
handent

Evaluator Functions

apply
eval
lambda
quote

File Input/Output

close
findfile
open
read-char
read-line
write-char
write-line

Graphics Manipulation

grclear
grdraw
grtext
grvecs
redraw

Input Output Functions

prin1
princ
print
prompt
read
terpri

List Functions

append
assoc
c????r
car
cdr
cons
last
length
list
mapcar
member
nth
reverse
subst

Miscellaneous Functions

alert
alloc
angle
angtof
angtos
atoms-family
command
distance
distof
expand
foreach
getenv
inters
mem
pi
polar
rtos
textbox
vmon
wcmatch

Numerical Comparisons

<
<=
=
/=
>=
>

Predicate Functions

atom
boundp
eq
equal
listp
minusp
null
numberp
type
zerop

Screen Management

graphscr
textpage
textscr

Selection Set Tools

ssadd
ssdel
ssfree
ssget
sslength
ssmemb
ssname

Special Forms

and
cond
if
not
or
progn
repeat
while

String Functions

ascii
chr
strcase
strcat
strlen
substr

Symbol Functions

defun
set
setq

System Functions

exit
gc
load
quit
ver

System Variables

getvar
setvar

User Interface Tools

getangle
getcorner
getdist
getfiled
getint
getkword
getorient
getpoint
getreal
getstring
initget

Function Descriptions

The following briefly explains each CADKEY LISP function. 

+
The +, add, function adds two numeric values together and returns their 
sum.
Function type   Arithmetic 
Syntax  (+ number number)
Example (setq x (+ 5 3)) returns 8
Complement      - subtract

-
The -, subtract, arithmetic function subtracts the second number from the 
first and returns the difference.
Function type   Arithmetic
Syntax  (- number number)
Example (setq x (- 5 3)) returns 8
Complement      + add

*
The *, multiply, arithmetic function multiplies the first number by the second 
number and returns the product.
Function type   Arithmetic
Syntax  (* number number)
Example (* 3 2) returns 6
Complement      / divide

/
The / (divide) arithmetic function divides the first number by the second 
number .
Function type   Arithmetic
Syntax  (/ number number)
Example (/ 6 2) returns 3
Complement      * multiply

1+
The 1+ (increment) arithmetic function adds one (1) to a given number.
Function type   Arithmetic
Syntax  (1+ number)
Example (setq x 5) (1+ x) returns 6
Complement      1- decrement

1-
The 1- (decrement) arithmetic function subtracts one (1) from a given 
number.
Function type   Arithmetic
Syntax  (1- number)
Example (setq x 5)
(1- x) returns 4
Complement      1+ increment

~
The tilde '~' returns the one's complement of a given integer.
Function type   Bitwise operator
Syntax  (~ integer)
Example (setq x (~ -2) returns 1
See also        boole
logand
logior
lsh

<
The < (less than) operator compares item1 (the first number or string) against 
item2 (the second number or string). Both items must be of the same data 
type. If item1 is less than item2, it returns T, otherwise nil.
Function type   Numerical comparison
Syntax  (< item1 item2)
Example (< 5 3) returns nil
(< 3 5) returns T
(< "a" "b") returns T
See also        > greater than

>
The > (greater than) operator compares item1 (the first number or string) 
against item2 (the second number or string). Both items must be of the same 
data type. If the first is greater than the second, it returns T, otherwise nil.
Function type   Numerical comparison
Syntax  (> item1 item2)
Example (> 5 3) returns T
(> 3 5) returns nil
(> "a" "b") returns nil
See also        < less than

<=
The <= (less than or equal to) operator compares item1 (the first number or 
string) against item2 (the second number or string). Both items must be of 
the same data type. If the first number or string is less than or equal to the 
second, it returns T, otherwise nil.
Function type   Numerical comparison
Syntax  (<= item1 item2)
Example (<= 5 3) returns nil
(<= 3 5) returns T
(<= 5 5) returns T
(<= "a" "b") returns T
See also        >=

=
The = (equal) operator compares item1 (the first number, string or symbol) 
against item2 (the second number, string or symbol). Both items must be of 
the same data type. If they are equal, it returns T, otherwise nil.
Function type   Numerical comparison
Syntax  (= item1 item2)
Example (= 3 5) returns nil
(= 3 3) returns T
(= item nil) might return nil or T
(= "a" "b") returns nil
See also        /= not equal

/=
The /= (not equal) operator compares item1 (the first number, string or 
symbol) to item2 (the second number, string or symbol). Both items must be 
of the same data type. If they are not equal, it returns a T, otherwise nil.
Function type   Numerical comparison
Syntax  (/= item1 item2)
Example (/= 3 5) returns T
(/= 3 3) returns T
(/= item nil) could return nil or T
(/= "a" "b") returns T
See also        = equal

>=
The >= (greater than or equal to) operator compares item1 (the first number 
or string) to item2 (the second number or string). If the first  is greater than 
or equal to the second, it returns T, otherwise nil.
Function type   Numerical comparison
Syntax  (>= item1 item2)
Example (>= 3 5) returns nil
(>= 5 3) returns T
(>= "a" "b") returns nil
See also        <= less than or equal to

abs
abs returns the absolute value of a given number.
Function type   Arithmetic
Syntax  (abs number)
Example (abs -1) returns 1

alert
alert displays a dialog box as an error or warning with the contents of the 
specified string. The dialog box has a single OK button. The string argument 
may contain embedded \n characters to specify multiple lines.
Function type   Miscellaneous
Syntax  (alert string)
Example (alert "Unable to open file\nspecified -> input.txt")

alloc
alloc establishes the segment size to the specified number of nodes. It is not 
necessary to use this function or expand under normal conditions. alloc 
returns the previous setting.

Using this function incorrectly may corrupt memory. Use with extreme 
caution.
Function type   Miscellaneous
Syntax  (alloc nodes)
Example (alloc 1024)
See also        expand

and
and returns the logical and of multiple items in a list. If all items in a list are 
bound (not nil), and returns T, otherwise, and returns nil. 
Function type   Special form
Syntax  (and item item ...)
Example (setq x 4.2 y nil)
(and 2.1 x) returns T
(and x y) returns nil
(and x y 2.1) returns nil
Complement      or
See also        not, or

angle
angle returns the angle between the two specified points. The angle is 
measured from the X-axis in the current UCS in radians. Angles increase in 
the counterclockwise direction.
Function type   Miscellaneous function
Syntax  (angle pt1 pt2)
Example (setq ang (angle '(2.5 2.5) '(4.0 4.0)))

angtof
angtof converts the specified string into an angle based upon the optional 
mode argument. If mode is not supplied, the value of aunits is used. The 
angle is returned in radians.
The value of mode can be one of the following:
Degrees - 0
Degrees/minutes/seconds - 1
Grads - 2
Radians - 3
Surveyor's units - 4

Function type   Miscellaneous
Syntax  (angtof string [mode])
Example (setq ang (angtof "1.265" 0))
Complement      angtos
See also        angtos, distof, rtos

angtos
angtos takes an angle (specified in radians) and returns it as a formatted 
string based upon optional arguments, mode and precision as well as the 
system variables, unitmode and dimzin. Mode and precision specify the 
angular mode and decimal place of precision. If mode and/or precision are 
not supplied, the values of aunits and auprec are substituted. If the system 
variable unitmode is 0 and a mode of 4 is used, a space is included in the 
returned string. Conversely, if unitmode is 1 and a mode of 4 is used, no 
space is included.
The valid values for mode follow:
Degrees - 0
Degrees/minutes/seconds - 1
Grads - 2
Radians - 3
Surveyor's units - 4

Function type   Miscellaneous
Syntax  (angtos angle [mode [precision]])
Example (angtos 0.785398 0 5) returns "45.00000"
Complement      angtof
See also        angtof, distof, rtos

append
append accepts any number of lists and adds the later lists to the first to 
create one list. All arguments to append must be lists.
Function type   List
Syntax  (append expression ...)
Example (append '(a b c) '(x y z)) returns (a b c x y z)
See also        assoc, car, cdr, c????r, cons, last, length, list

apply
Executes the function specified using the given argument list.
Function type   Evaluator
Syntax  (apply function list)
Example (apply '- '(12 6))
(apply 'load '("defaults.lsp"))
See also        lambda, mapcar

ascii
ascii returns the first character of a string as its ASCII code.
Function type   String
Syntax  (ascii "string")
Example (ascii "b") returns 98
See also        chr

assoc
assoc searches a list for an item. assoc is useful when dealing with entity 
group codes and functions such as entget, entnext, etc. If the entry assoc 
searched the list for cannot be found, assoc returns nil.
Function type   List
Syntax  (assoc item list)
Example (setq list (list ‘(72 . 5) ‘(73 . 6)))
(assoc 72 list) returns (72 . 5)
See also        append, car, cdr, c????r, cons, last, length, list

atan
atan returns the arc tangent of an angle, expressed in radians.
Function type   Arithmetic
Syntax  (atan angle)
Example (atan 0.35) returns 0.336675
Complement      sin, cos, tan
See also        cos, sin, tan

atof
atof returns the conversion of a given string as a floating-point number.
Function type   Arithmetic
Syntax  (atof string)
Example (atof "6.5") returns 6.5
See also        atoi

atoi
atoi returns the integer value of a given string.
Function type   Arithmetic
Syntax  (atoi string)
Example (atoi "6") returns 6
See also        atof

atom
atom checks to see if a given item is an atom or a list. When the item is an 
atom, atom returns T, otherwise atom returns nil.
Function type   Predicate
Syntax  (atom item)
Example (atom '(2.1 1.3 3.1)) returns nil
(atom a) returns T
Complement      listp
See also        listp

atoms-family
atoms-family returns a list of all atoms currently defined. When the format is 
specified as a 0, the currently defined atoms are returned in an unquoted 
list. When the format is defined as a 1, the currently defined atoms are 
returned as strings. If the optional symbollist is defined, only those atoms 
that are contained in symbollist are returned.
Function type   Miscellaneous
Syntax  (atoms-family format [symbollist])
Example (atoms-family 0 '("list" "comm")) returns ("list" nil)

boole
boole provides a mechanism for performing a general bitwise Boolean 
function. The function bit must be an integer between 0 and 15. It represents 
the Boolean function to apply to the subsequent integers and is based upon 
the following truth table:
	integer1                     integer2   function bit
	0       0       8
	0       1       4
	1       0       2
	1       1       1
boole performs the bitwise operation by pairing each bit in integer1 with the 
corresponding bit in integer2. The result is a row in the truth table. The 
result is either 0 or 1 and is determined by the value of the function bit in 
the resultant row.
The function bit can be set to correspond to standard Boolean operations.  
The settings are:
	1       AND
	6       XOR
	7       OR
	8       NOT
Function type   Bitwise Operator
Syntax  (boole function number number ...)
Example (boole 3 5 6) returns 5
(boole 1 2 6) returns 2
See also        ~, logand, logior, lsh

boundp
boundp returns T if the specified atom has a value and nil if it does not. 
Function type   Predicate
Syntax  (boundp atom)
Example (setq x 5.0 y nil)
(boundp x) returns T
(boundp y) returns nil
Complement      null
See also        null

car, cdr, c????r
car, cdr, and their derivatives are the primary tools for taking lists apart. car 
returns the first element of a list. cdr returns a list less the first element. 
CADKEY LISP supports derivatives of car and cdr up to four levels deep.
Function type   List
Syntax  (car list)
(cdr list)
(c???? list)
Example (setq lst ‘(1 2 3 4 5)) returns (1 2 3 4 5)
(setq head (car lst)) returns 1
See also        append, assoc, cons, last, length, list

chr
chr converts an ASCII code into its equivalent single-character string.
Function type   String
Syntax  (chr number)
Example (chr 98) returns "b"
See also        ascii, string

close
close flushes the contents of the given file descriptor to disk and closes the 
given file descriptor. close returns nil. See open for a discussion on opening 
files and file descriptors.
Function type   File Input/Output
Syntax  (close descriptor)
Example (close fp)
See also        open

command
command executes the specified command and returns nil. Arguments to a 
given command need not be supplied simultaneously on one line. If the 
pause symbol is detected during a call to the command function, command 
is suspended to allow for direct user input. The pause symbol is a single 
backslash or the variable pause, \.
When the command processor is active and waiting for user input, the user 
cannot respond to a given prompt using CADKEY LISP as this would cause 
an invalid condition of reentrance.
Function type   Miscellaneous
Syntax  (command [arguments]...)
Example (command ".line" "\\" "\\" "")
(command ".line" pause pause "")

cond
The cond function works like the IF statement except that cond can evaluate 
any number of test conditions. The first condition tested that returns a non-
nil value executes. Subsequent non-nil conditions do not execute.
Function type   Special form
Syntax  (cond (first test_condition first statements ...)
	(second test_condition second statements ...)
	(T last_statement ... )
)
Example (setq x 5 y 3 z 2)
	(cond
		((= x 5) (princ "X equals 5"))
		((/= y 3) (princ "Y does not equal 3"))
		((= z x) (princ "X does not equal Z"))
	)
) returns and prints "X equals 5"
See also        if

cons
cons constructs a list. cons takes an element and a list and returns a new 
list with the given element at the head of the list.
Function type   List
Syntax  (cons element list)
Example (setq lst (cons 'w '(x y z)) returns (w x y z)
See also        append, assoc, car, cdr, c????r, length, list

cos
cos returns the cosine of an angle which is expressed in radians. 
Function type   Arithmetic
Syntax  (cos angle)
Example (cos 3.1412) returns -1
Complements     sin, tan
See also        sin, tan

defun
defun is used to define a function. User-defined functions are commands in 
CADKEY LISP. Indicate commands by preceding the symbol name with c:.
Arguments and variables local to a command are supplied in a list 
immediately following the symbol for the function name. Local variables are 
separated from arguments with a single slash character (/). Commands 
without arguments and/or local variables need not declare variables within 
this list. Commands defined using the c: can be entered from the command 
line without parentheses. Conversely, commands defined without the c: must 
be called using parentheses.
Function type   Symbol
Syntax  (defun symbol arguments expression ...)
Example (defun myline ( pt1 pt2 )
	(command ".line" pt1 pt2 "")
)

distance
distance returns the three-dimensional distance between two specified 
points.
Function type   Miscellaneous
Syntax  (distance pt1 pt2)
Example (setq dist
	(distance '(2.0 2.0 0.0) '(3.0 3.0 0.0)) returns 1.0
)

distof
distof converts a given string into a real number in the format specified by 
the optional mode argument.
Valid values for mode are as follows:
1       scientific
2       decimal
3       engineering (feet/inches)
4       architectural (feet/fractional inches)
5       fractional

If mode is not given, the value of the system variable lunits is used. distof 
accepts the string in the same form as rtos returns.
Function type   Miscellaneous
Syntax  (distof string [mode])
Example (distof "3’4\"" 4) returns 40.0
See also        angtof, angtos, rtos

entdel
entdel deletes the entity specified by ename if it is present in the part file, or 
restores the entity if it was previously present, and returns the name of the 
deleted entity.
Function type   Entity Manipulation
Syntax  (entdel ename)
Example (entdel (car (entsel "Select entity for deletion:")))
See also        entget, entlast

entget
entget retrieves the information for the entity specified by ename from the 
CADKEY database. This function returns an association list for the given 
entity. Extended entity (copious) data is not currently supported. See the 
entity tables for the return DXF codes.
Function type   Entity Manipulation
Syntax  (entget ename)
Example (entget (car (entsel "Select entity:")))
See also        entlast, entmod

entlast
entlast retrieves the last entity in the database. This function is particularly 
useful to obtain the entity most recently created.
Function type   Entity Manipulation
Syntax  (entlast)
Example (setq elast (entlast))
See also        entget

entmake
entmake creates a new entity given a definition list. The list of information 
required to create an entity must be given to entmake in the same way that 
entget returns it. If the creation of the specified entity is successful, entmake 
returns the original list given to it. If unsuccessful, entmake returns nil.
Complex entities such as polylines and polygons are created by providing the 
header information for the entity first, followed by a series of calls to entmake 
with vertex entities. Complex entities are created when entmake receives an 
entity of type seqend. If during the creation of a complex entity, entmake 
receives a request to create an entity other than vertex or seqend, the entity 
creation of the complex entity is terminated without creating an instance in 
the CADKEY database. All vertices will have the properties as defined in the 
"header" information.
Blocks are not currently supported by entmake.
Function type   Entity Manipulation
Syntax  (entmake deflist)
Example (entmake '((0 . "LINE")
	(62 . 1) ; color
	(10 4.3 5.6 0.0) ; starting coordinate
	(11 5.5 8.7 0.0)) ; ending coordinate
)       
See also        entlast, entmod

entmod
entmod is used to modify the characteristics of an existing entity. entmod is 
passed an entity list of the same characteristics that entget returns. You 
must specify the entity name (-1) in the entity list.
To modify existing entities, retrieve them using entget, modify the contents of 
the entity list using subst and perform an update on the entity using 
entmod. If successful, entmod returns the entity list given to it, otherwise it 
returns nil.
You cannot modify entity names and entity types for a given entity. When 
you modify an entity, it is not automatically updated on the screen. Use 
entupd to update the display of the modified entity.
Function type   Entity Manipulation
Syntax  (entmod elist)
Example See the example in the section entitled "Complex 
entities".
See also        entlast, entupd, subst

entnext
entnext returns the next entity in the database after the one specified. If no 
arguments are given to entnext, the first entity in the database is returned.
Complex entities may have sub entities (vertices) returned using entnext by 
walking through the database. seqend is returned by entnext once you 
exhaust all sub entities. To find the parent entity of a sub entity, step 
through the sub entities until a seqend is encountered, then extract the 
entity name specified by a -2 value.
Function type   Entity Manipulation
Syntax  (entnext ename)
Example (setq next (entnext)) first entry 
(setq
	e (cdar (entget (car (entsel)))) next entity
	next (entnext e)
)
See also        entget, entlast

entsel
entsel is the primary function used to select entities. entsel returns a list 
whose first atom is the entity name and the second is the point at which it 
was selected. If the optional prompt is not supplied, entsel displays the 
default prompt Select entity:. entsel utilizes the selection parameters defined 
by the optional preceding initget.
Function type   Entity Manipulation
Syntax  (entsel [prompt])
Example (setq ename (car (entsel))) might return #(15 . 0)
See also        entget, initget

entupd
entupd is used to update the specified entity after you modify it. You can 
update complex entities such as polylines and polygons by specifying either 
the parent ename or a sub entity ename. entupd returns the name of the 
updated entity.
Function type   Entity Manipulation
Syntax  (entupd ename)
Example (setq ename (entlast))
(entupd entlast)
See also        entget

eq
eq returns T if the first expression and the second expression are bound to 
the same object, nil otherwise.
Function type   Predicate
Syntax  (eq expr1 expr2)
Example (setq
	e1 '(1 2 3)
	e2 '(1 2 3)
	e3 e2
)
(eq e1 e3) returns nil
(eq e2 e3) returns T
Complement      equal

equal
equal returns T if the first expression and the second expression evaluate to 
the same thing. Due to rounding, the comparison of real numbers is 
somewhat difficult. To remedy this, equal accepts an optional argument 
(tolerance) which allows real numbers to be equal, plus or minus the 
tolerance.
Function type   Predicate
Syntax  (equal expr1 expr2 [tolerance])
Example (setq
	e1 '(1 2 3)
	e2 '(1 2 3)
	e3 e2
)
(equal e1 e3) returns T
(equal e2 e3) returns T
(setq
	x 1.715642
	y 1.715641
)
(equal x y 0.000001) returns T
Complement      eq

*error*
The *error* function, if not nil, is executed anytime in which a CADKEY LISP 
error occurs. This function must be defined by the program as it is not built-
in. When it is called, it is passed a single string argument describing the 
error which just occurred.
Function type   Debugging and Errors
Syntax  (*error* errormsg)
Example (defun *error* ( errormsg )
	(princ "An error has occurred.")
	(terpri)
	(princ errormsg)
)

eval
eval evaluates an expression. The expression can be any CADKEY LISP 
expression.
Function type   Evaluator
Syntax  (eval expression)
Example (eval 2.31) returns 2.31
(eval (+ 1 2)) returns 3
(eval (setq b 3)) returns 3

exit
exit, much like quit, cancels the current application and returns to the 
command prompt.
Function type   System
Syntax  (exit)
Example (exit)
See also        quit

exp
exp returns the constant e raised to a specified power. The return value is a 
real number.
Function type   Arithmetic
Syntax  (exp number)
Example (exp 2) returns 7.38906

expand
expand allocates the requested amount of node space. The number of 
segments which expand is able to allocate is returned. It is not necessary to 
use this function or alloc under normal conditions. 

Using this function incorrectly may corrupt memory. Use with extreme 
caution.
Function type   Miscellaneous
Syntax  (expand number)
Example (expand 1)
See also        alloc

expt
expt returns the given base raised to the given power. The return value is an 
integer.
Function type   Arithmetic
Syntax  (expt base power)
Example (expt 2 2) returns 4

findfile
findfile finds the specified file name by searching the current working 
directory, then the directory containing the current part file, and finally the 
directory pointed to by the environmental variable cadkey. Finally, if the file 
has not been found, findfile searches the directories defined by the DOS path 
variable.
Function type   File Input/Output
Syntax  (findfile filename)
Example (findfile "gear.prt") might return "c:/cadkey/prt"

fix
fix converts a real number to an integer by truncating the fractional portion 
of the value.
Function type   Arithmetic
Syntax  (fix number)
Example (fix 5.3) returns 5
(fix 5) returns 5

float
float converts a given number into a real number.
Function type   Arithmetic
Syntax  (float number)
Example (float 2) returns 2.0
(float 3.0) returns 3.0

foreach
foreach steps through a given list assigning each element to the specified 
name and evaluating the specified expression for each element in the list. 
Any number of expressions can be specified to foreach. The result of the last 
evaluation is returned by foreach.
Function type   Miscellaneous
Syntax  (foreach name list expression ...)
Example (setq i 2 j 3 k 4)
(foreach x '(i j k)
	(setq a (1+ (eval x)))
	(princ a) prints 3 4 5 and returns 5
)
gc
gc forces an internal CADKEY LISP garbage collection to take place. This 
returns nil.
Function type   System
Syntax  (gc)
Example (gc)

gcd
gcd returns the greatest common denominator of the two given values. Both 
values to gcd must be integers.
Function type   Arithmetic
Syntax  (gcd number number)
Example (gcd 15 12) returns 3

getangle
getangle waits for user input of an angle and returns that angle in radians.  
Zero radians is defined by the system variable angbase and, normally, 
increases in a counterclockwise direction. The angle returned is based upon 
the current construction plane. You can type angles in a format recognized 
by angtof or by selecting two points.
You can use the optional prompt argument as a display prompt. The optional 
point argument specifies the base point in a 2D format. If the optional point 
is given, you can specify the angle by selecting the second point.
Function type   User Interface Tools
Syntax  (getangle [pt] [prompt])
Example (setq angle (getangle "Enter starting angle: "))
See also        getcorner, getdist, getint, getkword, getorient, getpoint
		getreal, getstring, initget

getcorner
getcorner returns a point similar to getpoint. The point argument specifies 
the first corner of the rectangle which getcorner rubberbands as the user 
moves the cursor to select the second point of the rectangle. getcorner 
returns the opposite point describing a rectangle from the specified point. 
The optional prompt argument can be supplied to describe the action for the 
user. If the prompt is not supplied, getcorner does not display a prompt.
Function type   User Interface Tools
Syntax  (getcorner pt [prompt])
Example (setq pt (getcorner '(1.0 1.0) "Select other corner:"))
See also        getangle, getdist, getint, getkword, getorient, getpoint
		getreal, getstring, initget

getdist
getdist accepts a distance or one or two points from the user and returns the 
distance between those points. All distances are returned as a real number.  
You can give the distance to getdist by selecting two points. Much like 
getcorner, getdist accepts an optional point as the first point, allowing the 
user to rubberband to select the second point from which to calculate the 
distance. You can supply the optional prompt argument to describe the 
action. If the prompt is not supplied, getdist does not display a prompt.
Function type   User Interface Tool
Syntax  (getdist [pt] [prompt])
Example (setq dist (getdist '(0.0 0.0) "Select second point: "))
See also        getangle, getcorner, getint, getkword, getorient
		getpoint, getreal, getstring, initget

getenv
getenv returns the value of the specified operating system. When the variable 
is undefined, getenv returns nil.
Function type   Miscellaneous
Syntax  (getenv "variable")
Example (getenv "PATH") might return "c:/dos;c:/cadkey"

getint
getint pauses for input of an integer number by the user. The optional 
prompt argument can be displayed to further describe the action to be taken. 
getint returns the user specified integer or nil.
Function type   User Interface Tools
Syntax  (getint [prompt])
Example (getint "Enter an integer: ")
See also        getangle, getcorner, getdist, getkword, getorient, getpoint
		getreal, getstring, initget

getkword
getkword gets a keyword from the user. The valid keywords are defined by 
initget and must be established prior to calling getkword. If the input given 
by the user is invalid, getkword returns nil providing a null input is allowed 
by initget, otherwise getkword returns the matching keyword. If initget was 
not called just prior to getkword, getkword returns nil.
Function type   User Interface Tools
Syntax  (getkword [prompt])
Example (initget 1 "Yes No")
(setq
	kword (getkword "Continue? (Y/N): ")
)
See also        getangle, getcorner, getdist, getint, getorient, getpoint
		getreal, getstring, initget

getorient
getorient returns the user supplied angle where the angle is always measured 
as zero degrees being to the right (east). Similar to getangle, getorient 
expresses the returned angle in radians and with respect to the current 
construction plane. getorient utilizes the system variables angdir and 
angbase. 
The returned value represents the setting of angbase added to the result. For 
example: if angdir = 0 and angbase = 1.5708, an angle of 90 degrees is 
returned as 3.14159. Also, if angdir = 1 and angbase = 0, an angle of 90 
degrees is returned as 4.7124.
Function type   User Interface Tools
Syntax  (getorient [pt] [point])
Example (getorient '(0.0 0.0) "Please enter an angle")
See also        getangle, getcorner, getdist, getint, getkword, getpoint
		getreal, getstring, initget

getpoint
getpoint obtains a point from the user. The optional point argument specifies 
a base point in the current UCS from which a rubberband line will be drawn 
when the point is selected.  The optional prompt describes the input the user 
is to supply. When no prompt is given, getpoint does not display a prompt.  
getpoint functions much like getcorner. getpoint returns the user specified 
point or nil.
Function type   User Interface Tools
Syntax  (getpoint [pt] [prompt])
Example (setq pt (getpoint "Select a point: "))
See also        getangle, getcorner, getdist, getint, getkword, getorient
		getreal, getstring, initget

getreal
getreal pauses for input of a floating point number by the user. The optional 
prompt argument can be displayed to further describe the action to take. 
getreal returns a user specified real number or nil.
Function type   User Interface Tools
Syntax  (getreal [prompt])
Example (getreal "Enter a real number: ")
See also        getangle, getcorner, getdist, getint, getkword, getorient,
		getpoint, getstring, initget

getstring
getstring pauses for user input of a string. The string the user supplies is 
returned. If the string is greater than 132 characters, getstring only returns 
the first 132 characters. getstring converts the backslash character (\) to a 
double backslash character (\\). When processing file names, a double 
backslash is required for the path.
getstring accepts an optional flag to specify whether or not getstring should 
allow spaces. If the flag option is supplied and not nil, getstring accepts 
spaces and the string must be terminated by the user pressing <Return>. When the 
optional flag is not present or is nil, getstring terminates the string when it 
encounters a space or <Return>.
The optional prompt argument can further describe the action to take.
getstring does not honor the flags set by initget.
Function type   User Interface Tools
Syntax  (getstring [flag] [prompt])
Example (getstring T "Enter something: ") allow spaces
(getstring "Enter something: ") disallow spaces
See also        getangle, getcorner, getdist, getint, getkword, getorient,
		getpoint, getreal, initget

getvar
getvar retrieves the given system variable. 

All system variables must be enclosed by double quotation marks.
Function type   System Variables
Syntax  (getvar "variable")
Example (setq echo (getvar "cmdecho"))
See also        setvar 

graphscr
graphscr switches control to the graphics window. 
Function type   Screen Management
Syntax  (graphscr)
Example (graphscr)
Complement      textscr
See also        textpage, textscr

grclear
grclear clears the screen of all graphics, although they are not deleted. Use 
the redraw function to restore the screen to its original contents.
Function type   Graphics Manipulation
Syntax  (grclear)
Example (grclear)
See also        redraw

grdraw
grdraw draws a vector between pt1 and pt2 in the color specified by color. 
The vector drawn on the screen using grdraw is not written to the database. 
Multiple vectors may be displayed on the screen using grvecs.
To redisplay the contents of the screen, use the redraw function. The 
highlight option is not supported but accepted for compatibility.
Function type   Graphics Manipulation
Syntax  (grdraw pt1 pt2 color [highlight])
Example (grdraw '(0.0 0.0) '(5.0 5.0) 3 1)
See also        grvecs, redraw

grtext
grtext displays a given string in a specified location. The only currently 
supported location is:
	Code    Location
	1       CADKEY prompt line.
The highlight option in CADKEY LISP is not supported. Calls to grtext 
without arguments clear the specified location.
Function type   Graphics Manipulation
Syntax  (grtext [box# text [highlight]])
Example (grtext  1 "Press any key to continue...")

grvecs
grvecs draws multiple vectors in the graphics window. The vectors are not 
written to the database. vectlist is a list consisting of an optional color and a 
required set of points, pt1 and pt2. The optional trans argument is a four-by-
four transformation matrix which allows for a change in location or 
proportion of the vectors defined in vectlist.
Function type   Graphics Manipulation
Syntax  (grvecs vectlist [trans])
Example (grvecs  ‘(     5 (3 6) (2 4) returns blue line from 3,6 to 2,4
		4 (4 6) (2 4) returns cyan line from 4,6 to 2,4
		   (5 6) (2 4) returns cyan line from 5,6 to 2,4
		3 (6 6) (2 4)) returns green line from 6,6 to 
							2,4
)
See also        grdraw, redraw

handent
Entity handles (handent) are not supported in CADKEY LISP. To 
accommodate those applications utilizing handles, calls to handent with a 
given handle number return the entity's name. Entity names are maintained 
between sessions in CADKEY.
Function type   Entity Manipulation
Syntax  (handent "handle")
Example (handent "110") returns #(110 0)

if
if evaluates the first condition and, if not nil, executes the first expression; 
otherwise, it executes the second expression. For multiple lines in either the 
first or second expression, see the function progn.
Function type   Special Forms
Syntax  (if test then [else])
Example (if (/= a 3.0)
	(princ "A does not equal 3.0")
; else
	(princ "A is equal to 3.0")
)
See also        cond, progn

initget
initiget defines the appropriate input options that are accepted by the entsel, 
getangle, getcorner, getdist, getint, getkword, getorient, getpoint and getreal 
functions.
The optional control argument specified as an integer (bit coded) can be 
supplied to more clearly define acceptable input from the user. The optional 
string argument to initget is used to define the acceptable keyword 
possibilities.  The optional controls are:
Bit value       Description
	1       null input is disallowed.
	2       Zero values are disallowed.
	4       Negative numbers are disallowed.
	8       Ignore drawing limits, as well as limcheck.
	16      Not used.
	32      Not supported by CADKEY LISP.
	64      Z-coordinates are disallowed (getdist only).
	128     Arbitrary keyboard input.
The following listing defines which settings are supported for each of the getx 
functions.
getangle:       1, 2, 128
getcorner:      1, 8, 128
getdist:        1, 2, 4, 128
getint:         1, 2, 4, 128
getkword:       1, 128
getorient:      1, 2, 128
getpoint:       1, 8, 128
getreal:        1, 2, 4, 128
getstring:      n/a
The keywords specified by the optional string argument define the 
possibilities which getkword accepts. Keywords are defined as:
o       Separated from each other by a space.
o       Used to recognize an abbreviation in two cases, either the unique letter in 
each word is capitalized, as in First Second Third fouRth or the keyword 
is all caps and separated by a comma, as in FIRST,FI SECOND,SE.
o       The required characters after the comma must be the first characters of 
the full keyword.
Function type   User Interface Tools
Syntax  (initget [control] [string])
Example (initget 128 "First Second")
(setq option (getkword "Enter position: (First/Second): "))
See also        getangle, getcorner, getdist, getint, getkword, getorient
		getpoint, getreal, getstring

inters
inters calculates the intersection of two lines specified by the four required 
arguments. It returns the point where they intersect. The first two arguments 
are the start point and end point of the first line, respectively. Likewise the 
third and fourth arguments are the start point and end point of the second 
line, respectively. inters accepts an optional argument (onseg) and if it is 
present and nil, inters assumes the lines are infinite and returns the 
intersection even if the lines do not cross, otherwise the intersection point 
must lie on both lines.
Function type   Miscellaneous
Syntax  (inters pt1 pt2 pt3 pt4 [onseq])
Example (inters '(3.0 0.0) '(3.0 3.0) '(0.0 1.0) '(4.0 1.0) 
			returns (3.0 1.0 0.0)

itoa
itoa returns the ASCII "string" of a given integer.
Function type   Arithmetic
Syntax  (itoa int)
Example (itoa 5) returns "5"

lambda
lambda is used to define functions "in-line". In-line functions are useful when 
the details associated with defining a completely new function are 
unnecessary. lambda returns the value of the last evaluated expression.
Function type   Evaluator
Syntax  (lambda arguments expression ...)
Example (mapcar
	‘(lambda (x y z)
		(list x y z)
	)
	‘(1 10.5) ‘(2 12.25) ‘(3 6.5)
)                       returns ((1 3 2) (10.5 6.5 12.25))
See also        apply, mapcar

last
last returns the list of the last element in a given list. The last element which 
last returns can be either a list or an atom.
Function type   List
Syntax  (last  list)
Example (setq lst '(a b c d e f))
(last lst) returns f
See also        append, assoc, car, cdr, c????r, cons, length, list

length
length returns the number of elements in a given list.
Function type   List
Syntax  (length list)
Example (length '(1.0 2.0 3.0 4.0)) returns 4
(length '(1 2 (5 6) (3 4))) returns 4
(length '()) returns 0
See also        append, assoc, car, cdr, c????r, cons, last, list

list
list accepts a variable number of expressions and returns a list of the 
expressions.
Function type   List
Syntax  (list expression expression...)
Example (setq lst (list ‘a ‘b '(x y z))) returns (a b (x y z))
See also        append, assoc, car, cdr, c????r, cons, last

listp
listp returns T if a given item is a list and nil otherwise. 
Function type   Predicate
Syntax  (listp item)
Example (setq
	lst '(1 2 3)
	a 1.0
)
(listp lst) returns T
(listp a) returns nil
Complement      atom
See also        atom

load
load reads an existing .lsp file from disk and enters the functions defined in 
the file into the atoms-family. If the file contains expressions which are 
outside of defuns, those expressions are evaluated at the time of loading. All 
paths to filenames in CADKEY LISP utilize double backslashes (\\) or a 
single forward slash (/) instead of the normal DOS backslash (\). The .lsp 
extension is not required when loading a file; it is assumed.
Function type   System Functions
Syntax  (load "filename")
Example (load "c:/cadkey/lsp/myline.lsp")

log
log returns the natural logarithm of a given value.
Function type   Arithmetic 
Syntax  (log number)
Example (log 2.3) returns 0.8329

logand
logand returns the result of a logical bitwise and a given list of numbers. All 
arguments to logand must be integers. The return values from logand are 
always integers.
Function type   Bitwise Operator
Syntax  (logand number number number ...)
Example (logand 5 3 1) returns 1
See also        ~, boole, logior, lsh

logior
Function type   Bitwise Operator
Syntax  
Example 
See also        ~, boole, logand, lsh

lsh
lsh performs a logical bitwise shift of x by y bits. Both x and y must be 
integers. The return value of lsh is an integer. Provided that x is positive, y is 
shifted left, conversely, if x is negative, y is shifted right. Zero bits are shifted 
in and shifted out bits are ignored.
Function type   Bitwise Operator
Syntax  (lsh x y)
Example (lsh 5 3) returns 40
See also        ~, boole, logand, logior

mapcar
mapcar executes a given function with the list of supplied arguments. It 
returns a list which is the result of executing the given function. mapcar 
expects the number of arguments supplied in the list of arguments to match 
the number of arguments required by the function being called.
Function type   List
Syntax  (mapcar function argument list...)
Example See lambda.
See also        lambda

max
max returns the largest number of the numbers given as arguments. max 
returns an integer if all the numbers given to it are integers. max returns a 
real if any one of the numbers given to it are of type real.
Function type:  Arithmetic
Syntax  (max number number number ...)
Example (max 1.0 4.0 0.5 3.3) returns 4.0
(max 1 2 3 4 5) returns 5
(max 1 1.5 3 4 5) returns 5.0
Complement      min
See also        min

mem
mem returns the memory statistics of the CADKEY LISP interpreter. Some of 
the return values can be modified using alloc.
Function type   Miscellaneous
Syntax  (mem)
Example (mem)
See also        alloc

member
member searches a given list for a given expression and returns the 
remainder of the list. When the expression does not exist in the given list, 
member returns nil.
Function type   List
Syntax  (member expression list)
Example (member '1 '(5 1 2 3))  returns (1 2 3)
(member '1.0 '(2.5 2.0 3.0)) returns nil
See also        assoc, car, cdr, c????r, last, nth

min
min returns the smallest number of the numbers given as arguments. min 
returns an integer if all the numbers given to it are integers. min returns a 
real if any one of the numbers given to it are of type real.
Function type   Arithmetic
Syntax  (min number number number ...)
Example (min 1.0 4.0 0.5 3.3) returns 0.5
(min 1 2 3 4 5) returns 1
(min 1 1.5 3 4 5) returns 1.0
Complement      max
See also        max

minusp
minusp returns T if a given item is negative or evaluates to a negative value. 
Otherwise, minusp returns nil.
Function type   Predicate
Syntax  (minusp item)
Example (minusp -1.0) returns T
(setq x -3.5)
(minusp x) returns T
(minusp 1.0) returns nil

not
not evaluates an argument and returns T when it is false.
Function type   Special Forms
Syntax  (not argument)
Example (not (= 1.0 1.0) returns nil
(not (/= 1.0 1.0) returns T
See also        and, or

nth
nth returns the Nth element in a given list.
Function type   List
Syntax  (nth element list)
Example (nth 3 '(a b c d e f)) returns c
See also        assoc, car, cdr, c????r, last, member

null
null returns T if a given item is bound (= nil). Otherwise, null returns nil.
Function type   Predicate
Syntax  (null item)
Example (setq x 5.0 y nil)
(null x) returns nil
(null y) returns T
Complement      boundp
See also        boundp

numberp
numberp returns T if a given item is an integer or a floating-point number. 
Otherwise, numberp returns nil.
Function type   Predicate
Syntax  (numberp item)
Example (numberp 1.0) returns T
(setq a '(1.0 2.0 3.0))
(numberp a) returns nil

open
open opens the given filename for access as specified in the type argument. 
open returns the file descriptor created when the file is successfully opened, 
or nil if the opening of the file fails.
The options for type, which must be lowercase, are as follows: 
"w"     Creates and opens the given file for output. w can overwrite an 
existing file.
"r"     Opens the file for read. Returns nil if the file does not exist.
"a"     Opens the specified file for append. If the file does not exist, it is 
created and opened. If the file does exist, it is opened and the next character 
written to the file follows the last character in the file.

When providing the path to the open statement, be sure the slashes are 
forward slashes (/), unlike MS-DOS backslashes (\).
Function type   File Input/Output
Syntax  (open filename type)
Example (setq fp (open "test.out" "w"))         returns descriptor 
(setq fp (open "nothere.out" "r")) returns nil
See also        close

or
or returns the logical or of multiple items in a list. If at least one item in the 
list is bound (not nil), or returns T. Otherwise, or returns nil.
Function type   Special Forms
Syntax  (or item item ...)
Example (setq x 4.2 y nil)
(or 2.1 x) returns T
(or x y) returns T
(or x y 2.1) returns T
Complement      and
See also        and, not

pi
pi, a CADKEY LISP defined constant, is defined as 3.1415926.
Function type   Miscellaneous
Syntax  pi
Example (setq x (+ 1 pi)) returns 3.1415926

polar
polar returns a three-dimensional point based upon the current UCS at the 
specified angle and distance from the supplied point. The angle must be 
specified in radians from the X-axis and increasing counterclockwise.
Function type   Miscellaneous
Syntax  (polar pt angle distance)
Example (polar ‘(2 2 1.5) 0.5 1.75)
		returns( 3.53577 2.83899 1.5)

prin1
prin1 prints the optional string to the screen or to the optionally given file 
descriptor. It returns the expression or string. The expression can be of any 
type. If the file descriptor is present and the file is open for output, prin1 
prints the expression to the specified file exactly as it would be shown on the 
screen. 
Unlike print, prin1 does not precede the output with a newline. prin1 can be 
used to print control and escape codes to both the screen and to output files.
The following control codes are recognized by prin1:
\\ - prints a single backslash character.
\" - prints the double quote character (").
\e - prints the escape character.
\n - prints the newline character.
\r - prints the return character.
\t - prints the tab character.
\ooo - prints the character whose octal code is ooo
Function type   Input/Output
Syntax  (prin1 [string [descriptor]])
Example (prin1) prints nothing
(prin1 "Hello world") prints "Hello world"
(prin1 "hello" fp) prints "hello" to file fp
(prin1 "\e" fp) prints escape to file fp
See also        princ, print

princ
princ prints the optional string or expression to the screen or to the 
optionally given file descriptor. It returns the expression. The expression can 
be of any type. If the file descriptor is present and the file is open for output, 
princ prints the expression to the specified file.
Unlike print, princ does not precede the output with a newline.
Unlike prin1 princ can be used to print control and escape codes 
unexpanded to the screen and to output files.
The following control codes are recognized by princ:
\\ - prints a single backslash character.
\" - prints the double quote character (").
\e - prints the escape character.
\n - prints the newline character.
\r - prints the return character.
\t - prints the tab character.
\ooo - prints the character whose octal code is ooo
Function type   Input/Output
Syntax  (princ [string [descriptor]])
Example (princ) prints nothing
(princ "Hello world") prints "Hello world"
(princ "hello" fp) prints "hello" to file fp
(princ "\e" fp) prints escape to file fp
See also        prin1, print

print
print, much like prin1 and princ, prints the given string to the screen 
(preceeded by newline) unless a descriptor is given. If file_desc is given, the 
output is directed to the file specified by the descriptor. print, without 
arguments, prints a newline only. print always prints a single space following 
the string. print returns the string which it was given.
Function type   Input/Output
Syntax  (print [string [descriptor]])
Example (print) prints a newline
(print "Hello world") prints "Hello world "
(print "hello" fp) prints "\nhello " to fp
See also        prin1, princ

prompt
prompt prints the given string to the "command" line area of the screen, 
informing the user of an action to take. prompt returns nil.
Function type   Input/Output
Syntax  (prompt string)
Example (prompt "Press any key to continue...") returns nil
See also        prin1, princ, print

progn
progn is used to group multiple expressions together in an if structure. The 
value of the last expression in a progn group is returned by progn.
Function type   Special Forms
Syntax  (progn expr expr expr ...)
Example (if (= a b)
	(progn
	...... do something here ...
	)       ; else
	(progn
	... do something else here ...
	)
)
See also        if

quit
quit, much like exit, cancels the current application and returns to the 
command prompt.
Function type   System Functions
Syntax  (quit)
Example (quit)
See also        exit

quote
quote returns an expression unevaluated. The shorthand notation for quote 
is ' (single apostrophe).
Function type   Evaluator
Syntax  (quote expression)
Example  (setq lst (quote a)) returns A

read
read retrieves the first atom or list from the given string and returns it 
according to its data type. For a string of text, the return value consists of 
the first letters preceding a space.
Function type   Input/Output
Syntax  (read string)
Example (read "hello world") returns hello as an atom
(read "1 2 3 4") returns the number 1
(read "(x y z) (a b c)") returns the list (x y z)

read-char
read-char reads a single character from either the keyboard or the optional 
file descriptor. The return value is the ASCII value of the character typed. If 
the file descriptor is not supplied, read-char waits for the user to enter a key 
on the keyboard followed by a <Return>. The first key the user presses is returned. 
Subsequent calls to read-char return all keys subsequently pressed by the 
user up to the <Return> or a space.
Function type   File Input/Output
Syntax  (read-char [descriptor])
Example (read-char) (user presses 'a' and <Return>) returns 97
See also        read-line, write-char, write-line

read-line
read-line reads a string from the keyboard or from the optionally specified file 
descriptor. If an end of file condition is encountered when reading from a file, 
read-line returns nil. Otherwise, read-line returns the string which it read.
Function type   File Input/Output
Syntax  (read-line [descriptor])
Example (read-line) returns "abc"
(read-line fp)   next line from the file fp
See also        read-char, write-char, write-line

redraw
redraw, if called without arguments, redraws the contents of the graphics 
window. If the optional ename is given, redraw redraws the specified entity 
on the screen. If the optional mode argument is supplied, the entity specified 
is redrawn according to the following table:
Mode    Type of redraw
1       Redraw the specified entity.
2       Undraw the specified entity.
3       Highlight the specified entity.
4       Unhighlight the specified entity.
Use redraw after using grvecs or grdraw to restore viewport contents.
Function type   Graphics Manipulation
Syntax  (redraw [ename [mode]])
Example (setq ename (cdar (entget (car (entsel)))))
(redraw ename 2) hide the entity
See also        grdraw, grvecs

repeat
repeat executes a given expression the specified number (positive) of times.
Function type   Special Forms
Syntax  (repeat number expression...)
Example (repeat 10
	(princ "\nHello world")
)
See also        while

rem
rem divides the first numeric argument by the second numeric argument and 
returns the remainder.
Function type   Arithmetic
Syntax  (rem number number)
Example (rem 2.5 2) returns .5
(rem 4 2) returns 0

reverse
reverse reverses the contents of a given list and returns the new list.
Function type   List
Syntax  (reverse list)
Example (reverse '(1 2 3)) returns (3 2 1)

rtos
rtos returns a string representing a real number based on the settings of the 
optional parameters: mode, precision, the system variable unitmode and 
dimzin. The mode and precision arguments correspond to the system 
variables lunits and luprec, respectively. rtos accepts the string in the same 
form which distof returns. The valid values for mode are:
1       scientific
2       decimal
3       engineering (feet/inches)
4       architectural feet/inches
5       fractional
Function type   Miscellaneous
Syntax  (rtos number [mode [precision]])
Example (rtos 40.0 4) returns "3’ 4\""
See also        distof

set
The set function sets the value of a quoted symbol to an expression and 
returns that value. For example:
(set 'qsymbol 3.62) returns 3.62 and sets qsymbol.
(set 'newsym 'qsymbol) returns qsymbol and sets newsym.
set can also be used to indirectly assign a new value to an unquoted symbol.  
Given the above example:
(set newsym 76) assigns 76 to qsymbol, indirectly.
Function type   Symbol
Syntax  (set symbol expression)
Example (set ‘var 3.5) returns 3.5 and sets var
See also        setq

setq
setq sets the value of a symbol to an expression. Multiple symbols may have 
values supplied by "pairing" symbol-expression combinations. If multiple 
assignments are performed, only the last assignment is returned.
Function type   Symbol
Syntax  (setq symbol expression ...)
Example (setq x 5.0) returns 5.0
(setq lst '(a b c d e)) returns (a b c d e)
See also        set

setvar
setvar sets the given system variable to the value specified. Enclose all 
system variable in quotes and set variables to values of the correct data type.
Function type   System Variables
Syntax  (setvar "variable" value)
Example (setvar "cmdecho" 0)
See also        getvar

sin
sin returns the sine of an angle. The angle must be expressed in radians. 
Function type   Arithmetic
Syntax  (sin angle)
Example (sin 3.1412) returns 0
Complement      cos, tan
See also        cos, tan

sqrt
sqrt returns the square root of a given number.
Function type   Arithmetic
Syntax  (sqrt number)
Example (sqrt 4) returns 2

ssadd
ssadd, if called without arguments, builds a new selection set with no 
members. If called with only a single entity name, ssadd returns a new 
selection set with only one entry. If called with an entity name and a 
selection set, ssadd adds the entity to the selection set. ssadd returns the 
new selection set. If the specified entity name already exists in the given 
selection set, no operation takes place and no error occurs.
Function type   Selection Set Tools
Syntax  (ssadd [ename [ss]])
Example (ssadd) returns a new, empty selection set
(ssadd ename) returns a new ss with one entry
(ssadd ename ss) returns ss with ename added
See also        ssdel, ssfree, ssget, sslength, ssmemb, ssname

ssdel
ssdel deletes the entity specified from the specified selection set. If the 
specified entity is not present in the given selection set, ssdel returns nil. 
Otherwise, ssdel returns the selection set less the specified entity name.

The selection set number is maintained instead of returning a new selection 
set.
Function type   Selection Set Tools
Syntax  (ssdel ename ss)
Example (ssdel ename selset)
See also        ssadd, ssfree, ssget, sslength, ssmemb, ssname

ssfree
ssfree releases the memory allocated to a given selection set, thus losing the 
contents of the specified selection set. Selection sets which have been ssfreed 
may be reused, but must be reassigned using ssget.

This function is not available in AutoLISP.
Function type   Selection Set Tools
Syntax  (ssfree selset)
Example (ssfree ss) frees the selection set ss.
See also        ssadd, ssdel, ssget, ssmemb, ssname

ssget
ssget returns a selection set. The optional mode argument aids in specifying 
the selection method to invoke. Additionally, two points constructing a 
window can be specified in which to limit the selection criteria. Unlike 
AutoLISP, the optional point-list argument only supports one point. Use the 
optional filter list to specify entities to select that match a given criteria. 
The following table details the options for ssget:
(ssget) General entity selections.
(ssget "P")     Most recently selected entities.
(ssget "L")     Last entity added to the database.
(ssget '(1 1))  All entities passing through point 1,1.
(ssget "W" '(1 1) '(3 3))
	All entities inside the window of 1,1 to 3,3.
(ssget "C" '(1 1) '(3 3))
	All entities crossing the window of 1,1 to 3,3.
(ssget "X")     All entities.
(ssget "X" filter)      
	All entities matching the specified filter.
(ssget filter)  General selection with only entities matching the given 
filter being returned.
(ssget "P" filter)
	Most recent entities matching filter.
Unlike AutoLISP, the I, WP, CP and F arguments for mode are not supported. 
CADKEY LISP supports up to 256 selection sets.
Selection set filters operate with all of the ssget selection modes. A selection 
set filter list is equivalent to an association list. See entget for a discussion 
on association lists.
Function type   Selection Set Tools
Example (ssget "X" ‘((0 . "CIRCLE") (62 . 1)))

ssget supports relational tests. Relational tests are used to further specify the 
entities to include in a selection set. Relational tests are included in typical 
filter lists with a group code of -4 and apply to the group immediately 
following.
Example (ssget "X" ‘((0 . "CIRCLE") (-4 . "=") (40 . 1.0)))
The following relational tests may be included in a filter list:
	*       Wildcard. Everything matches.
	=       Equals. Values must match.
	!=      Not equals.
	/=      Not equals.
	<>      Not equals.
	<       Less than.
	<=      Less than or equal to.
	>       Greater than.
	>=      Greater than or equal to.
	&       Bitwise AND.
	&=      Bitwise mask equal to.

Boolean operators may be nested inside filter lists to further describe the 
selection criteria. Boolean operators are used to logically group relational 
tests in a given filter list. Boolean operators are also indicated by preceding -
4 group codes. All Boolean operators must be balanced in a filter list. The 
following Boolean operators may be utilized in filter lists:

	Starting                                                Ending
	<AND            one or more operands            AND>
	<OR             one or more operands            OR>
	<XOR            two operands                    XOR>
	<NOT            one operand                     NOT>

Syntax  (ssget [mode] [pt1] [pt2] [point-list] [filter])
Example
	(ssget "X" ‘((-4 . "<OR")
			(-4 "<AND")
				(0 . "LINE")
				(62 . 5)
			(-4 "AND>")
			(-4 "<AND")
				(0 . "ARC")
				(40 . 0.25)
			(-4 "AND>")
		(-4 . "OR>"))
	)
Returns a selection set containing blue lines and arcs with a radius of 
0.25.
See also        ssadd, ssdel, ssfree, sslength, ssmemb, ssname, sslength

sslength
sslength returns the number of entities in the specified selection set. Values 
are returned as an integer. If the selection set is empty, the value returned is 
0.
Function type   Selection Set Tools
Syntax  (sslength ss)
Example (setq slength (sslength selset))
See also        ssadd, ssdel, ssfree, ssget, ssmemb, ssname

ssmemb
ssmemb determines whether the specified entity is a member of the given 
selection set. If the entity is a member, the entity name is returned. If not, 
ssmemb returns nil.
Function type   Selection Set Tools
Syntax  (ssmemb ename ss)
Example (setq ename (cdar (entget (car (entsel)))))
(if (/= (ssmemb ss ename) nil)
	(princ "Selected entity is a member of 'ss'.")
)
See also        ssadd, ssdel, ssfree, ssget, sslength, ssname

ssname
ssname returns the entity name which resides at the i'th position in a 
specified selection set.  If i is out of range of the possible entries in the 
selection set, ssname returns nil.
Function type   Selection Set Tools
Syntax  (ssname ss i)
Example (setq ename (ssname ss 5))
(if (/= ename nil)
	(redraw ename 3) highlight entity #5 in ss.
)
See also        ssadd, ssdel, ssfree, ssget, sslength, ssmemb

strcase
strcase returns the given string in all uppercase if the optional parameter 
type is omitted or it evaluates to nil. Otherwise, strcase converts the given 
string to lowercase.
Function type   String
Syntax  (strcase string [type])
Example (strcase "Hello") returns "HELLO"
(strcase "Hello" T) returns "hello"

strcat
strcat concatenates two or more strings into one and returns the resultant 
string.
Function type   String
Syntax  (strcat str str str...)
Example (strcat "See " "Spot " "run") returns "See Spot run"

strlen
strlen returns the length, in characters, of a given string of text.
Function type   String
Syntax  (strlen string)
Example (strlen "See Spot run.") returns 13

subst
subst searches a given list for an existing item and, if found, replaces every 
occurrence of the existing item with the new item. If the existing item cannot 
be found in the given list, subst returns the original list unchanged.
Function type   List
Syntax  (subst new existing list)
Example (setq lst '("a" "b" "c"))
(subst "d" (car lst) lst) returns ("d" "b" "c")

substr
substr returns the substring from a given string starting at offset and, 
optionally, continuing len characters. If len is not specified, the remainder of 
the string from offset is returned.
Function type   String
Syntax  (substr string offset [len])
Example (substr "See Spot run." 4 4) returns "Spot"

tan
tan returns the tangent of an angle. The angle must be expressed in radians. 
Function type   Arithmetic
Syntax  (tan angle)
Example (tan 3.1412) returns 0
Complement      sin, cos
See also        cos, sin

terpri
terpri prints a newline to the output screen in the command area.
Function type   Input/Output
Syntax  (terpri)
Example (terpri)

textbox
textbox returns the lower left and upper right coordinates of a rectangle 
which defines the perimeter of a given text entity. The rectangle defined by 
the points returned always encompasses the entire text string, regardless of 
oblique angle or slant with the exception of descending characters such as j 
and p. The lower-left point returned is always 0,0 and the upper-right point 
is relative to the first point. The return value of textbox is a list of two three-
dimensional points. The specified entity must be of type text.
Function type   Miscellaneous
Syntax  (textbox ename)
Example (setq e (entget (car (entsel "\nSelect text: ")))
	  l (textbox e)
	  len (caadr l)
	  hgt (cadadr l)
	  p1 (cdr (assoc 10 e))
	  ang (cdr (assoc 50 e))
	  p2 (polar p1 ang len)
	  p3 (polar p2 (+ ang 1.57) hgt)
	  p4 (polar p1 (+ ang 1.57) hgt)
)
(command ".line" p1 p2 p3 p4 "c")

textpage
textpage switches control to the "command-line" dialog box and clears the 
contents of the window. This function is equivalent to the CLS MS-DOS 
command for clearing the screen. Unlike textpage, textscr does not clear the 
screen when executed.
Function type   Screen Management
Syntax  (textpage)
Example (textpage)
Complement      textscr
See also        graphscr, textscr

textscr
textscr switches control to the "command-line" dialog box window. Unlike 
textpage, textscr does not clear the window after switching to it. 
Function type   Screen Management
Syntax  (graphscr)
Example (graphscr)
Complement      graphscr
See also        graphscr, textpage

trace
trace adds the specified function to CADKEY LISP’s trace list. Whenever a 
function in the trace list is entered or exited, a message is printed to the 
screen. The function returns a list containing the names of all functions 
being traced.
Function type   Debugging and Errors
Syntax  (trace function)
Example (trace myline)
See also        untrace

type
type returns the data type of a given item. The possible values which type 
may return are:
	int - integers
	real - real numbers (floating point)
	file - a file handle
	str - a string of text
	sym - a symbol
	list - a list
	subr - a subroutine
	pickset - selection sets
	ename - an entity name
Function type   Predicate
Syntax  (type item)
Example (type 1.0) returns real
(type '(a b c)) returns list

untrace
untrace removes a function from the trace list and returns the list of all 
remaining functions in the trace list.
Function type   Debugging and Errors
Syntax  (untrace function)
Example (untrace function)
See also        trace

ver
ver returns the current version of CADKEY LISP in use.
Function type   System Functions
Syntax  (ver)
Example (ver)

vmon
vmon turns on the virtual memory system inside CADKEY LISP, which is on 
by default.
Function type   Miscellaneous
Syntax  (vmon)
Example (vmon)

wcmatch
wcmatch performs a wild card pattern match on a given string versus a given 
pattern. Both the string and the pattern must be quoted strings. If a match is 
found, wcmatch returns T, otherwise nil is returned. 
Valid characters that may be used in the pattern are:
#       Matches any single numeric digit.
@       Matches any single alphabetical character.
.       Matches any single non alphanumeric character.
*       Matches any series of characters, including "".
?       Matches any single character.
~       If it is the first character in the pattern, it matches 
anything except the pattern.
[...]   Matches any one of the characters enclosed.
[~...]  Matches any single character not enclosed.
-       Used inside brackets to specify a range for a single 
character.
,       Separates two patterns.
`       Escapes special characters, reads next character literally.
Function type   Miscellaneous
Syntax  (wcmatch string pattern)
Example (wcmatch "Test" "T*") returns T

while
while evaluates a given test expression and if it is not nil, evaluates any 
following expressions. This procedure is repeated until the test expression 
returns nil.
Function type   Special Forms
Syntax  (while test expression...)
Example (setq x 0)
(while (/= x 10)
	(setq x (1+ x))
)
See also        repeat

write-char
write-char writes a single character to the screen or to an optionally specified 
file descriptor. The character supplied is the ASCII code for the desired 
character. The given character is returned by write-char.
Function type   File Input/Output
Syntax  (write-char char [descriptor])
Example (write-char 97) prints a
See also        read-char, read-line, write-line

write-line
write-line writes the specified string to either the screen or to an optionally 
supplied file descriptor. If the string is written to a file, the double quotation 
marks are omitted. The given string is returned by write-line.
Function type   File Input/Output
Syntax  (write-line string [descriptor])
Example (write-line "hello")
		prints "hello" and returns "hello"
(write-line "hello" fp)
		writes hello and returns "hello"
See also        read-char, read-line, write-char

zerop
zerop returns T if a given item is or evaluates to 0, otherwise zerop returns 
nil.
Function type   Predicate
Syntax  (zerop item)
Example (zerop 0.0) returns T
(setq a 1.0)
(zerop a) returns nil

Entity group codes

Arc

Code    Type    Entmake Entmod  Description
		Required        Read only

-1      ename   X               Entity name
0       string  X       X       Start entity - "ARC"
6       string                  Line type
8       string                  Layer name
62      integer                 Color
10      3dpoint X               Center point
40      real    X               Radius
50      angle   X               Starting angle
51      angle   X               Ending angle
80      integer                 View number
210     3dpoint                 Normal vector

Circle

Code    Type    Entmake         Entmod  Description
		Required        Read only

-1      ename   X               Entity name
0       string  X       X       Start entity - "CIRCLE"
6       string                  Line type
8       string                  Layer name
62      integer                 Color
10      3dpoint X               Center point
40      real    X               Radius
50      angle           X       Starting angle (0)
51      angle           X       Ending angle (360)
80      integer                 View number
210     3dpoint                 Normal vector

Dimension

Horizontal, Aligned and Vertical dimensions

Code    Type    Entmake         Entmod  Description
		Required        Read only

-1      ename           X       Entity name
0       string  X       X       Start entity "DIMENSION"
6       string                  Line type
8       string                  Layer name
62      integer                 Color
70      integer X       X
			X
			X
			X       Dimension type
				0 - horizontal
				1 = aligned
				2 = vertical
1       string                  Dimension text
10      3dpoint                 Definition point
11      3dpoint X               Text point
13      3dpoint X               Reference line end point
14      3dpoint X               Reference line end point
50      real    X               Measurement axis
80      integer                 View number

Diameter and Radial Dimensions

Code    Type    Entmake Entmod  Description
		Required        Read only

-1      ename           X       Entity name
0       string  X       X       Start entity "DIMENSION"
6       string                  Line type
8       string                  Layer name
62      integer                 Color
70      integer X       X
			X
			X       Dimension type
				3 = diameter
				4 = radial
1       string                  Dimension text
10      3dpoint                 Definition point
11      3dpoint X               Text point
15      3dpoint                 Dimension reference point
16      3dpoint X               Reference center point
40      real    X               Reference radius
50      angle   X               Starting angle (degrees)
51      angle   X               Ending angle (degrees)
80      integer                 View number

Angular dimensions

Code    Type    Entmake         Entmod  Description
		Required        Read only

-1      ename   X               Entity name
0       string  X       X       Start entity "DIMENSION"
6       string                  Line type
8       string                  Layer name
62      integer                 Color
70      integer X       X       Dimension type
			X       5 = angular
1       string                  Dimension text
10      3dpoint X               Ref. line #2, end point
11      3dpoint X               Text point
13      3dpoint X               Ref. line #1, start point
14      3dpoint X               Ref. line #1, end point
15      3dpoint X               Ref. line #2, start point
16      3dpoint                 Definition point
71      integer X               In-angle dimension flag
80      integer                 View number

Label (complex)

Code    Type    Entmake         Entmod  Description
		Required        Read only

-1      ename           X       Entity name
0       string  X       X       Start entity - "LABEL"
8       string                  Layer name
62      integer                 Color
10      2dpoint X               Insertion point
40      real                    Text height
1       string  X               Text string
50      real                    Text angle
51      real                    Text slant
41      real                    X-scale multiplier
7       string                  Text style
71      integer                 Text mirror flag
				2 = mirrored
				4 = upside down
72      integer                 Horizontal text alignment
				0 = left justified
				1 = centered
				2 = right justified
				3 = middle 
				4 = aligned
				5 = fit 
73      integer                 Vertical text alignment
				0 = baseline
				1 = bottom
11      3dpoint                 Alignment point
74      integer         X       Number of witness lines
75      integer         X       Number of leader lines
78      integer         X       Qty. witness + leader lines
80      integer                 View number
210     3dpoint                 Normal vector

Witness lines 
(5 maximum, each in independent list):

Returned with subsequent calls to entget.

Code    Type    Entmake         Entmod  Description
		Required        Read only

-1      ename           X       Entity name
0       string  X       X       Start "LABEL:WITNESS"
6       string                  Line type
10      3dpoint X               Starting x,y point
11      3dpoint X               Ending x,y point
40      real                    Width of witness line
62      integer                 Color
78      integer         X       Witness line number

Leader lines 
(5 maximum, each in independent list):

Returned with subsequent calls to entget.

Code    Type    Entmake         Entmod  Description
		Required        Read only

-1      ename           X       Entity name
0       string  X       X       Start "LABEL:LEADER"
78      integer                 Leader line number
62      integer                 Color
6       string                  Line type
40      real                    Width of leader line
10      2dpoint X               Starting x,y point
11      2dpoint X               Ending x,y point
Line
Code    Type    Entmake Entmod  Description
		Required        Read only
-1      ename           X       Entity name
0       string  X       X       Start entity - "LINE
6       string                  Line type
8       string                  Layer name
10      3dpoint X               Start point
11      3dpoint         X       End point
80      integer                 View number
210     3dpoint                 Normal vector

Node

Code    Type    Entmake         Entmod  Description
		Required        Read only

-1      ename           X       Entity name
0       string  X       X       Start entity - "VERTEX"
78      integer X               Point number
10      3dpoint X               Vertex point
40      real                    Starting width
41      real                    Ending width

Point

Code    Type    Entmake Entmod  Description
		Required        Read only

-1      ename           X       Entity name
0       string  X       X       Start entity - "POINT
8       string                  Layer name
10      3dpoint X               Insertion point
62      integer                 Color
80      integer                 View number
210     3dpoint                 Normal vector

Polygon (complex)

Code    Type    Entmake Entmod  Description
		Required        Read only

-1      ename           X       Entity name
0       string  X       X       Start entity - "POLYGON"
66      integer                 Vertices follow flag
6       string                  Line type
8       string                  Layer name
62      integer                 Color
77      integer                 Fill
78      integer         X       Qty. of vertices to follow
80      integer                 View number
210     3dpoint                         Normal vector

Polyline (complex)

Code    Type    Entmake Entmod  Description
		Required        Read only

-1      ename           X       Entity name
0       string  X       X       Start entity - "POLYLINE"
6       string                  Line type
8       string                  Layer name
62      integer                 Color
10      point           X       z-value = elevation
40      real                    Starting width (0-15, odd)
41      real                    Ending width (0-15, odd)
70      integer                 Type
				0 = open (default)
				1 = closed
				2 = filled
76      integer                 Display style
				0 = center
				1 = round
				2 = sharp
				3 = tool path
77      integer                 Fill mode
				0 = outline
				1 = filled
78      integer          X      Qty. of vertices to follow
80      integer                 View number
210     3dpoint                 Normal vector

Seqend

Code    Type    Entmake         Entmod  Description
		Required        Read only

-1      ename           X       Entity name
0       string  X       X       Start entity - "SEQEND"
-2      ename           X       Sequence end

Spline (complex)

Code    Type    Entmake Entmod  Description
		Required        Read only

-1      ename           X       Entity name
0       string  X       X       Start entity - "SPLINE"
6       string                  Line type
8       string                  Layer name
39      real                    Depth
62      integer                 Color
70      type    X       X       Spline type
				1 = 2d spline,
				6 = 3d spline,
78      integer         X       Qty. of nodes which follow
80      integer                 View number
210     3dpoint                 Normal vector

Text

Code    Type    Entmake         Entmod  Description
		Required        Read only

-1      ename           X       Entity name
0       string  X       X       Start entity - "TEXT"
1       string  X               Text string
7       string                  Text style
8       string                  Layer name
10      2dpoint                 Insertion point
11      2dpoint                 Alignment point
40      real                    Text height
41      real                    X-scale multiplier
50      real                    Text angle
51      real                    Text slant
62      integer                 Color
71      integer                 Text mirror flag
				2 = mirrored 
				4 = upside down
72      integer                 Horizontal text alignment
				0 = left justified
				1 = center
				2 = right justified 
				3 = middle 
				4 = aligned 
				5 = fit 
73      integer                 Vertical text alignment
				0 = baseline
				1 = bottom
				2 = middle
				3 = top
80      integer                 View number
210     3dpoint                 Normal vector

Vertex

Code    Type    Entmake         Entmod  Description
		Required        Read only

-1      ename           X       Entity name
0       string  X       X       Start entity - "VERTEX"
78      integer         X       Point number
10      3dpoint X       X       Vertex point
40      real                    Starting width
41      real                    Ending width


Application Development Environment

The CADKEY LISP Application Development Environment, ADE, uses pull-
down menus and dialog boxes as its user interface. You can make menu 
selections with either a mouse or the keyboard. For the easiest access to 
menu items, use a mouse. You can also use a digitizer which emulates a 
Microsoft mouse.

ADE utilizes what is known as a "desktop". The desktop consists of any 
window or utility that is active in the environment at any time. Only one 
window can be active at a time. All main menu operations affect only the 
"active window" unless otherwise specified. When an operation is not 
available based on the current state of the desktop, related menu options are 
"grayed" out. Menu items which are followed by ... indicate that a dialog box 
will provide more information to complete the operation.

There are two types of dialog boxes:
o       A "modal" dialog box requires an action from the user before any other 
operation can take place. An example of this type of dialog box is the 
File:Open dialog box.  
o       A "constant" dialog box can be open and on the desktop at all times and 
does not require the full attention of the user. Other processes can 
continue while this dialog box is open. An example of this type of dialog 
box is the ASCII chart.

Using ADE

To use ADE, be sure the directory where the LISP programs and Help files 
are stored is in your path statement. At the DOS prompt type lspedit and 
press <Return>. At the main screen, a screen displaying a copyright notice and 
available memory appears.

Additionally, you can execute ADE from CADKEY at the Command prompt by 
typing the command lspedit. This forces CADKEY to shell out and execute 
ADE which reduces the code/test/debug cycle.

Even though ADE is available for editing CADKEY LISP Applications you can 
use any ASCII text editor.

Editor Controls

All windows contain controls. These controls consist of horizontal and 
vertical scroll bars, a window-sizing arrow, a window-sizing corner, a 
window-closing box, a title, a file position indicator, an edited indicator, and 
a window-moving bar.

Horizontal Scroll Bar

Use the horizontal scroll bar to move horizontally in the current editing 
window. The left arrow moves the position indicator to the left until the 
window scrolls as far left as possible. The right arrow moves the position 
indicator and scrolls the window to the right. You can select the position 
indicator with a mouse and drag it into position.

Vertical Scroll Bar

Use the vertical scroll bar in the same way as you use the horizontal scroll 
bar except the window is scrolled vertically instead of horizontally.
Window-sizing Arrow

Use the window-sizing arrow to change the size of the active window. To  
shrink the window to a smaller size click on the down arrow. To expand the 
window to its maximum size click on the up arrow.

Window-sizing Corner

Use the window-sizing corner to change the size of the window. Click on this 
control and drag the window in or out to change its size.

Window-closing Box

Use the window-closing box to close the active window. When you select this 
control on an editor window which contains an edited file ADE prompts you 
to save the file prior to closing the window.

Title

The title portion of the window (filename.lsp) shows the name of the window 
in use. If the window is an editor window, the name of the file being edited 
appears.

Window-moving Bar

Use the window-moving bar (----filename.lsp----) to move the window on the 
desktop. Selecting this portion of a window with the mouse and hold down 
the mouse button for ADE to allow you to reposition the window on the 
desktop.

File-position Indicator

The file-position indicator (11:30) shows the current line number and column 
position in the file being edited. The line number precedes the colon, :, and 
the column number follows the colon.

File-edited Indicator

The file-edited indicator (*), if present, indicates that the file in the current 
editor window needs to be saved prior to closing the window or exiting the 
environment.

Dialog Box Controls

Check Boxes

Use check boxes to select an optional item on a dialog box. All check boxes 
have a description explaining their purpose. Each check box has an active 
area which is between two braces, [ ]. Check boxes are "modal". They are 
either on or off. A check box which is on is filled in with an X. When a check 
box is off it is left blank. To turn a check box on select it. You can also type 
the highlighted character in the description of the check box to toggle a 
check box on or off.

Radio Buttons

Use radio buttons to select one option out of a group of options. Each radio 
button option has a highlighted character in the description which you use to 
select it. You can only select one radio button within a group.

Entry Fields

Use an entry field to enter a value or a string. The values which you can 
enter in entry fields must adhere to the type of information expected for that 
field. Do not enter alphabetic characters in a field which expects a numeric 
value.

Buttons

Use buttons to generate an activity within a dialog box. Typical buttons are: 
OK, Help and Cancel. Selecting these buttons tells ADE to take an action 
based on the button you pressed. Selecting the window-closing box tells ADE 
that the dialog box is Canceled.

Main Menu Options

The following section discusses each of the main menu options. Each main 
menu item in this section is underlined and each of the submenu item is 
bold and labeled with a colon.

Triple Bar

The Triple Bar menu option contains seven menu options. The main purpose 
of this menu is to allow the ADE user to add commands/programs to the 
menus. Choose a command by pressing the associated keys.

About

This menu option shows the copyright notice. There is no additional 
functionality behind this menu item.

User Setup

Use this menu option to define the programs to execute when you press [Alt]-
[x] (where x = 1 to 5).

Type the name of the program to execute in the Program name column. If the 
directory in which the executable resides is not defined in the active path, 
include the path.

If the program requires arguments, supply them in the Arguments column.
Check the Wait column if you want ADE to pause for a keystroke when the 
designated program finishes executing.

When entering commands to execute, make sure there is sufficient memory 
to execute the program from within ADE, otherwise the program may not 
load or execute.

User Program1-5

This menu item executes any user-defined program. You can run these items 
by pressing [Alt] together with the appropriate key, [1]-[5].

The following is a sample user program which executes a directory listing of 
*.lsp in the current working directory and pauses when finished.

Program name    Arguments       Wait
dir     *.lsp           X
File...

There are eight submenu options on the File menu. Use these menus to 
open/edit existing CADKEY LISP program files (*.lsp), to start a new .lsp file 
and to save the current file.

Open

Use the Open menu to open an existing CADKEY LISP ASCII file (*.lsp). The 
shortcut keystroke to this menu option is [F3].

The Name field in the Open menu dialog box determines the DOS mask to 
use to list the files in the Files field. The default mask is *.lsp for CADKEY 
LISP files. Change the mask by selecting the Name field and entering the new 
mask. You can supply a new path in the Name field to change directories and 
provide a new directory listing in the Files field. If you supply a different drive 
in the Name field, ADE changes drives and then updates the Files field.

If you know the name of the file you want to open, type it into the Name field. 
If you type in a path, ADE searches that drive/directory to open the file. If 
the file does not exist, ADE creates a new file with the name you supplied.
All files that match the mask supplied in the Name section are listed in the 
Files section of the dialog box. Select any file listed in that section by 
pressing [¿] and then locating the highlight bar on the proper selection with 
the arrow keys, or by double-clicking the mouse on the selection. If the file 
you want is not displayed, use the scroll bar on the bottom of the Files 
section to scroll the file list. The .. entry represents the parent directory 
which is immediately above the current working directory. Selecting .. forces 
a directory change to the parent of the current directory where a new list of 
files matching the Name will appear in the Files section.

As a file is highlighted in the Files section, information concerning the file 
appears on the bottom of the dialog box. This information includes the file's 
directory, name, size (in bytes), date and time.

New

Select New from the file menu to create a new editor on the desktop and open 
a file named noname.lsp. Use this menu option to create a new file. See the 
Save as menu option to name the file before you save, compile, or exit ADE.

Save

Use the Save menu option to save the active file. You can also access Save by 
pressing [F2].

Save as...

Use the Save as... menu option to save the current file to a new name. A 
dialog box much like the File Open dialog box appears for you to name the 
file. Type the file name into the Name field and/or select a different directory 
to write the file to by selecting the .. option in the Files section of the dialog 
box.

Save all

Use the Save all menu option to save all files in editor windows which are 
active on the desktop.

Change dir...

Use the Change dir... menu option to change the current working directory. 
This option uses a graphical directory structure that allows easy selection of 
a directory.

DOS Shell

Use the DOS Shell menu option to temporarily halt ADE and execute 
command.com. This is useful when you need to exit to DOS to perform some 
type of operation and then re-enter ADE.

Take care when executing programs while the environment is suspended 
because the ADE cannot protect itself from other programs. Also, memory is 
limited while the ADE is active in the background.

Exit

Use the Exit menu option to leave the Application Development Environment.

Edit

Use the Edit main menu option to undo an edit and to manage the clipboard 
contents. The utilities in this menu operate on "highlighted" pieces of text. To 
highlight a piece of text, place the cursor on the first character of the text you 
want and hold down [Shift] while moving the arrow keys to highlight the rest of 
the text.

Undo

Use the Undo option to reverse the last editing action you took.

Cut

Use the Cut option to remove a highlighted section of text from an editor 
window. The contents of the highlighted section are removed from the editor 
window and placed on the clipboard where you can insert them at another 
location in the window or into another window.

Copy

Use the Copy option to copy the highlighted section of text to the clipboard to 
insert at another location in the window or into another window.

Paste

Use the Paste option to copy the contents of the clipboard into the current 
cursor position within an editor window. You can view the contents of the 
clipboard by using the Show Clipboard menu option.

Show Clipboard

Use the Show Clipboard option to view or modify the contents of the 
clipboard. You can place sections of files on the clipboard where they stay 
until you exit ADE.

Clear

Use the Clear option to remove a highlighted section of text and NOT place it 
on the clipboard. You cannot recover this text which is permanently deleted.

Search...

Find...

Use the Find... option to find a string of text in a file. Define the string to find 
in the Text to find field of the Find dialog box. You can also use the Case 
sensitive and Whole words only check boxes on the dialog box to search more 
selectively. Case sensitive differentiates between "Hello" and "HELLO". Use 
Whole words only to distinguish between "Indianapolis" and "Indiana", for 
example.

Replace...

Use the Replace... option to search and replace a string in a file. Define the 
string to find in the Text to find field of the Replace dialog box. Define the 
replacement string in the New text field. You can also use the Case sensitive 
and Whole words only check boxes on the dialog box to search more 
selectively. Case sensitive differentiates between "Hello" and "HELLO". Use 
Whole words only to distinguish between "Indianapolis" and "Indiana", for 
example.

Use Prompt on replace to tell ADE to verify each replacement. Use Replace all 
to replace every occurrence of the search string.

Search again

Use the Search again option to search for the string already defined in the 
Find... menu option.

Environment...

Use the Environment main menu option to manage the contents of the 
desktop and to customize the environment. ADE utilizes two files to maintain 
the status of the environment between sessions. The first file, lspedit.cfg, 
contains all compiler settings, project file status and name (if active), window 
colors, etc. The second file, lspedit.dst, contains the definition of each 
window present on the desktop. This is the file that restores the desktop 
between editing sessions, restoring windows to their previous position and 
locating the cursor where it was at the time of exit.

Repaint desktop

Use the Repaint desktop menu option to refresh the contents of the desktop. 
Occasionally, after another program has been run from the user program list 
(See _:User Setup), the desktop contains miscellaneous and random text. Use 
Repaint desktop to eliminate these characters and to redisplay the desktop.

Clear desktop

Use the Clear desktop menu option to remove every window on the desktop. 
This includes editors, calculators, charts, etc. If an editor window is present 
on the desktop and the file contained in it needs saving, ADE will prompt you 
to save the file prior to clearing it.

Save desktop

Use the Save desktop option to save the current contents of the desktop to 
the file named abc.dst. This is done automatically when you exit to ease 
restoration of the environment between editing sessions.

Retrieve desktop

Use the Retrieve desktop option to retrieve the desktop from an existing 
lspedit.dst file previously created by ADE. If lspedit.dst does not exist in the  
present working directory, no action takes place.

Save Configuration

Use the Save Configuration option to store the status of compiler settings, 
colors, etc. to abc.cfg. After you make substantial changes, it's a good idea to 
save the configuration. Also, if you make extensive changes to color 
preferences, etc., it's a good idea to make a backup copy of abc.cfg.

Configure Environment

Use the Configure Environment option to indicate to ADE the default window 
operation and where to store the configuration file lspedit.cfg.

Multi-file Window Default

The Multi-file window default determines the behavior of ADE when multiple 
files are on the desktop at one time. The default for this value is None. 
Cascade tells ADE to layer editor windows on top of each other with just the 
title showing on the top of each window. Tile tells ADE to tile each editor 
window into equal sizes on the desktop which is useful when more than 
three files are on the desktop.

Save lspedit.cfg in

The ADE configuration file can be stored in one of two places:
o       In the present directory.
o       In the CADKEY LISP ADE directory where the executables reside. A 
typical example of this directory is c:\cadkey\lsp.

If lspedit.cfg is not found in the present directory, ADE searches the directory 
of executables. By storing the configuration file in the present directory, 
multiple configurations can be maintained - one for each project/ 
subdirectory.

Utilities...

The Utilities main menu option contains many useful tools for expediting 
program development, including a calculator, calendar, an ASCII chart, 
alarm, etc. The ASCII chart, calculator, and calendar can reside on the 
desktop at all times. The other tools are for setting colors, mouse controls, 
etc., and it is not practical to leave them on the desktop.

Calculator

Multiple calculators can be opened and left on the desktop. The calculator 
performs basic mathematical operations.

The left arrow key clears the leftmost number from the display area.
[C] clears the entire display.
+/- key toggles the sign on the number in the display. 
The mathematical operators employed by the calculator are +, -, *, /, for 
addition, subtraction, multiplication and division, respectively. 
The calculator can be moved about the desktop by selecting the window-
moving bar on the top of the window. To close the calculator, select the 
window-close control.

Calendar

To change the month displayed by the calendar, use the up and down arrow 
keys on the keypad or select the up and down arrows on the calendar 
display. The current date is highlighted in the calendar. The calendar may be 
moved about the desktop by selecting the window-moving bar on the top of 
the window. To close the calendar, select the window-close control.

ASCII chart

The ASCII chart displays all 256 characters in the ASCII character set. To see 
the ASCII value of a specific character, select the character and the status 
line on the ASCII chart will display the character, the decimal value, and the 
hexadecimal value. The ASCII chart can remain on the desktop at all times 
for reference. The ASCII chart may be moved about the desktop by selecting 
the window-moving bar on the top of the window. To close the chart, select 
the window-close control.

Window Colors

Use the Window Colors option to modify the window colors used in ADE. You 
can modify menus, dialog boxes, calculators, editors, the calendar, the ASCII 
chart, and the help windows. 

To modify the colors which these groups of windows use, select the desired 
group from the Group area on the Colors dialog box. The Item area on the 
dialog box lists all possible color modifications which you can implement. 
Once you select an item, you can select the color for that item. You can enter 
both foreground and background values for a given item. The test window 
below the background color selections indicates how the colors will appear 
when used together.

Some windows do not automatically change color upon your selection; you 
must close and reopen them for the new colors to take affect.

Mouse control

Use the Mouse control option to control how ADE handles input from the 
mouse. You can also use a digitizer which emulates a mouse with ADE.
Double-click speed:  Selections made within the ADE menus, dialog boxes, 
etc., require double clicks (two rapid pressings of the primary mouse button).  
The time difference which determines if two clicks were a "double click" or 
just two clicks in a row is determined by the "double-click speed". This speed 
is controlled by moving the indicator (_) to the appropriate position on the 
slide bar. Selecting either of the arrows maximizes or minimizes the setting of 
the double click speed.

Setting this value too fast results in the inability to select items within the 
environment.

Reverse mouse buttons: ADE allows you to switch the "primary" mouse 
button from left to right. Those persons who are left handed may want to use 
this option.

Install/Uninstall mouse program: Some digitizers can emulate mice. ADE 
can automatically initialize the driver to the digitizer at program start so the 
digitizer acts like a mouse. The Uninstall option removes the driver. ADE 
expects the name of an executable program to be entered in these fields. The 
name of the program and options will be executed upon entering and exiting 
the environment.

Utilizing these options may require some trial and error. Due to the large 
number of digitizers manufactured, BitWise Solutions, Inc., cannot test all 
digitizers for compatibility with this feature.

Free memory

Use the Free memory menu option to inform the user of the amount of free 
memory which exists. Selecting this menu option calls up a dialog box which 
contains the copyright date of the CADKEY LISP ADE and the amount of 
available memory (in bytes) available to ADE at the time. This dialog box can 
be called-up automatically at the start of each session if so desired. To do so, 
check the box titled Display.

Windows...

Use the Windows main menu option to manage the windows on the desktop. 
These options move, size, and position of windows.

Size/move

Use the Size/move menu option to size or move the active window. To resize 
the window using the keyboard, hold [Shift] and size the window using the 
arrow keys. To move the window using the keyboard, use the arrow keys to 
position it properly. If the active window has a resize corner select it and hold 
down the primary mouse button to size the window. To move the window 
using a mouse, select the title bar (-----filename.lsp------) and hold down the 
mouse button until the window is positioned properly. You can also select 
this menu option using [Ctrl]-[F5] as a shortcut.

Zoom

The Zoom menu option maximizes the currently active window, overwriting 
any other windows on the desktop. If the active window is already "zoomed", 
use this option to restore it to its previous size. You can also zoom the 
window by selecting the title bar (-----filename.lsp------). The shortcut 
keystroke for this menu option is [F5].

Tile

Use the Tile menu option to arrange all windows on the desktop into a tiled 
format. Each window is given approximately the same amount of space on 
the desktop.

Cascade

Use the Cascade menu option to arrange all editor windows on the desktop 
into a layered arrangement. Each editor window is layered over the previous 
window and is one row lower and one column to the right. The title of each 
window remains visible on the desktop.

Next

Use the Next menu option to move through the various windows on the 
desktop. The windows are stored in a circular list in ADE which you can 
move through using Next. The shortcut keystroke for this menu option is [F6].

Previous

Use the Previous menu option to move through the various windows on the 
desktop. The windows are stored in a circular list in ADE which you can 
move through using Previous. The shortcut keystroke for this menu option is 
[Shift]-[F6].

Close

Use the Close menu option to close the active window on the desktop. This 
option has the same effect as selecting the close window icon on the upper-
left corner of the window. The shortcut keystroke for this menu option is [Alt]-
[F3].

Help...

Use the Help menu option to activate the ADE on-line Help system. The Help 
system contains detailed information on all CADKEY LISP statements, 
functions, extended BASIC statements and functions, compiler error 
messages, menu items, etc. The majority of the CADKEY LISP manual is on-
line for rapid access. The shortcut keystroke for this menu option is [F1].

Help on help

Use the Help on help menu option to obtain help on the Help system. The 
Help system can be activated in three different ways:
o       Press [F1] at any time in the environment. This displays the initial Help 
system window and the Help system index.
o       Locate the cursor on a keyword (statement, function, etc.) and  press [Ctrl]-
[F1]. This activates the context-sensitive Help and displays a detailed 
window describing the item in question.
o       Place the mouse cursor on the keyword and press the primary (right is the 
default) mouse button.

Index

Use the Index menu option to display a list of all topics contained in the Help 
system. You can use this list to locate a particular topic. Once you locate the 
topic, press <Return> to activate the detailed help window.

