0% found this document useful (0 votes)
30 views5 pages

Catalog of Functions

Uploaded by

Redro Nosmirc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views5 pages

Catalog of Functions

Uploaded by

Redro Nosmirc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Catalog of Function Definitions

in 21 Categories

This catalog is one gateway to the function definitions. The other gateway is "Alphabetic list of functions."

The function definitions are organized in 21 groups, and similar functions are listed together within those groups. This
arrangement helps you find the function needed to accomplish a certain task.

Below is a list of the 21 categories. A more complete list, with all the functions included in each category, is found
further down this page.

1 Mathematics 8 Iteration (repetition) 15 Files


2 Geometry & trigonometry 9 List manipulation 16 Entity access
3 Setting variables 10 Text strings 17 Symbol tables
4 User input 11 Printing to screen 18 Selection sets
5 Conditionals 12 Converting data types 19 Bitwise
6 Arithmetic tests 13 Function related 20 Debugging
7 Logic & category tests 14 Working with AutoCAD 21 Miscellaneous
In the function definitions, the various parts of an AutoLISP expression are identified as follows:

( function first-argument second-argument third-argument etc.)

1 Mathematics
+ --------- Add
- --------- Subtract
* --------- Multiply
/ --------- Divide
rem ------- Remainder of integer division
1+ -------- Increment by one
1- -------- Decrement by one
abs ------- Absolute
fix ------- Truncates a real to an integer
float ----- Converts an integer to a real
gcd ------- Greatest common denominator
min ------- Smallest (least) of group
max ------- Largest (greatest) of group
sqrt ------ Square root
expt ------ Exponent
exp ------- Power of e
log ------- Natural log
cvunit ---- Converts a value from one unit to another

2 Geometry & trigonometry


distance -- Returns distance between two points
angle ----- Returns angle between two points
polar ----- Returns a point at a given distance and angle from a base point
inters ---- Returns point at which two lines intersect
sin ------- Sine
cos ------- Cosine
atan ------ Arctangent

3 Setting variables
setq ------ Assigns a value to a variable (variable automatically quoted)
set ------- Assigns a value to a variable (must quote the variable)
also see setvar under "14 - Working with AutoCAD"

4 User input
initget --- Controls input allowed in next user input function
getint ---- Allows user to enter an integer
getreal --- Allows user to enter a real
getpoint -- Allows user to pick a point (rubber-band is a line)
osnap ----- Returns a point snapped to some feature of existing geometry
getcorner - Allows user to pick a point (rubber-band is a rectangle)
getdist --- Allows user to pick a distance
getangle -- Allows user to pick an angle
getorient - Allows user to pick a Cartesian angle
getstring - Allows user to enter a string
getkword -- Allows user to enter selected key word options

5 Conditionals
if -------- Checks single condition, uses then-expression and else-expression
cond ------ Checks multiple conditions, uses then-expression only

6 Arithmetic tests (checks)


= --------- Equal (evaluate to same thing)
eq -------- Equal (bound to same memory location)
equal ----- Equal within a margin
/= -------- Not equal
< --------- Less than
<= -------- Less than or equal
> --------- Greater than
>= -------- Greater than or equal
minusp ---- Check for a negative number
numberp --- Check for a number
zerop ----- Check for zero

7 Logic & category tests (checks)


not ------- Reverses nil/non-nil state
null ------ Checks for null (also reverses nil/non-nil state)
or -------- Logical OR
and ------- Logical AND
atom ------ Checks for an atom
listp ----- Checks for a list
boundp ---- Checks if a symbol is bound (assign a value)
type ------ Returns an item's data type

8 Iteration (repetition)
repeat ---- Repeats a program section a certain number of times
while ----- Repeats a program section only while a condition is true
foreach --- Repeats a program section for each member of a list

9 List manipulation
car ------- Returns first member of a list (X coord. of a point)
cadr ------ Returns second member of a list (Y coord. of a point)
caddr ----- Returns third member of a list (Z coord. of a point)
cdr ------- Returns a list containing all members but the first
nth ------- Returns the nth member of a list
last ------ Returns last member of a list
reverse --- Returns a list in reverse order
list ------ Creates a list
cons ------ Adds an element to the beginning of a list
append ---- Appends contents of several lists into one list
length ---- Returns number of top level elements in a list
member ---- Finds a top-level element in a list
assoc ----- Finds sub-lists in an association list
subst ----- Puts a new element in place of an existing element in a list
acad_strlsort Sorts strings in a list

10 Text strings
ascii ----- Returns a character's ASCII code
chr ------- Returns the character represented by an ASCII code
strlen ---- Number of charracters in a string
strcat ---- Concatenates strings
substr ---- Substring
strcase --- Converts to upper or lower case
wcmatch --- Finds string matches using wild-cards
also see acad_strlsort under "9 - List manipulation"

11 Printing to screen
prin1 ----- Prints text to the command line or to a file
princ ----- Prints text to the command line or to a file
print ----- Prints text to the command line or to a file
prompt ---- Prints a string to the command line
terpri ---- Terminates a line of print, returns cursor to beginning of next line

12 Converting data types


itoa ------ Converts an integer to a string
atoi ------ Converts a string to an integer
rtos ------ Converts a real to a string
atof ------ Converts a string to a real
distof ---- Converts a string to a real
angtos ---- Converts an angle to a string
angtof ---- Converts a string to an angle

13 Function related
defun ----- Defines a function (stores expressions in memory)
load ------ Loads a file into memory for execution
autoload -- Automatically loads a file when a command from that file is entered
progn ----- Groups several expressions to be evaluated as one
exit ------ Quits the current function, returns to Command prompt
quit ------ Quits the current function, returns to Command prompt
apply ----- Applies a function to the elements of a list
mapcar ---- Applies a function in sequence to the members of multiple lists
lambda ---- Defines a temporary function

14 Working with AutoCAD


redraw ---- Redraws viewport or redraws an entity in a certain mode
graphscr -- Displays the graphics screen
textscr --- Displays the text screen
textpage -- Displays the text screen
getvar ---- Retrieves a value from a system variable
setvar ---- Assigns a value to a system variable
command --- Executes AutoCAD commands
acad_colordlg Displays dialog box for selecting a color
menucmd --- Displays a menu or sets a menu's status
vports ---- Returns list of viewport descriptors
cvport ---- Returns number of current viewport
setview --- Sets a view for a specific viewport
trans ----- Translates a point from one user coordinate system to another

15 Files
open ------ Opens a buffer in memory for file data
close ----- Flushes a file's buffer to disk
read-line - Returns a line (string) read from a file (or keyboard)
write-line - Writes a line (string) to a file (or screen)
read-char - Returns ASCII code for a character read from file (or keyboard)
write-char - Writes a character to a file (or screen)
findfile -- Returns path to a given file
getfiled -- Displays a standard file dialog box

16 Entity access
entlast --- Returns name of last entity added to the drawing
entnext --- Returns name of next entity in the drawing
entsel ---- Allows user to select a single entity
nentsel --- Allows user to select a simple entity within a complex entity
nentselp -- Selects a simple entity within a complex entity without user input
entget ---- Retrieves an entities defining data in the form of an association list
entmod ---- Modifies an existing entity
entupd ---- Updates the appearance of a modified entity
entdel ---- Deletes an entity
entmake --- Creates a new entity
handent --- Uses an entity's handle to retrieve its name
textbox --- Returns diagonal corners of a box surrounding a text entity

17 Symbol tables
These are tables of named objects such as layers, blocks, and text styles

tblsearch - Returns information on a specified table item


tblnext --- Returns information on the next table item
snvalid --- Tests for valid characters in the name of a symbol table
tblobjname - Returns the database name of a named entity based on its specification

18 Selection sets
Selection sets are somewhat like lists, but they cannot be manipulated with the same functions used to
manipulate lists.

ssget ----- Allows user to interactively build a selection set


ssadd ----- Add an entity to a selection set
ssdel ----- Deletes an entity from a selection set
sslength -- Returns number of entities in a selection set
ssmemb ---- Reports if an entity is a member of a selection set
ssname ---- Retrieves an entity name from a selection set
ssnamex --- Retrieves information about how a selection set was created
ssgetfirst - Finds which entities are gripped and selected
sssetfirst - Sets which entities are gripped and selected

19 Bitwise
logior ---- Bitwise OR
logand ---- Bitwise AND
~ --------- Bitwise not, 1's complement
lsh ------- Bitwise left shift
boole ----- General bitwise boolean function
20 Debugging
trace ----- Turns tracing on for a specified function
untrace --- Turns tracing off for a specified function
also see *error* under "21 - Miscellaneous"

21 Miscellaneous
*error* --- Allows redefinition of the built-in error routine
ver ------- Displays current version of AutoLISP
startapp -- Starts a Windows application
alert ----- Displays a message in a simple dialog box
help ------ Displays a help file
setfunhelp - Associates a help file name with a function
atoms-family Returns all currently defined symbols
quote ----- Returns expression unevaluated
eval ------ Evaluates an expression
read ------ Converts a string into a symbol
getenv ---- Retrieves the setting of variable in the system environment
grread ---- Receives input directly from keyboard, mouse, etc.
grtext ---- Displays text in status line or screen menu area
grdraw ---- Draws a temporary vector
grvecs ---- Draws multiple vectors
mem ------- Displays memory statistics

HOME

Copyright © 1988, 1998 Ronald W. Leigh

You might also like