+ImplementedReturns the sum of all numeric arguments.
- Returns
- Integer or Real
- Parameters
- number1, number2...: Numeric values to sum. If omitted, returns 0.
(+ 1 2) ;; Returns: 3 (+ 1 2 3.5) ;; Returns: 6.5
Zephyr ships a native AutoLISP engine with the full inventoried builtin set —
verified against every documented example. Routines you wrote for full AutoCAD run unmodified:
entity creation and editing, selection sets, system variables, file I/O, dictionaries, layer
states, and scripted (command …) calls — identically on macOS, Windows, and Linux.
| COMMAND | ALIAS | DESCRIPTION |
|---|---|---|
| LOAD | — | Load and evaluate a .lsp file |
| EVAL | — | Evaluate a single Lisp expression string |
| SCRIPT | SCR | Run a .scr command script |
Scripted (command …) calls include "INSERT" / "-INSERT",
"_CHPROP" (color, layer, linetype, ltscale, lineweight),
and, for images and PDFs, "-ATTACH" with AutoCAD's operand order:
(command "-ATTACH" path [page] point [scale [rotation]]). Drawing attaches stay
interactive (XATTACH). Drawing properties and system variables including CELTYPE,
CELTSCALE, CELWEIGHT, CECOLOR, LTSCALE,
AUTOCONTRAST, and xref variables REFPATHTYPE,
VISRETAIN, BINDTYPE, XDWGFADECTL, XREFNOTIFY,
and XLOADCTL are readable and settable through getvar/setvar,
and (tblsearch "BLOCK" name) returns an xref's saved path (group 1) and flags (group 70).
;; Color all circles red
(setq ss (ssget "_X" '((0 . "CIRCLE"))))
(setq i 0)
(repeat (sslength ss)
(setq e (entget (ssname ss i)))
(entmod (if (assoc 62 e)
(subst '(62 . 1) (assoc 62 e) e)
(append e (list '(62 . 1)))))
(setq i (1+ i)))
The ribbon and its classic File / Edit / View menu bar are not
compiled into the binary — they are an AutoLISP file, lisp/ribbon.lsp. It is copied into the
per-user app-data directory on first run, reloads itself about a second after you save, and keeps the previous
layout live if an edit fails to parse. Nothing here needs a rebuild or a restart.
A definition file defines one function, zephyr-ribbon, which returns the layout with the helpers
below. Everything else in the file may be ordinary AutoLISP — loops, conditionals, append —
so a ribbon can be generated from a table instead of typed out by hand.
| FORM | MEANING |
|---|---|
| (zr-ribbon menubar tabs) | The whole definition: a menu bar section and/or a tab section (either may be nil) |
| (zr-menubar menus) | Classic menu bar, shown in the collapsed "menu" presentation |
| (zr-menu title items) | One top-level menu — File, Edit, Draw… |
| (zr-tabs tabs) | Ribbon tabs, shown in the "labels" and "icons" presentations |
| (zr-tab title panels) | One ribbon tab — Home, Insert… |
| (zr-panel title items) | One panel inside a tab, titled underneath the buttons |
| (zr-big cmd label icon opts) | Large ribbon button: icon above label |
| (zr-small cmd label icon opts) | Small ribbon button: icon beside label |
| (zr-item cmd label opts) | Menu entry (menus have no icon column) |
| (zr-drop label items) | Ribbon flyout / menu entry with sub-items |
| (zr-sub title items) | Submenu inside a menu |
| (zr-sep) | Separator |
Every container takes a list of children (this AutoLISP enforces exact arity and has no rest
arguments), and cmd is any command name — including your own c: routines. Pass
nil for icon to derive it from the command name; an unknown name draws a letter
placeholder rather than an empty button.
| OPTION / PREDICATE | EFFECT |
|---|---|
| (zr-enable pred) | Grey the entry out unless every predicate holds |
| (zr-check pred) | Draw the entry pressed while the predicates hold (toggles) |
| (zr-tip text) | Tooltip |
| (zr-sel n) · (zr-nocmd) · (zr-cmd name) | Selection count, no command running, a specific command running |
| (zr-undoable) · (zr-redoable) · (zr-dirty) | Undo/redo available, drawing has unsaved changes |
| (zr-var name value) | System variable equals a value — (zr-var "GRIDMODE" 1) |
| (zr-tabcount n) | At least n drawings open |
State is evaluated live every frame, but never by calling LISP: predicates read the drawing, the selection and
the same system-variable store getvar uses, so a routine that changes GRIDMODE updates
the ribbon immediately. Labels interpolate system variables too — "Layer: %CLAYER%" follows
the active layer.
;; ribbon.lsp - excerpt
(defun zephyr-ribbon ()
(zr-ribbon
(zr-menubar
(list (zr-menu "File"
(list (zr-item "NEW" "New" nil)
(zr-item "OPEN" "Open..." nil)
(zr-sep)
(zr-item "SAVE" "Save" nil)))))
(zr-tabs
(list (zr-tab "Home"
(list (zr-panel "Draw"
(list (zr-big "LINE" "Line" "line" nil)
(zr-small "CIRCLE" "Circle" "circle" nil)))
(zr-panel "Modify"
(list (zr-big "ERASE" "Erase" "erase"
(list (zr-enable (zr-sel 1))))
(zr-small "GRID" "Grid: %GRIDMODE%" "grid"
(list (zr-check (zr-var "GRIDMODE" 1))))))))))))
| COMMAND | DESCRIPTION |
|---|---|
| RIBBON | Show or hide the ribbon (a dockable window; its position persists) |
| RIBBONMODE | Menu bar, labels, or icons + labels. Bare Enter reports the current presentation |
| RIBBONRELOAD | Re-read the definition file and rebuild the layout |
The definition is a layout document, not a dialog toolkit: it cannot create arbitrary windows
or ask for input while loading. For that, DCL dialogs are the Tier 2 item on the roadmap.
+ImplementedReturns the sum of all numeric arguments.
(+ 1 2) ;; Returns: 3 (+ 1 2 3.5) ;; Returns: 6.5
/ImplementedDivides the first number by subsequent arguments.
(/ 5 2) ;; Returns: 2 (/ 5.0 2) ;; Returns: 2.5
>ImplementedChecks if each argument is greater than the one to its right.
(> 10 5 2) ;; Returns: T (> "c" "b") ;; Returns: T
>=ImplementedChecks if each argument is greater than or equal to the one to its right.
(>= 10 10 5) ;; Returns: T
<ImplementedChecks if each argument is less than the one to its right.
(< 2 5 10) ;; Returns: T
<=ImplementedChecks if each argument is less than or equal to the one to its right.
(<= 5 5 10) ;; Returns: T
*ImplementedReturns the product of all numeric arguments.
(* 3 5) ;; Returns: 15 (* 3 1.5) ;; Returns: 4.5
*error*ImplementedUser-definable error-handling callback function.
(defun *error* (msg) (princ (strcat "\nError occurred: " msg)) (princ) )
*pop-error-mode*ImplementedPops and terminates the error mode corresponding to *push-error-using-command*.
(*pop-error-mode*) ;; Returns: nil
*push-error-using-command*ImplementedPushes custom error-handling state allowing the use of command within an error handler.
(*push-error-using-command*) ;; Returns: nil
*push-error-using-stack*ImplementedPushes custom error-handling state using LISP's internal stack context.
(*push-error-using-stack*) ;; Returns: nil
-ImplementedSubtracts subsequent numbers from the first numeric argument.
(- 50 10) ;; Returns: 40 (- 10) ;; Returns: -10
/=ImplementedCompares arguments for inequality.
(/= 5 10) ;; Returns: T (/= "a" "a") ;; Returns: nil
=ImplementedCompares arguments for equality.
(= 5 5) ;; Returns: T (= "a" "b") ;; Returns: nil
~ImplementedComputes the bitwise NOT (1's complement) of an integer.
(~ 3) ;; Returns: -4
1-ImplementedDecrements a numeric value by 1.
(1- 10) ;; Returns: 9 (1- 10.5) ;; Returns: 9.5
1+ImplementedIncrements a numeric value by 1.
(1+ 10) ;; Returns: 11
absImplementedReturns the absolute value of a number.
(abs -10) ;; Returns: 10
acad_colordlgImplementedDisplays the AutoCAD Select Color dialog box.
(acad_colordlg 1 nil) ;; Displays dialog; returns color selected
acad_helpdlgImplementedInvokes Help file search utility (Obsolete: Use help instead).
(acad_helpdlg "myhelp.chm" "topic1")
acad-pop-dbmodImplementedPops and restores the value of the DBMOD system variable from the internal stack.
(acad-pop-dbmod) ;; Restores saved DBMOD status
acad-push-dbmodImplementedPushes and saves the active value of DBMOD system variable onto the internal stack.
(acad-push-dbmod) ;; Saves DBMOD status
acad_strlsortImplementedSorts a list of strings in alphabetical order.
(acad_strlsort '("c" "a" "b"))
;; Returns: ("a" "b" "c")acad_truecolorcliImplementedPrompts true color selection inside command line.
(acad_truecolorcli '((62. 1))) ;; Returns selected true color list
acad_truecolordlgImplementedDisplays Select Color dialog with tabs for index, true, and color books.
(acad_truecolordlg '(62. 1)) ;; Returns selected true color list
acdimenableupdateImplementedControls automatic dimension updates during graphics modification.
(acdimenableupdate nil) ;; Suspends automatic updates
acet-layerp-markImplementedSets begin/end transaction mark for Layer Previous command groupings.
(acet-layerp-mark T) ;; Begins layer previous undo boundary
acet-layerp-modeImplementedChecks or sets the active LAYERPMODE system status.
(acet-layerp-mode T) ;; Turns LAYERPMODE on
acet-laytransTier 2 · clean errorTranslates drawing layer schema configurations based on mapping settings.
(acet-laytrans "drawing.dwg" "std.dws")
acet-ms-to-psImplementedConverts a model space unit value to paper space coordinate units.
(acet-ms-to-ps 10.0) ;; Returns paper space equivalence
acet-ps-to-msImplementedConverts a paper space unit value to model space coordinate units.
(acet-ps-to-ms 1.5) ;; Returns model space equivalence
alertImplementedDisplays a modal warning dialog box with a clean OK button.
(alert "Action completed!") ;; Displays warning box, returns nil
allocImplementedSets segment size for AutoLISP memory allocation.
(alloc 10000) ;; Returns old allocation size
andImplementedPerforms logical AND. Employs short-circuit evaluation.
(and (= 1 1) (/= 2 3)) ;; Returns: T
angleImplementedComputes the radian angle of a line projected onto the XY plane from pt1 to pt2.
(angle '(0.0 0.0) '(10.0 10.0)) ;; Returns: 0.785398
angtofImplementedConverts an angle string representation into its real value in radians.
(angtof "180" 0) ;; Returns: 3.14159
angtosImplementedFormats a radian angle value into a text string representation.
(angtos 3.14159 0 2) ;; Returns: "180.00"
appendImplementedMerges multiple standard lists together into a single unified list.
(append '(1 2) '(3 4)) ;; Returns: (1 2 3 4)
applyImplementedExecutes a function using list elements as individual parameters.
(apply '+ '(5 10 15)) ;; Returns: 30
arxTier 2 · clean errorReturns a list of all currently loaded ObjectARX applications.
(arx) ;; Returns loaded ARX module list
arxloadTier 2 · clean errorLoads an ObjectARX application module into the active context.
(arxload "geom.arx" "Failed")
arxunloadTier 2 · clean errorUnloads an ObjectARX application from memory.
(arxunload "geom.arx")
asciiImplementedReturns the ASCII/Unicode character code of the first character in a string.
(ascii "A") ;; Returns: 65
assocImplementedSearches an association list for an entry matching key and returns its pair.
(assoc 10 '((0. "LINE") (10 0.0 0.0 0.0))) ;; Returns: (10 0.0 0.0 0.0)
atanImplementedReturns the arctangent of a number, or quotient of two numbers, in radians.
(atan 1.0) ;; Returns: 0.785398
atofImplementedConverts an alphanumeric string into a real floating-point value.
(atof "123.45") ;; Returns: 123.45
atoiImplementedConverts an alphanumeric string into a 32-bit signed integer value.
(atoi "456") ;; Returns: 456
atomImplementedVerifies if the specified argument is an atom (i.e. not a list).
(atom 'a) ;; Returns: T (atom '(1 2)) ;; Returns: nil
atoms-familyImplementedReturns a list of all currently defined symbol names.
(atoms-family 1 '("nil" "t"))
;; Returns active symbol name stringsautoarxloadTier 2 · clean errorRegisters an ObjectARX command to autoload its corresponding file on call.
(autoarxload "myarx" '("mycmd"))autoloadImplementedRegisters a command to load its corresponding LISP file when invoked.
(autoload "tools.lsp" '("C:ALIGN"))booleImplementedPerforms bitwise Boolean truth comparisons between integers.
(boole 1 12 5) ;; Returns bitwise AND of 12 and 5: 4
boundpImplementedVerifies if a value is currently bound to the specified symbol name.
(setq x 10) (boundp 'x) ;; Returns: T (boundp 'y) ;; Returns: nil
caddrImplementedReturns the third element of a list.
(caddr '(10 20 30 40)) ;; Returns: 30
cadrImplementedReturns the second element of a list.
(cadr '(10 20 30)) ;; Returns: 20
carImplementedReturns the first element of a list.
(car '(10 20 30)) ;; Returns: 10
cdrImplementedReturns a list containing all elements except the first, or second element of a dotted pair.
(cdr '(10 20 30)) ;; Returns: (20 30) (cdr '(10. 20)) ;; Returns: 20
chrImplementedConverts an integer ASCII/Unicode code into its single-character string representation.
(chr 65) ;; Returns: "A"
closeImplementedCloses an open file stream descriptor.
(close f) ;; Closes stream, returns nil
commandImplementedExecutes an AutoCAD command asynchronously within active workspace.
(command "_LINE" '(0 0 0) '(10 10 0) "") ;; Draws line
command-sImplementedExecutes an AutoCAD command synchronously for faster execution.
(command-s "_LINE" '(0 0 0) '(5 5 0) "")
condImplementedEvaluates multi-conditional branches, executing actions for first non-nil condition.
(setq x 2) (cond ((= x 1) "One") ((= x 2) "Two")) ;; Returns: "Two"
consImplementedAdds an element to the head of a list, or constructs a dotted pair.
(cons 1 '(2 3)) ;; Returns: (1 2 3) (cons 1 2) ;; Returns: (1. 2)
cosImplementedComputes the cosine of an angle in radians.
(cos 3.14159) ;; Returns: -1.0
cvunitImplementedConverts real-world values or coordinate lists between measurement unit definitions.
(cvunit 1 "inch" "mm") ;; Returns: 25.4
defun-q-list-refImplementedDisplays the internal list structure of a function defined with defun-q.
(defun-q MyTest (x) (print x)) (defun-q-list-ref 'MyTest) ;; Returns: ((X) (PRINT X))
defun-q-list-setImplementedDefines a function symbol using a raw list structure.
(defun-q-list-set 'MyCombined '( (x) (print x) ))
defun-qImplementedDefines a custom function while storing its structure as an editable list of S-expressions.
(defun-q MyFunc (x) (* x x))
defunImplementedDefines a named custom function, with optional local variables.
(defun c:hello () (alert "Hello!") (princ))
dictaddImplementedAdds a non-graphical object to a specified dictionary.
(dictadd dict_name "MY_KEY" obj_name)
dictnextImplementedRetrieves the next non-graphical object in a dictionary.
(dictnext dict_ename)
dictremoveImplementedRemoves a non-graphical object entry from a dictionary.
(dictremove dict_ename "MY_KEY")
dictrenameImplementedRenames a key entry inside a dictionary.
(dictrename dict_ename "OLD" "NEW")
dictsearchImplementedSearches a dictionary for an entry matching a key.
(dictsearch dict_ename "MY_KEY")
distanceImplementedCalculates the absolute 3D distance between two coordinate points.
(distance '(0 0 0) '(3 4 0)) ;; Returns: 5.0
distofImplementedParses a distance string representation into its real value.
(distof "12.50" 2) ;; Returns: 12.50
dumpallpropertiesImplementedPrints or logs all supported properties of an entity.
(dumpallproperties (entlast))
entdelImplementedDeletes (or undeletes) an entity inside drawing database.
(entdel (entlast)) ;; Deletes the last created entity
entgetImplementedQueries and retrieves DXF properties of a drawing entity name.
(entget (entlast)) ;; Returns DXF group code list
entlastImplementedReturns the entity name of the last non-deleted object in the database.
(entlast) ;; Returns ename pointer
entmakeImplementedCreates a new graphical or database object via DXF code definitions.
(entmake '((0. "POINT") (10 0 0 0)))
entmakexImplementedCreates an entity, assigns it a handle, and returns its entity name.
(entmakex '((0. "LINE") (10 0 0 0) (11 10 10 0)))
entmodImplementedModifies an existing database entity using updated DXF properties.
(setq edata (entget (entlast))) (setq edata (subst '(8. "Layer2") (assoc 8 edata) edata)) (entmod edata) ;; Updates layer
entnextImplementedReturns the next entity in the drawing database.
(entnext) ;; Returns first entity in active database
entselImplementedPrompts user to select a single drawing entity.
(entsel "Pick entity: ")
entupdImplementedForces visual redraw of specified database entity.
(entupd (entlast)) ;; Forces redraw
eqImplementedChecks if two expressions are bound to identical object references in memory.
(setq a '(1 2) b a) (eq a b) ;; Returns: T
equalImplementedChecks if two expressions evaluate to equal values.
(equal 1.0001 1.0002 0.001) ;; Returns: T
evalImplementedEvaluates an AutoLISP S-expression and returns its result.
(eval '(+ 1 2)) ;; Returns: 3
exitImplementedForces exit of current program and aborts execution context.
(exit) ;; Aborts execution
expImplementedComputes the natural exponential (e raised to the specified power).
(exp 1) ;; Returns: 2.71828
expandImplementedAllocates additional virtual memory segments for LISP nodes.
(expand 10)
exptImplementedRaises the base value to the specified power.
(expt 2 3) ;; Returns: 8
findfileImplementedSearches AutoCAD library paths for a file.
(findfile "acad.pat") ;; Returns complete directory path
findtrustedfileImplementedSearches AutoCAD secure paths for specified filename.
(findtrustedfile "secure_tool.lsp")
fixImplementedTruncates a real number to its nearest integer.
(fix 12.75) ;; Returns: 12
floatImplementedConverts a number into its real floating-point representation.
(float 10) ;; Returns: 10.0
foreachImplementedLoops through list, binding each element sequentially to a symbol for execution.
(foreach x '(1 2 3) (princ x)) ;; Prints "123"
gcImplementedForces garbage collection to run immediately, freeing unallocated dynamic memory pages.
(gc)
gcdImplementedCalculates the greatest common denominator of two integers.
(gcd 12 18) ;; Returns: 6
getangleImplementedPrompts user to specify an angle.
(getangle '(0 0) "Angle: ")
getcfgImplementedRetrieves application settings from AppData section of acad20xx.cfg file.
(getcfg "AppData/MyTool/Setting1")
getcnameImplementedRetrieves localized or global command name for AutoCAD keywords.
(getcname "_LINE") ;; Returns localized command name
getcornerImplementedPrompts user to select rectangular corner.
(getcorner '(0 0 0) "Corner point: ")
getdistImplementedPrompts user to enter distance values.
(getdist "Distance: ")
getenvImplementedRetrieves the value of a system environment variable.
(getenv "PATH")
getfiledImplementedDisplays native file selection dialog box.
(getfiled "Select LISP" "C:/" "lsp" 8)
getintImplementedPrompts user to specify an integer.
(getint "Enter count: ")
getkwordImplementedPrompts user to enter keywords initialized via initget.
(initget "Yes No") (getkword "Continue? (Yes/No): ")
getorientImplementedPrompts user to enter absolute angle ignores ANGBASE.
(getorient "Orientation: ")
getpointImplementedPrompts user for coordinate point selection.
(getpoint "Pick: ")
getpropertyvalueImplementedRetrieves value of a property from a drawing entity.
(getpropertyvalue (entlast) "Area")
getrealImplementedPrompts user to enter a real number.
(getreal "Enter factor: ")
getstringImplementedPrompts user to specify a string.
(getstring T "Enter text: ")
getvarImplementedRetrieves current value of an AutoCAD system variable.
(getvar "CLAYER") ;; Returns active layer name
graphscrImplementedDisplays AutoCAD graphical viewport editor canvas.
(graphscr)
grclearImplementedClears active graphic viewport display buffers.
(grclear)
grdrawImplementedDraws a temporary vector line in active viewport.
(grdraw '(0 0) '(10 10) 1 1)
grreadImplementedDirectly reads user input device stream (keys, mouse, coordinates).
(grread T)
grtextImplementedWrites a string message to coordinates/status line.
(grtext -1 "My Toolbar Status")
grvecsImplementedDraws multiple temporary vectors in active viewport.
(grvecs '(1 (0 0) (5 5)))
handentImplementedRetrieves drawing ename pointing to persistent hexadecimal handle.
(handent "A1") ;; Returns entity name
helpImplementedInvokes AutoCAD offline or online Help documentation system.
(help "acad_acr.chm" "LINE")
ifImplementedConditionally branch S-expression execution.
(if (= 1 1) "Yes" "No") ;; Returns: "Yes"
initcommandversionImplementedInitializes target version constraints for active command pipeline.
(initcommandversion 1)
initdiaImplementedForces next AutoCAD command to display its graphical dialog.
(initdia 1) (command "_PLOT")
initgetImplementedInitializes validation filters and keyword lists for subsequent user-input prompts.
(initget 1 "Yes No") (getkword "Confirm? ")
intersImplementedComputes coordinate intersection of two lines.
(inters '(0 0) '(10 10) '(0 10) '(10 0)) ;; Returns: (5.0 5.0 0.0)
ispropertyreadonlyImplementedChecks if a property of a drawing entity is read-only.
(ispropertyreadonly (entlast) "Area")
itoaImplementedConverts integer to string.
(itoa 123) ;; Returns: "123"
lambdaImplementedDefines an anonymous user function block.
(mapcar '(lambda (x) (* x 2)) '(1 2 3)) ;; Returns: (2 4 6)
lastImplementedRetrieves the final element in a list structure.
(last '(1 2 3)) ;; Returns: 3
layerstate-addlayersImplementedAppends layer lists into existing saved layer states.
(layerstate-addlayers "State1" '("0"))layerstate-compareImplementedCompares a layer state to layers in a specified drawing.
(layerstate-compare "State1" "drawing.dwg")
layerstate-deleteImplementedDeletes a saved layer state.
(layerstate-delete "State1")
layerstate-exportImplementedExports a layer state configuration to an LAS file.
(layerstate-export "State1" "C:/state.las")
layerstate-getlastrestoredImplementedReturns the name of the last restored layer state in active session.
(layerstate-getlastrestored)
layerstate-getlayersImplementedLists all layers registered inside a layer state.
(layerstate-getlayers "State1")
layerstate-getnamesImplementedReturns a list of all saved layer state names.
(layerstate-getnames)
layerstate-hasImplementedChecks if a specified layer state exists.
(layerstate-has "State1")
layerstate-importImplementedImports layer states from an LAS file.
(layerstate-import "C:/state.las")
layerstate-importfromdbImplementedImports layer states from another drawing database.
(layerstate-importfromdb "State1" db_ename)
layerstate-removelayersImplementedRemoves specified layers from a layer state.
(layerstate-removelayers "State1" '("Layer1"))layerstate-renameImplementedRenames a saved layer state.
(layerstate-rename "State1" "NewState")
layerstate-restoreImplementedRestores saved layer state configurations.
(layerstate-restore "State1")
layerstate-saveImplementedSaves current drawing layer configurations into a state.
(layerstate-save "State1")
layoutlistImplementedReturns a list of all paper layout names in the current drawing.
(layoutlist) ;; Returns layout list
lengthImplementedReturns an integer representing the size of a list.
(length '(1 2 3 4)) ;; Returns: 4
listImplementedCreates a standard LISP list structure from S-expressions.
(list 1 2 3) ;; Returns: (1 2 3)
listpImplementedChecks if the specified argument is a list or nil.
(listp '(1 2)) ;; Returns: T (listp nil) ;; Returns: T
loadImplementedLoads an external LISP file into active context.
(load "mylib.lsp" "Failed")
logImplementedComputes natural logarithm of a number.
(log 2.71828) ;; Returns: 1.0
logandImplementedPerforms bitwise logical AND on integer arguments.
(logand 12 5) ;; Returns: 4
logiorImplementedPerforms bitwise logical OR on integer arguments.
(logior 12 5) ;; Returns: 13
lshImplementedPerforms bitwise shift on integer arguments.
(lsh 2 1) ;; Returns: 4
mapcarImplementedMaps a function over elements of lists, returning the results.
(mapcar '1+ '(1 2 3)) ;; Returns: (2 3 4)
maxImplementedReturns the largest numeric value among arguments.
(max 10 20.5 5) ;; Returns: 20.5
memImplementedDisplays diagnostic heap memory segment statistics.
(mem)
memberImplementedSearches list for occurrence of S-expression and returns remaining slice.
(member 3 '(1 2 3 4)) ;; Returns: (3 4)
menucmdTier 2 · clean errorDisplays or executes AutoCAD menu commands.
(menucmd "P0=POP1")
menugroupTier 2 · clean errorRetrieves loaded status of menu groups.
(menugroup "ACAD")
minImplementedReturns the smallest numeric value among arguments.
(min 5 10 -2) ;; Returns: -2
minuspImplementedChecks if a numeric value is negative.
(minusp -10) ;; Returns: T
namedobjdictImplementedReturns entity name of the named object dictionary.
(namedobjdict)
nentselImplementedPrompts user to select sub-entities inside block/nested references.
(nentsel "Select nested element: ")
nentselpImplementedSub-entity selector, returning 3D coordinate transform matrices.
(nentselp "Select nested element: ")
notImplementedComputes logical negation.
(not T) ;; Returns: nil (not nil) ;; Returns: T
nthImplementedRetrieves the n-th element of a list structure (0-indexed).
(nth 1 '(10 20 30)) ;; Returns: 20
nullImplementedChecks if the specified S-expression evaluates to nil.
(null nil) ;; Returns: T
numberpImplementedChecks if the specified S-expression is an Integer or Real number.
(numberp 10.5) ;; Returns: T
openImplementedOpens an external file stream.
(setq f (open "C:/log.txt" "w"))
orImplementedPerforms logical OR. Employs short-circuit evaluation.
(or (= 1 2) (= 2 2)) ;; Returns: T
osnapImplementedApplies object snap modifiers on a coordinate point.
(osnap '(5 5 0) "_endpoint")
polarImplementedCalculates coordinate point project at angle and distance.
(polar '(0 0 0) 0.0 10.0) ;; Returns: (10.0 0.0 0.0)
prin1ImplementedPrints S-expression, keeping escape characters format.
(prin1 "Hello\nWorld") ;; Prints: "Hello\nWorld"
princImplementedPrints S-expression, stripping escape characters.
(princ "Hello\nWorld") ;; Prints clean text
printImplementedPrints S-expression, preceded by newline and followed by a space.
(print "Hello")
prognImplementedEvaluates S-expressions sequentially, returning the value of the final evaluation.
(progn (setq x 10) (setq y 20) (+ x y)) ;; Returns: 30
promptImplementedPrints a message string directly in AutoCAD command prompt console.
(prompt "Initializing...\n") ;; Returns nil
quitImplementedForces immediate exit of current session execution.
(quit)
quoteImplementedReturns the argument S-expression without evaluating it.
(quote (+ 1 2)) ;; Returns: (+ 1 2) (equivalent to '(1 2))
read-charImplementedReads a single character from open file stream.
(read-char f)
read-lineImplementedReads a line of text from open file stream.
(read-line f) ;; Returns line string
readImplementedParses string representation of S-expressions into first LISP expression.
(read "(+ 1 2)") ;; Returns: (+ 1 2)
redrawImplementedRefreshes graphic screen or redraws individual entities.
(redraw (entlast) 3) ;; Highlights last entity
regappImplementedRegisters unique application name key for extended entity data (xdata).
(regapp "MY_APP") ;; Registers key in APPID table
remImplementedReturns division remainder of the first number by the second.
(rem 10 3) ;; Returns: 1
repeatImplementedLoops through S-expressions specified integer number of times.
(repeat 3 (princ "!")) ;; Prints "!!!"
reverseImplementedReverses elements order in a list.
(reverse '(1 2 3)) ;; Returns: (3 2 1)
rtosImplementedConverts real floating-point numbers to formatted strings.
(rtos 12.5 2 2) ;; Returns: "12.50"
setImplementedBinds value to quoted symbol variable.
(set 'x 10) ;; Binds x to 10
setcfgImplementedWrites application config data to AppData of CFG files.
(setcfg "AppData/MyTool/Setting1" "On")
setenvImplementedSets value of system environment variables.
(setenv "ShowFullPath" "1")
setfunhelpImplementedBinds command call keyword to Help documentation pages.
(setfunhelp "C:TEST" "myhelp.chm" "TEST_TOPIC")
setpropertyvalueImplementedSets value of a property on a drawing entity.
(setpropertyvalue (entlast) "Color" 1)
setqImplementedBinds S-expression values to unquoted symbol variables.
(setq a 10 b 20) ;; Returns: 20
setvarImplementedSets active value of an AutoCAD system variable.
(setvar "FILEDIA" 1)
setviewImplementedEstablishes a view configuration for a specified viewport.
(setview "MyView")
showhtmlmodalwindowTier 2 · clean errorDisplays an HTML modal dialog window.
(showhtmlmodalwindow "http://google.com")
sinImplementedComputes the sine of an angle in radians.
(sin 1.570796) ;; Returns: 1.0
snvalidImplementedValidates characters of symbol name (checks if valid in symbol tables).
(snvalid "NEW_LAYER") ;; Returns: T
sqrtImplementedComputes the square root of a positive number.
(sqrt 16) ;; Returns: 4.0
ssaddImplementedConstructs a new selection set or appends entities to existing selection sets.
(setq ss (ssadd))
ssdelImplementedDeletes specified entity from selection sets.
(ssdel (entlast) ss)
ssgetImplementedConstructs AutoCAD selection set grouping drawing entities based on rules/filters.
(ssget "X" '((0. "CIRCLE"))) ;; Selects all Circle entities
ssgetfirstImplementedRetrieves active gripped/preselected entities in drawing context.
(ssgetfirst)
sslengthImplementedReturns the size/length of a selection set.
(sslength ss) ;; Returns element count
ssmembImplementedChecks if specified entity is in selection set.
(ssmemb (entlast) ss)
ssnameImplementedRetrieves entity name at target index inside selection set.
(ssname ss 0) ;; Returns first entity in selection set
ssnamexImplementedRetrieves sub-method coordinates and details of how selection sets were created.
(ssnamex ss 0)
sssetfirstImplementedProgrammatically selects and grips drawing entities.
(sssetfirst nil ss)
startappImplementedLaunches external operating system applications.
(startapp "notepad.exe" "C:/log.txt")
strcaseImplementedReturns copy of string converted to uppercase or lowercase.
(strcase "Hello" T) ;; Returns: "hello"
strcatImplementedConcatenates multiple string arguments into a single string.
(strcat "A" " " "B") ;; Returns: "A B"
strlenImplementedReturns number of characters contained inside string.
(strlen "Hello") ;; Returns: 5
substImplementedSubstitutes occurrences of old elements with new in list structures.
(subst 'x 'b '(a b c)) ;; Returns: (a x c)
substrImplementedExtracts target substring of specified length.
(substr "HelloWorld" 1 5) ;; Returns: "Hello"
tabletTier 2 · clean errorConfigures and calibrates digitizing tablet parameters.
(tablet 1)
tblnextImplementedRetrieves next entry in specified AutoCAD symbol table.
(tblnext "LAYER")
tblobjnameImplementedGets entity pointer ename for symbol table entry.
(tblobjname "LAYER" "0")
tblsearchImplementedSearches symbol table for entry matching keyword.
(tblsearch "LAYER" "0")
terpriImplementedPrints a standard newline line break to command console.
(terpri)
textboxImplementedComputes 2D coordinate bounds of text entity.
(textbox (entget (entlast)))
textpageTier 2 · clean errorClears command text screen and forces console display page refresh.
(textpage)
textscrImplementedActivates and opens the AutoCAD text console window.
(textscr)
traceImplementedActivates function debugging trace.
(trace MyFunc)
transImplementedTranslates coordinates between coordinate systems (WCS, UCS, etc.).
(trans '(1 2 0) 1 0) ;; Translates UCS to WCS
typeImplementedReturns active LISP data type identifier atom.
(type 10) ;; Returns: INT (type "A") ;; Returns: STR
untraceImplementedDeactivates function debugging trace.
(untrace MyFunc)
verImplementedReturns active AutoLISP version string details.
(ver) ;; Returns: "Visual LISP v1.6"
vl-acad-defunImplementedExports a custom LISP function symbol as external subroutine for ObjectARX.
(vl-acad-defun 'MyFunc)
vl-acad-undefunImplementedHides/undefines LISP function symbol from ObjectARX applications.
(vl-acad-undefun 'MyFunc)
vl-arx-importTier 2 · clean errorImports ObjectARX/ADSRX functions into Separate-Namespace LISP VLX modules.
(vl-arx-import 'ads_cmd)
vl-bb-refImplementedRetrieves value of variables from blackboard global namespace.
(vl-bb-ref 'factor)
vl-bb-setImplementedWrites variable values to blackboard global namespace.
(vl-bb-set 'factor 1.5)
vl-catch-all-applyImplementedEvaluates function arguments trapping exceptions.
(vl-catch-all-apply '/ '(10 0)) ;; Returns: #<%catch-all-apply-error%>
vl-catch-all-error-messageImplementedExtracts descriptive error string from trapped exception objects.
(setq err (vl-catch-all-apply '/ '(10 0))) (vl-catch-all-error-message err) ;; Returns: "divide by zero"
vl-catch-all-error-pImplementedChecks if argument is catch-all error object.
(vl-catch-all-error-p err) ;; Returns: T
vl-cmdfImplementedSynchronously executes command pipeline validating parameters in advance.
(vl-cmdf "_LINE" '(0 0) '(5 5) "")
vl-conspImplementedChecks if the specified list is non-empty.
(vl-consp '(1 2)) ;; Returns: T (vl-consp nil) ;; Returns: nil
vl-directory-filesImplementedReturns files list inside specified path.
(vl-directory-files "C:/" "*.lsp" 1)
vl-doc-exportImplementedExports function from Separate-Namespace VLX to active drawing namespace.
(vl-doc-export 'MyFunc)
vl-doc-importImplementedImports exported functions into Separate-Namespace LISP VLX namespace.
(vl-doc-import 'MyFunc)
vl-doc-refImplementedReads variable values from active drawing document namespace.
(vl-doc-ref 'factor)
vl-doc-setImplementedWrites variable values to active drawing document namespace.
(vl-doc-set 'factor 1.5)
vl-everyImplementedChecks if predicate resolves non-nil for all list elements.
(vl-every '= '(1 2) '(1 2)) ;; Returns: T
vl-exit-with-errorImplementedAborts execution context passing custom error text to parent namespace *error*.
(vl-exit-with-error "Fatal Error!")
vl-exit-with-valueImplementedAborts execution returning custom value to parent invoker context.
(vl-exit-with-value 100)
vl-file-copyImplementedCopies or appends files.
(vl-file-copy "C:/a.txt" "C:/b.txt")
vl-file-deleteImplementedDeletes specified file from directory paths.
(vl-file-delete "C:/temp.txt")
vl-file-directory-pImplementedChecks if the specified path points to active directory.
(vl-file-directory-p "C:/Windows") ;; Returns: T
vl-file-renameImplementedRenames specified file.
(vl-file-rename "a.txt" "b.txt")
vl-file-sizeImplementedRetrieves file size in bytes.
(vl-file-size "C:/boot.ini")
vl-file-systimeImplementedRetrieves file last-modified system time details.
(vl-file-systime "C:/boot.ini")
vl-filename-baseImplementedStrips path and extension returning filename root base name.
(vl-filename-base "C:/temp/draw.lsp") ;; Returns: "draw"
vl-filename-directoryImplementedStrips base name and extension returning directory path.
(vl-filename-directory "C:/temp/draw.lsp") ;; Returns: "C:/temp"
vl-filename-extensionImplementedReturns filename extension portion.
(vl-filename-extension "draw.lsp") ;; Returns: ".lsp"
vl-filename-mktempImplementedGenerates unique temp file path.
(vl-filename-mktemp "test" nil ".txt")
vl-list*ImplementedConstructs lists, wrapping final argument into S-expression cdr.
(vl-list* 1 2 3) ;; Returns: (1 2. 3)
vl-list->stringImplementedCombines list of integer ASCII/Unicode values into text string.
(vl-list->string '(72 101 108 108 111)) ;; Returns: "Hello"
vl-list-lengthImplementedRetrieves length of true flat lists.
(vl-list-length '(1 2 3)) ;; Returns: 3
vl-list-loaded-vlxTier 2 · clean errorLists all separate-namespace VLX files associated with active document context.
(vl-list-loaded-vlx)
vl-load-allTier 2 · clean errorLoads LISP files into all active and future drawing documents namespaces.
(vl-load-all "utils.lsp")
vl-member-ifImplementedChecks if elements in list satisfy predicate subroutine, returning remaining list slice.
(vl-member-if 'minusp '(1 2 -3 4)) ;; Returns: (-3 4)
vl-member-if-notImplementedChecks if elements in list do not satisfy predicate subroutine.
(vl-member-if-not 'minusp '(-1 -2 3 4)) ;; Returns: (3 4)
vl-mkdirImplementedCreates new directory paths on disk.
(vl-mkdir "C:/NewFolder")
vl-positionImplementedRetrieves index position of symbol inside flat list.
(vl-position "b" '("a" "b" "c"))
;; Returns: 1vl-prin1-to-stringImplementedFormats LISP elements as escaped printed string representations.
(vl-prin1-to-string "Hello") ;; Returns: "\"Hello\""
vl-princ-to-stringImplementedFormats LISP elements as unescaped printed string representations.
(vl-princ-to-string "Hello") ;; Returns: "Hello"
vl-propagateImplementedCopies variable values across all active document namespaces.
(vl-propagate 'scale_factor)
vl-registry-deleteImplementedDeletes keys or values from Windows Registry or Mac plist files.
(vl-registry-delete "HKEY_CURRENT_USER\\Software\\MyApp")
vl-registry-descendentsImplementedLists registry subkeys/values.
(vl-registry-descendents "HKEY_CURRENT_USER\\Software")
vl-registry-readImplementedReads values from Windows Registry or Mac plist files.
(vl-registry-read "HKEY_CURRENT_USER\\Software\\MyApp" "Path")
vl-registry-writeImplementedWrites values to Windows Registry or Mac plist files.
(vl-registry-write "HKEY_CURRENT_USER\\Software\\MyApp" "Path" "C:/App")
vl-removeImplementedRemoves element occurrences from a list.
(vl-remove 2 '(1 2 3 2 4)) ;; Returns: (1 3 4)
vl-remove-ifImplementedRemoves elements from a list passing predicate filter tests.
(vl-remove-if 'minusp '(1 -2 3 -4)) ;; Returns: (1 3)
vl-remove-if-notImplementedKeeps elements from a list passing predicate filter tests.
(vl-remove-if-not 'minusp '(1 -2 3 -4)) ;; Returns: (-2 -4)
vl-someImplementedChecks if predicate holds true for at least one list element combination.
(vl-some 'minusp '(1 2 -3 4)) ;; Returns: T
vl-sortImplementedSorts list elements based on comparison subroutines (note: removes duplicates).
(vl-sort '(3 1 2 3) '<) ;; Returns: (1 2 3)
vl-sort-iImplementedSorts list elements returning indices mapping order.
(vl-sort-i '(10 30 20) '<) ;; Returns: (0 2 1)
vl-string->listImplementedConverts text characters into Unicode value list.
(vl-string->list "ABC") ;; Returns: (65 66 67)
vl-string-eltImplementedRetrieves Unicode character code at specified string index.
(vl-string-elt "ABC" 1) ;; Returns: 66
vl-string-left-trimImplementedTrims matching leading characters from string.
(vl-string-left-trim "_" "___Hello") ;; Returns: "Hello"
vl-string-mismatchImplementedFinds index of first character mismatch position between strings.
(vl-string-mismatch "Hello" "Help") ;; Returns: 3
vl-string-positionImplementedFinds index position of character in string.
(vl-string-position 66 "ABC") ;; Returns: 1
vl-string-right-trimImplementedTrims matching trailing characters from string.
(vl-string-right-trim "_" "Hello___") ;; Returns: "Hello"
vl-string-searchImplementedSearches text matching substring pattern.
(vl-string-search "world" "Hello world") ;; Returns: 6
vl-string-substImplementedSubstitutes first occurrence of old substring with new.
(vl-string-subst "a" "o" "Hello world") ;; Returns: "Hella world"
vl-string-translateImplementedTranslates characters based on maps.
(vl-string-translate "abc" "123" "cabin") ;; Returns: "31bin"
vl-string-trimImplementedTrims leading and trailing matching characters from string.
(vl-string-trim "_" "__Hello__") ;; Returns: "Hello"
vl-symbol-nameImplementedReturns string name of symbol.
(vl-symbol-name 'factor) ;; Returns: "FACTOR"
vl-symbol-valueImplementedRetrieves value bound to specified symbol.
(setq x 10) (vl-symbol-value 'x) ;; Returns: 10
vl-symbolpImplementedChecks if S-expression is a symbol.
(vl-symbolp 'x) ;; Returns: T
vl-unload-vlxTier 2 · clean errorUnloads Separate-Namespace VLX applications.
(vl-unload-vlx "my_app")
vl-vbaloadTier 2 · clean errorLoads VBA project files.
(vl-vbaload "C:/proj.dvb")
vl-vbarunTier 2 · clean errorRuns specified VBA macro.
(vl-vbarun "MyMacro")
vl-vlx-loaded-pTier 2 · clean errorChecks if Separate-Namespace VLX is loaded.
(vl-vlx-loaded-p "my_app")
vportsImplementedReturns active viewport configuration list.
(vports)
wcmatchImplementedChecks if a string matches wildcard pattern.
(wcmatch "test.dwg" "*.dwg") ;; Returns: T
whileImplementedEvaluates expressions inside a loop as long as test is non-nil.
(setq i 0) (while (< i 3) (princ i) (setq i (1+ i)) ) ;; Prints "012"
write-charImplementedWrites single character code to file stream.
(write-char 65 f)
write-lineImplementedWrites a line of text to file stream.
(write-line "Log Entry" f)
xdroomImplementedChecks amount of available xdata memory space on drawing entity.
(xdroom (entlast))
xdsizeImplementedCalculates size in bytes of specified xdata list.
(xdsize '((1001. "MY_APP") (1000. "DATA")))
zeropImplementedChecks if numeric S-expression evaluates to zero.
(zerop 0.0) ;; Returns: T (zerop 5) ;; Returns: nil