Satish Lele
satish.lele@gmail.com


LIST of AutoLISP FUNCTIONS
Functions are grouped by data type and by the action they perform.
Basic Functions: The basic functions consist of the arithmetic, string-handling, equality and conditional, list manipulation, symbol-handling, function-handling, error-handling, and application-handling functions.
Arithmetic Functions: The AutoLISP arithmetic functions are as follows:
(+ [number number] ...): Returns the sum of all numbers.
(- [number number] ...): Subtracts the second and following numbers from the first and returns the difference.
(* [number number] ...): Returns the product of all numbers.
(/ [number number] ...): Divides the first number by the product of the remaining numbers and returns the quotient.
(~ int): Returns the bitwise NOT (1's complement) of the argument.
(1+ number): Returns the argument increased by 1 (incremented).
(1- number): Returns the argument reduced by 1 (decremented).
(abs number): Returns the absolute value of the argument.
(atan num1 [num2]): Returns the arctangent of a number in radians.
(cos ang): Returns the cosine of an angle expressed in radians.
(exp number): Returns the constant e (a real) raised to a specified power (the natural antilog).
(expt base power): Returns a number raised to a specified power.
(fix number): Returns the conversion of a real into the nearest smaller integer.
(float number): Returns the conversion of a number into a real.
(gcd int1 int2): Returns the greatest common denominator of two integers.
(log number): Returns the natural log of a number as a real.
(logand int int ...): Returns the result of the logical bitwise AND of a list of integers.
(logior int int ...): Returns the result of the logical bitwise inclusive OR of a list of integers.
(lsh int numbits): Returns the logical bitwise shift of an integer by a specified number of bits.
(max number number ...): Returns the largest of the numbers given.
(min number number ...): Returns the smallest of the numbers given.
(minusp number): Verifies that a number is negative.
(rem num1 num2 ...): Divides the first number by the second, and returns the remainder.
(sin ang): Returns the sine of an angle as a real expressed in radians.
(sqrt number): Returns the square root of a number as a real.
(zerop number): Verifies that a number evaluates to zero.

String-Handling Functions: The string-handling functions are as follows:.
(strcase string [which]): Returns a string where all alphabetic characters have been converted to upper case or lower case.
(strcat string1 [string2] ...): Returns a string that is the concatenation of multiple strings.
(strlen [string] ...): Returns an integer that is the number of characters in a string.
(substr string start [length]): Returns a substring of a string.
(wcmatch string pattern): Performs a wild-card pattern match on a string.

Equality and Conditional Functions: The equality and conditional functions are as follows:.
(= numstr [numstr] ...): Returns T if all arguments are numerically equal, and returns nil otherwise.
(/= numstr [numstr[ ...): Returns T if the arguments are not numerically equal, and nil if the arguments are numerically equal.
(< numstr [numstr] ...): Returns T if each argument is numerically less than the argument to its right, and returns nil otherwise.
(<= numstr [numstr] ...): Returns T if each argument is numerically less than or equal to the argument to its right, and returns nil otherwise.
(> numstr [numstr] ...): Returns T if each argument is numerically greater than the argument to its right, and returns nil otherwise.
(>= numstr [numstr] ...): Returns T if each argument is numerically greater than or equal to the argument to its right, and returns nil otherwise.
(and expr ...): Returns the logical AND of a list of expressions.
(Boole func int1 int2 ...): Serves as a general bitwise Boolean function.
(cond (test1 result1 ...) ...): Serves as the primary conditional function for AutoLISP.
(eq expr1 expr2): Determines whether two expressions are identical.
(equal expr1 expr2 [fuzz]): Determines whether two expressions are equal.
(if testexpr thenexpr [elseexpr]): Conditionally evaluates expressions.
(or expr ...): Returns the logical OR of a list of expressions.
(repeat int expr ...): Evaluates each expression a specified number of times, and returns the value of the last expression.
(while testexpr expr ...): Evaluates a test expression, and if it is not nil, evaluates other expressions; repeats this process until the test expression evaluates to nil.

List Manipulation Functions: The list manipulation functions are as follows:
(acad_strlsort lst): Sorts a list of strings by alphabetical order.
(append lst ...): Takes any number of lists and runs them together as one list.
(assoc item alist): Searches an association list for an element and returns that association list entry.
(car lst) and (cdr lst): Returns the first element of a list or a list containing all but the first element of a list.
(cons new-first-element lst): The basic list constructor.
(foreach name lst expr ...): Evaluates expressions for all members of a list.
(last lst): Returns the last element in a list.
(length lst): Returns an integer indicating the number of elements in a list.
(list expr ...): Takes any number of expressions, and combines them into one list.
(listp item): Verifies that an item is a list.
(mapcar function list1 ... listn): Returns a list of the result of executing a function with the individual elements of a list or lists supplied as arguments to the function.
(member expr lst): Returns a list of the result of executing a function with the individual elements of a list or lists supplied as arguments to the function.
(nth n lst): Returns the nth element of a list.
(reverse lst): Returns a list with its elements reversed.
(subst newitem olditem lst): Searches a list for an old item and returns a copy of the list with a new item substituted in place of every occurrence of the old item.

Symbol-Handling Functions: The symbol-handling functions are as follows:
(atom item): Verifies that an item is an atom.
(atoms-family format [symlist]): Returns a list of the currently defined symbols.
(boundp sym): Verifies if a value is bound to a symbol.
(not item): Verifies that an item evaluates to nil.
(null item): Verifies that an item is bound to nil.
(numberp item): Verifies that an item is a real or an integer.
(quote expr): Returns an expression without evaluating it.
(read [string]): Returns the first list or atom obtained from a string.
(set sym expr): Sets the value of a quoted symbol name to an expression.
(setq sym1 expr1 [sym2 expr2] ...): Sets the value of a symbol or symbols to associated expressions.
(type item): Returns the type of a specified item.

Function-Handling Functions: The function-handling functions are as follows:
(apply function lst): Passes a list of arguments to a specified function.
(defun sym argument-list expr ...): Defines a function.
(eval expr): Returns the result of evaluating an AutoLISP expression.
(lambda arguments expr ...): Defines an anonymous function.
(progn [expr] ...): Evaluates each expression sequentially, and returns the value of the last expression.
(trace function ...): Aids in AutoLISP debugging.
(untrace function ...): Clears the trace flag for the specified functions.

Error-Handling Functions: The error-handling functions are as follows:
(alert string): Displays an alert box with the error or warning message passed as a string.
(*error* string): A user-definable error-handling function.
(exit): Forces the current application to quit.
(quit): Forces the current application to quit.

Application-Handling Functions: The application-handling functions are as follows:
(ads): Returns a list of the currently loaded ADS applications.
(arx): Returns a list of the currently loaded ARX applications.
(arxload application [onfailure]): Loads an ARX application.
(arxunload application [onfailure]): Unloads an ARX application.
(autoarxload filename cmdlist): Predefines command names to load an associated ARX file..
(autoload filename cmdlist): Predefines command names to load an associated AutoLISP file..
(autoxload filename cmdlist): Predefines command names to load an associated ADS application..
(load filename [onfailure]): Evaluates the AutoLISP expressions in a file.
(startapp appcmd file): Starts a Windows application.
(xload application [onfailure]): Loads an ADS application.
(xunload application [onfailure]): Unloads an ADS application.

Utility Functions: The utility functions consist of query and command, display control, user input, geometric, conversion, filehandling, and device access functions.
Query and Command Functions: The query and command functions are as follows:
(acad_colordlg colornum [flag]): Displays the standard AutoCAD color selection dialog box.
(command [arguments] ...): Executes an AutoCAD command.
(getcfg cfgname): Retrieves application data from the AppData section of the acad.cfg file.
(getcname cname): Retrieves the localized or English name of an AutoCAD command.
(getenv variable-name): Returns the string value assigned to a system environment variable.
(getvar varname): Retrieves the value of an AutoCAD system variable.
(help [helpfile [topic [command]]]): Invokes the help facility.
(setcfg cfgname cfgval): Writes application data to the AppData section of the acad.cfg file.
(setfunhelp function [helpfile [topic [command]]]): Registers a user-defined command with the Help facility so that the appropriate help file and topic are called when the user requests help on that command.
(setvar varname value): Sets an AutoCAD system variable to a specified value.
(ver): Returns a string that contains the current AutoLISP version number.

Display Control Functions: The display control functions are as follows:
(graphscr): Displays the AutoCAD graphics screen.
(grdraw from to color [highlight]): Draws a vector between two points, in the current viewport.
(grtext [box text [highlight]]): Writes text to the status line or to screen menu areas.
(grvecs vlist [trans]): Draws multiple vectors on the graphics screen.
(menucmd string): Issues menu commands, or sets and retrieves menu item status.
(menugroup groupname): Verifies that a menugroup is loaded.
(prin1 [expr [file-desc]]): Prints an expression to the command line or writes an expression to an open file.
(princ [expr [file-desc]]): Prints an expression to the command line, or writes an expression to an open file.
(print [expr [file-desc]]): Prints an expression to the command line, or writes an expression to an open file.
(prompt msg): Displays a string on your screen's prompt area.
(redraw [ename [mode]]): Redraws the current viewport or a specified object (entity) in the current viewport.
(terpri): Prints a newline to the command line.
(textpage): Switches from the graphics screen to the text screen.
(textscr): Switches from the graphics screen to the text screen (like the AutoCAD Flip Screen function key).
(vports): Returns a list of viewport descriptors for the current viewport configuration.

User Input Functions: The user input functions are as follows:
(entsel [msg]): Prompts the user to select a single object (entity) by specifying a point.
(getangle [pt] [msg]): Pauses for user input of an angle, and returns that angle in radians.
(getcorner pt [msg]): Pauses for user input of a rectangle's second corner.
(getdist [pt] [msg]): Pauses for user input of a distance.
(getfiled title default ext flags): Prompts the user for a file name with the standard AutoCAD file dialog box, and returns that file name.
(getint [msg]): Pauses for user input of an integer, and returns that integer.
(getkword [msg]): Pauses for user input of a key word, and returns that key word.
(getorient [pt] [msg]): Pauses for user input of an angle, and returns that angle in radians.
(getpoint [pt] [msg]): Pauses for user input of a point, and returns that point.
(getreal [msg]): Pauses for user input of a real number, and returns that real number.
(getstring [cr] [msg]): Pauses for user input of a string, and returns that string.
(initget [bits] [string]): Establishes key words for use by the next user-input function call.
(nentsel [msg]): Prompts the user to select an object (entity) by specifying a point, and provides access to the definition data contained within a complex object.
(nentselp [msg] [pt]): Provides similar functionality to that of the nentsel function without the need for user input.

Geometric Functions: The geometric functions are as follows:
(angle pt1 pt2): Returns an angle in radians of a line defined by two endpoints.
(distance pt1 pt2): Returns the 3D distance between two points.
(inters pt1 pt2 pt3 pt4 [onseg]): Finds the intersection of two lines.
(osnap pt mode): Returns a 3D point that is the result of applying an Object Snap mode to a specified point.
(polar pt ang dist): Returns the UCS 3D point at a specified angle and distance from a point.
(textbox elist): Measures a specified text object, and returns the diagonal coordinates of a box that encloses the text.

Conversion Functions: The conversion functions are as follows:
(angtof string [mode]): Converts a string representing an angle into a real (floating-point) value in radians.
(angtos angle [mode [precision]]): Converts an angular value in radians into a string.
(ascii string): Returns the conversion of the first character of a string into its ASCII character code (an integer).
(atof string): Returns the conversion of a string into a real.
(atoi string): Returns the conversion of a string into an integer.
(chr integer): Returns the conversion of an integer representing an ASCII character code into a single-character string.
(cvunit value from to): Converts a value from one unit of measurement to another.
(distof string [mode]): Converts a string that represents a real (floating-point) value into a real value.
(itoa int): Returns the conversion of an integer into a string.
(rtos number [mode [precision]]): Converts a number into a string.
(trans pt from to [disp]): Translates a point (or a displacement) from one coordinate system to another.

File-Handling Functions: The file-handling functions are as follows:
(close file-desc): Closes an open file.
(findfile filename): Searches the AutoCAD library path for the specified file.
(open filename mode): Opens a file for access by the AutoLISP I/O functions.
(read-char [file-desc]): Returns the decimal ASCII code representing the character read from the keyboard input buffer or from an open file.
(read-line [file-desc]): Reads a string from the keyboard or from an open file.
(write-char num [file-desc]): Writes one character to the screen or to an open file.
(write-line string [file-desc]): Writes a string to the screen or to an open file.

Device Access Functions: The device access functions are as follows:
(grread [track] [allkeys [curtype]]): Reads values from any of the AutoCAD input devices.
(tablet code [row1 row2 row3 direction]): Retrieves and sets digitizer (tablet) calibrations Selection Set, Object, and Symbol Table Functions: The selection set, object, and symbol table functions consist of selection set manipulation, object-handling, extended data-handling, and symbol table-handling functions.

Selection Set Manipulation Functions: The selection set manipulation functions are as follows:
(ssadd [ename [ss]]): Adds an object (entity) to a selection set, or creates a new selection set.
(ssdel ename ss): Deletes an object (entity) from a selection set.
(ssget [mode] [pt1 [pt2]] [pt-list] [filter-list]): Prompts the user to select objects (entities), and returns a selection set.
(ssgetfirst): Determines which objects are selected and gripped.
(sslength ss): Returns an integer containing the number of objects (entities) in a selection set.
(ssmemb ename ss): Tests whether an object (entity) is a member of a selection set.
(ssname ss index): Returns the object (entity) name of the indexed element of a selection set.
(ssnamex ss index): Retrieves information about how a selection set was created.
(sssetfirst gripset [pickset]): Sets which objects are selected and gripped.

Object-Handling Functions: The object-handling functions are as follows:
(entdel ename): Deletes objects (entities) or undeletes previously deleted objects.
(entget ename [applist]): Retrieves an object's (entity's) definition data.
(entlast): Returns the name of the last nondeleted main object (entity) in the drawing.
(entmake [elist]): Creates a new entity (graphical object) in the drawing.
(entmakex [elist]): Makes a new object or entity, gives it a handle and entity name (but, does not assign an owner), and then returns the new entity name.
(entmod elist): Modifies the definition data of an object (entity).
(entnext [ename]): Returns the name of the next object (entity) in the drawing.
(entupd ename): Updates the screen image of an object (entity).
(handent handle): Returns an object (entity) name based on its handle.

Extended Data-Handling Functions: The extended data-handling functions are as follows:
(regapp application): Registers an application name with the current AutoCAD drawing in preparation for using extended object data.
(xdroom ename): Returns the amount of extended data (Xdata) space that is available for an object (entity).
(xdsize lst): Returns the size (in bytes) that a list occupies when it is linked to an object (entity) as extended data.

Symbol Table and Dictionary-Handling Functions: The symbol table and dictionary handling functions are as follows:
(dictadd ename symbol newobj): Adds a nongraphical object to the specified dictionary.
(dictdel ename symbol): Removes an entry from the specified dictionary.
(dictnext ename symbol [rewind]): Finds the next item in a dictionary.
(dictrename ename oldsym newsym): Renames a dictionary entry.
(dictsearch ename symbol [setnext]): Searches a dictionary for an item.
(namedobjdict): Returns the entity name of the current drawing's named object dictionary, which is the root of all nongraphical objects in the drawing.
(setview view_description [vport_id]): Establishes a view for a specified viewport.
(snvalid sym_name): Checks the symbol table name for valid characters.
(tblnext table-name [rewind]): Finds the next item in a symbol table.
(tblobjname table-name symbol): Returns the entity name of a specified symbol table entry.
(tblsearch table-name symbol [setnext]): Searches a symbol table for a symbol name.

Programmable Dialog Box Functions: The programmable dialog box functions consist of dialog box opening and closing, tile and attribute handling, list box and pop-up list handling, image tile handling, and application-specific data-handling functions. They are described in more detail in chapter 10, "Managing Dialog Boxes."
Dialog Box Opening and Closing Functions: The dialog box opening and closing functions are as follows:
(done_dialog [status]): Terminates a dialog box.
(load_dialog dclfile): Loads a DCL file.
(new_dialog dlgname dcl_id [action [screen-pt]]): Begins a new dialog box and displays it, and can also specify a default action.
(start_dialog): Displays a dialog box and begins accepting user input.
(term_dialog): Terminates all current dialog boxes as if the user had canceled each of them.
(unload_dialog dcl_id): Unloads a DCL file.

Tile and Attribute Handling Functions: The tile and attribute handling functions are as follows:
(action_tile key action-expression): Assigns an action to evaluate when the user selects the specified tile in a dialog box.
(get_attr key attribute): Retrieves the DCL value of a dialog box attribute.
(get_tile key): Retrieves the current run-time value of a dialog box tile.
(mode_tile key mode): Sets the mode of a dialog box tile.
(set_tile key value): Sets the value of a dialog box tile.

List Box and Pop-Up List Handling Functions: The list box and pop-up list handling functions are as follows:
(add_list string): Adds or modifies a string in the currently active dialog box list.
(end_list): Ends processing of the currently active dialog box list.
(start_list key [operation [index]]): Starts the processing of a list in the list box or in the pop-up list dialog box tile.

Image Tile Handling Functions: The image tile handling functions are as follows:
(dimx_tile key) and (dimy_tile key): Retrieves the dimensions of a tile in dialog box units.
(end_image): Ends creation of the currently active dialog box image.
(fill_image x1 y1 wid hgt color): Draws a filled rectangle in the currently active dialog box image tile.
(slide_image x1 y1 wid hgt sldname): Displays an AutoCAD slide in the currently active dialog box image tile.
(start_image key): Starts the creation of an image in the dialog box tile.
(vector_image x1 y1 x2 y2 color): Draws a vector in the currently active dialog box image.

Application-Specific Data-Handling Functions: The application-specific data-handling functions are as follows:
(client_data_tile key clientdata): Associates application-managed data with a dialog box tile.

Memory Management Functions: The memory management functions, which follow, are described in more detail in chapter 15, "Memory Management."
(alloc int): Sets the segment size to a given number of nodes.
(expand number): Allocates node space by requesting a specified number of segments.
(gc): Forces a garbage collection, which frees up unused nodes.
(mem): Displays the current state of AutoLISP's memory.

backBack top