Visual Lisp Functions RefChart
Visual Lisp Functions RefChart
Complied by Dr. June-Hao Hou <[email protected]>, Institute of Architecture, National Chiao Tung University, Taiwan. Last updated on 8/12/2008.
Basic Functions (cond [(test result ...) ...] ) (vl-string->list string) (textscr)
Arithmetic (eq expr1 expr2) Function-Handling (vports)
(+ [number number] …) (equal expr1 expr2 [fuzz] ) (apply function list) User Input
(- [number number] …) (if testexpr thenexpr [elseexpr] ) (defun sym ([args] [/ variables]) expr ...) (entsel [msg])
(* [number number] …) (or [expr ...] ) (defun-q sym ([args] [/ variables]) expr ...) (getangle [pt] [msg])
(/ [number number] ...) (repeat int [expr ...] ) (defun-q-list-ref 'function) (getcorner pt [msg])
(while testexpr [expr ...] ) (defun-q-list-set 'sym list) (getdist [pt] [msg])
(~ int)
(1+ number) Error-Handling (eval expr) (getfiled title default ext flags)
(1- number) (alert string) (lambda arguments expr ...) (getint [msg])
(abs number) (*error* string) (progn [expr] ...) (getkword [msg])
(atan num1 [num2] ) (exit) (trace function ...) (getorient [pt] [msg])
(cos ang) (quit) (untrace function ...) (getpoint [pt] [msg])
(exp number) (vl-catch-all-apply 'function list) Application-Handling (getreal [msg])
(expt base power) (vl-catch-all-error-message error-obj) (arx) (getstring [cr] [msg])
(fix number) (vl-catch-all-error-p arg) (arxload application [onfailure]) (initget [bits] [string])
(float number) Symbol-Handling (arxunload application [onfailure]) (nentsel [msg])
(gcd int1 int2) (atom item) (autoarxload filename cmdlist) (nentselp [msg] [pt])
(log number) (atoms-family format [symlist] ) (autoload filename cmdlist) Geometric
(logand int int ...) (boundp sym) (initdia [diaglogflag] ) (angle pt1 pt2)
(logior int int ...) (not item) (load filename [onfailure]) (distance pt1 pt2)
(lsh int numbers) (null item) (startapp appcmd file) (inters pt1 pt2 pt3 pt4 [onseg])
(max number number ...) (numberp item) (vl-load-all filename) (osnap pt mode)
(min number number ...) (quote expr) (vl-vbaload filename) (polar pt angle dist)
(minusp number) (set sym expr) (vl-vbarun macroname) (textbox elist)
(rem num1 num2 ...) (setq sym1 expr1 [sym2 expr2] ...) (vlax-add-cmd global-name 'func-sym Conversion
(sin ang) (type item) [local-name cmd-flags])COM (angtof string [mode])
(sqrt number) (vl-symbol-name symbol) Utility Functions (angtos angle [mode [precision]])
(zerop number) (vl-symbol-value symbol) Query & Command (ascii string)
String-Handling (vl-symbolp object) (acad_colordlg colornum [flag]) (atof string)
(read [string] ) List Manipulation (acad_helpdlg helpfile topic) (atoi string)
(strcase string [which] ) (acad_strlsort list) (command [arguments] ...) (chr integer)
(strcat string1 string2 ...) (append list ...) (getcfg cfgname) (cvunit value from to)
(strlen [string] ...) (assoc item alist) (getcname cname) (distof string [mode])
(substr string start [length] ) (car list) (getenv "variable-name") (itoa int)
(vl-prin1-to-string object) (cdr list) (getvar varname) (rtos number [mode [precision]])
(vl-princ-to-string object) (cons new-first-element list) (help [helpfile [topic [command]]]) (trans pt from to [disp])
(vl-string-elt string position) (foreach name list [expr ...] ) (setcfg cfgname cfgval) Device Access
(vl-string-left-trim char-set string) (last list) (setenv "varname" "value") (grread [track] [allkeys [curtype]])
(vl-string-mismatch str1 str2 [pos1 pos2 (length list) (setfunhelp "c:fname" ["helpfile" ["topic" (tablet code [row1 row2 row3 direction])
ignore-case-p] ) (list [expr ...] ) ["command"]]]) File-Handling
(vl-string-position char-code str [start-pos (listp item) (setvar varname value) (close file-desc)
[from-end-p]] ) (mapcar function list1 ... listn) (ver) (findfile filename)
(vl-string-right-trim char-set string) (member expr list) (vl-cmdf [arguments] ...) (open filename mode)
(vl-string-search pattern string [start- (nth n list) (vlax-add-cmd global-name 'func-sym (read-char [file-desc])
pos] ) (reverse list) [local-name cmd-flags])COM
(read-line [file-desc])
(vl-string-subst new-str pattern str [start- (subst newitem olditem list) (vlax-remove-cmd global-name)COM
(vl-directory-files [directory pattern
pos] ) (vl-consp list-variable) Display Control directories])
(vl-string-translate source-set dest-set str) (vl-every predicate-func list [more-lists] ...) (graphscr) (vl-file-copy "source-filename" "dest-
(vl-string-trim char-set string) (vl-list* object [more-objects] ...) (grdraw from to color [highlight]) filename" [append?])
(vl-string->list string) (vl-list->string char-codes-list) (grtext [box text [highlight]]) (vl-file-delete "filename")
(wcmatch string pattern) (vl-list-length list-or-cons-object) (grvecs vlist [trans]) (vl-file-directory-p "filename")
Equality & Conditional (vl-member-if predicate-function list) (menucmd string) (vl-file-rename "old-filename" "new-
(= numstr [numstr] ...) (vl-member-if-not predicate-func list) (menugroup groupname) filename")
(/= numstr [numstr] ...) (vl-position symbol list) (prin1 [expr [file-desc]]) (vl-file-size "filename")
(< numstr [numstr] ...) (vl-remove element-to-remove list) (princ [expr [file-desc]]) (vl-file-systime "filename")
(<= numstr [numstr] ...) (vl-remove-if predicate-func list) (print [expr [file-desc]]) (vl-filename-base "filename")
(> numstr [numstr] ...) (vl-remove-if-not predicate-func list) (prompt msg) (vl-filename-directory "filename")
(>= numstr [numstr] ...) (vl-some predicate-func list [more-lists] ...) (redraw [ename [mode]]) (vl-filename-extension "filename")
(and [expr ...] ) (vl-sort list less?-func) (terpri) (vl-filename-mktemp ["pattern" "directory"
(Boole func int1 [int2 ...] ) (vl-sort-i list less?-func) (textpage) "extension"])
This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 171
Second Street, Suite 300, San Francisco, California, 94105, USA.
Visual LISP Function Reference Chart for AutoCAD 2000/2002/2004 2/4
Complied by Dr. June-Hao Hou <[email protected]>, Institute of Architecture, National Chiao Tung University, Taiwan. Last updated on 8/12/2008.
(write-char num [file-desc]) (expand number) Namespace Communication :properties-prefix pprefix
(write-line string [file-desc]) (gc) :constants-prefix cprefix])
Functions
Selection Set, Object & (mem) (vlax-method-applicable-p obj method)
(vl-bb-ref 'variable)
Symbol Table Functions Reactor Functions COM (vl-bb-set 'variable value)
(vlax-object-released-p obj)
(vl-load-com) (vlax-read-enabled-p obj)
Selection Set Manipulation (vl-load-all "filename")
(vlr-acdb-reactor data callbacks) (vlax-release-object obj)
(ssadd [ename [ss]]) (vl-propagate 'variable)
(vlr-add obj) (vlax-typeinfo-available-p obj)
(ssdel ename ss) Windows Registry Functions
(vlr-added-p obj) (vlax-write-enabled-p obj)
(ssget [mode] [pt1 [pt2]] [pt-list] [filter- (vl-registry-delete reg-key [val-name])
list]) (vlr-beep-reaction [args] ) Curve Measurement
(vl-registry-descendents reg-key [val-
(ssgetfirst) (vlr-command-reactor data callbacks) A02
names]) (vlax-curve-getArea curve-obj)
(sslength ss) (vlr-current-reaction-name) (vl-registry-read reg-key [val-name]) (vlax-curve-getDistAtParam curve-obj
(ssmemb ename ss) (vlr-data obj) param)
(vl-registry-write reg-key [val-name val-
(ssname ss index) (vlr-data-set obj data) data]) (vlax-curve-getDistAtPoint curve-obj pt)
(vlr-deepclone-reactor data callbacks) A02 COM (vlax-curve-getEndParam curve-obj)
(ssnamex ss index) (vlax-product-key)
(sssetfirst gripset [pickset]) (vlr-docmanager-reactor data (vlax-curve-getEndPoint curve-obj)
callbacks)A02 Visual LISP Extensions to (vlax-curve-getParamAtDist curve-obj
Object (Entity)-Handling AutoLISP COM
(vlr-dwg-reactor data callbacks)A02 param)
(entdel ename) Collection Manipulation
(vlr-dxf-reactor data callbacks)A02 (vlax-curve-getParamAtPoint curve-obj
(entget ename [applist]) pt)
(vlr-editor-reactor data callbacks) (vlax-for sym collection [expr1 [expr2 ...]])
(entlast) (vlax-curve-getPointAtDist curve-obj dist)
(vlr-insert-reactor data callbacks)A02 (vlax-map-collection obj function)
(entmake [elist]) (vlax-curve-getPointAtParam curve-obj
(vlr-linker-reactor data callbacks) Data Conversion
(entmakex [elist]) param)
(vlr-lisp-reactor data callbacks)A02 (vlax-3D-point list)
(entmod elist) (vlax-curve-getStartParam curve-obj)
(vlr-miscellaneous-reactor data (vlax-3D-point x y [z])
(entnext [ename]) (vlax-curve-getStartPoint curve-obj)
callbacks)A02 (vlax-ename->vla-object entname)
(entupd ename)
(handent handle)
(vlr-mouse-reactor data callbacks)A02 (vlax-make-safearray type '(l-bound . u- (vlax-curve-isClosed curve-obj)
(vlr-notification reactor) A02
bound) ['(l-bound . u-bound) ...])A02 (vlax-curve-isPeriodic curve-obj)
(vlax-dump-object obj [T])COM (vlax-curve-isPlanar curve-obj)
(vlr-object-reactor owners data callbacks) (vlax-make-variant value type)
(vlax-erased-p obj)COM (vlax-curve-getClosestPointTo curve-obj
(vlr-owner-add reactor owner) (vlax-safearray-fill var 'element-value)
(vlax-get-acad-object)COM givenPt [extend])
(vlr-owner-remove reactor owner) (vlax-safearray-get-dim var)
(vlax-method-applicable-p obj (vlax-curve-
(vlr-owners reactor) (vlax-safearray-get-element var element)
method)COM getClosestPointToProjection curve-
(vlr-pers reactor) (vlax-safearray-get-l-bound var dim)
(vlax-object-released-p obj)COM obj givenPt normal [extend])
(vlr-pers-p reactor) (vlax-safearray-get-u-bound var dim)
(vlax-read-enabled-p obj)COM (vlax-curve-getFirstDeriv curve-obj
(vlr-pers-release reactor) (vlax-safearray-put-element var element
(vlax-release-object obj)COM param)
(vlr-reaction-names reactor-type) value)
(vlax-typeinfo-available-p obj) COM (vlax-curve-getSecondDeriv curve-obj
(vlr-reaction-set reactor event function) (vlax-safearray-type var)
(vlax-write-enabled-p obj)COM param)
(vlr-reactions reactor) (vlax-safearray->list var)
Extended Data-Handling Dictionary
(vlr-reactors reactor-type) (vlax-tmatrix list)
(regapp application) (vlax-ldata-delete dict key)
(vlr-remove reactor) (vlax-variant-change-type var type)
(xdroom ename) (vlax-ldata-get dict key [default-data])
(vlr-remove-all reactor-type) (vlax-variant-type var)
(xdsize lst) (vlax-ldata-list dict)
(vlr-set-notification reactor 'range) A02 (vlax-variant-value var)
Symbol Table & Dictionary-Handling (vlr-sysvar-reactor data callbacks)A02 (vlax-ldata-put dict key data)
(vlax-vla-object->ename obj)
(dictadd ename symbol newobj) (vlax-ldata-test data)
(vlr-toolbar-reactor data callbacks) A02
Method & Property-Handling
(dictnext ename symbol [rewind]) (vlr-trace-reaction arguments) (vlax-invoke-method obj method list) Notes:
(dictremove ename symbol) (vlr-type reactor) (vlax-method-applicable-p obj method) • To refresh (the display of) an object
(dictrename ename oldsym newsym) (vlr-types) (vlax-get-property obj property) after updating its property, issue this
(dictsearch ename oldsym newsym) (vlr-undo-reactor data callbacks)A02 (vlax-property-available-p obj prop [T]) command: (vla-update object)
(layoutlist) (vlr-wblock-reactor data callbacks)A02 (vlax-put-property obj property arg) • All ActiveX and VBA predefined
(namedobjdict) (vlr-window-reactor data callbacks)A02 (vla-method object arg1 arg2 ...) constants can be used in VLISP
(setview view-desc [vport-id]) (vlr-xref-reactor data callbacks)A02 expressions. For example: (vla-put-
(vla-get-property object)
(snvalid symname) VLX Namespace Functions color mycircle acRed). See ActiveX
(vla-put-property object new-value)
(tblnext table-name [rewind]) and VBA Reference and
(vl-arx-import [function | application]) Object-Handling
(tblobjname table-name symbol) Connectivity Automation Reference.
(vl-doc-export 'function) (vlax-create-object "prog-id")
(tblsearch table-name symbol [setnext])
(vl-doc-import ['func | application]) (vlax-dump-object obj [T])
(vlax-ldata-delete dict key)COM LEGENDS
(vl-doc-ref symbol) (vlax-erased-p obj)
(vlax-ldata-get dict key [default-data]) COM
Item A02 New in ACAD 2002
(vl-doc-set symbol value) (vlax-get-acad-object)
(vlax-ldata-list dict)COM ItemA04 New in ACAD 2004
(vl-exit-with-error "msg") (vlax-get-object "prog-id")
(vlax-ldata-put dict key data) COM
ItemCOM Requires (vl-load-com)
(vl-exit-with-value value) (vlax-get-or-create-object "prog-id")
(vlax-ldata-test data)COM
(vl-list-exported-functions ["appname"]) (vlax-import-type-library
Memory Management (vl-list-loaded-vlx) :tbl-filename filename
Functions (vl-unload-vlx) [:methods-prefix mprefix
(alloc int) (vl-vlx-loaded-p "appname")
This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 171
Second Street, Suite 300, San Francisco, California, 94105, USA.
Visual LISP Function Reference Chart for AutoCAD 2000/2002/2004 3/4
Complied by Dr. June-Hao Hou <[email protected]>, Institute of Architecture, National Chiao Tung University, Taiwan. Last updated on 8/12/2008.
1- Auto Write Lock :vlr-copied1 VLA-obj: the source database;
Reactor Events and Callback
6
:vlr-beginDeepCloneXlation1 Linker reactor events symbol: the state of Auto mode. T if turned on. 9 integer: activity the BIND is carrying out. Values:
:vlr-documentBecameCurrent1 Miscellaneous reactor events :vlr-otherWblock4 12 integer: activity the DETACH is carrying out. Possible
Externally Defined DWGNAME: drawing name 1-369 (excfept 5 and 105) Can be used
DWGPREFIX: folder where drawing is in any way.
Commands
located
(c:3dsin mode [multimat create] file)
EXPERT: expert mode
(c:3dsout sset omode div smoth weld file)
LUNITS, LUPREC: non-angle number
(align arg1 arg2) unit style and precision. Values are:
(c:cal expression) 1- Scientific notation
(c:fog enabled [color [near-dist [far-dist 2- Decimal
[near-percent [far-percent]]]]]) 3- Engineering (ft & dec. in.)
(c:light mode [options]) 4- Architectural (ft. & frac. in.)
(c:lsedit mode [options]) 5- Fractions
(c:lslib mode [options]) OSMODE: object snap modes (bit-
(c:lsnew obj-type height position encoded integer)
alignment) _PKSER: package serial number
(c:matlib mode name [file]) TDCREATE: date/time, in Julian day
(mirror3d arg1 arg2 ...) format, when the drawing is created
TDINDWG: time in days that the
(c:render [filename | pt1 pt2])
drawing has been worked on
(c:renderupdate [RU-value])
TEXTSTYLE: current text style name
(c:replay filename type [xoff yoff xsize
UCSNAME: UCS name
ysize])
UNITMODE: 0 (default): loose; 1:
(c:rmat mode options)
compact.
(rotate3d args ...)
(c:rpref mode option [setting])
Extended Data (XData)
(c:saveimg filename type [portion] [xoff
yoff xsize ysize] [compression]) Group Codes
(c:scene mode [options]) 1000 String. A string up to 255 bytes.
(c:setuv mode options) 1001 Application name. A string up to
31 bytes. It is the beginning of a new
(c:showmat arg)
application extended data group.
(c:solprof args)
1002 Control string. A string, either "{"
(c:stats [filename | nil]) or "}".
1003 Layer name. A string.
VLAX Variant Types & Assoc. 1004 Binary data, up to 127 bytes. In
LISP Datatype ASCII DXF files, binary data is
0 vlax-vbEmpty nil represented as a string of
1 vlax-vbNull :vlax-null hexadecimal digits, two per binary
byte.
2 vlax-vbInteger integer
1005 Database handle. Refers to
3 vlax-vbLong
another entity.
4 vlax-vbSingle
1010, 1020, 1030 Three real values, in
5 vlax-vbDouble real
the order X, Y, Z. Never altered.
8 vlax-vbString string
1011, 1021, 1031 World space position.
9 vlax-vbObject VLA-object A 3D point to be altered.
11 vlax-vbBoolean :vlax-true/false 1012, 1022, 1032 World space
8192+n vlax-vbArray vlax safearray displacement. A 3D point to be
altered.
System Variables 1013, 1023, 1033 World direction. A 3D
ACADVER: ACAD version point to be altered.
ANGBASE: base angle orientation 1040 Real. A real value.
AUNITS, AUPREC: angle unit style and 1041 Distance. A real value that is
precision. Values are: scaled along with the parent entity.
0- Degrees 1042 Scale factor. A real value that is
1- Degrees/Minutes/Seconds scale along with the parent.
2- Grads 1070 Integer. A 16-bit integer (signed or
3- Radians unsigned).
4- Surveyor's units 1071 Long. A 32-bit integer.
CDATE: system date/time in readable Example:
format (-3
("AppName1" (1000 . "HATCH") (1002 . "{")
CLAYER: current layer name (1070 . 16) (1000 . "LINE") (1040 . 1.0)
CMDACTIVE: whether a cmd is active? (1040 . 0.0) (1002 . "}"))
("AppName2" (...))
CMDECHO: whether cmd echo is on? ) ; end of xdata
CMDNAMES: cmd names currectly
active XRecord Group Codes
CTAB: current (model/space layout) tab 100 Subclass marker (AcDbXrecord)
DATE: system date/time in comp format
This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 171
Second Street, Suite 300, San Francisco, California, 94105, USA.