Automation, Performance & Collaboration - From AutoLISP to Autodesk Docs
Overview
If you repeat the same task over and over, you can automate it with AutoLISP, macros, and scripts.
Add cleanup commands like PURGE/AUDIT/OVERKILL to keep drawings lean, and collaboration features like Autodesk Docs, Trace, and Share to sync with your team — individual productivity improves 2–3x, and team workflow improves by a factor of several.
> For basic shortcuts and editing commands, see 01-shortcuts.md. For block/Xref operations, see 03-blocks-xref.md.
1. AutoLISP — AutoCAD's Built-in Scripting Language
AutoLISP has been bundled with AutoCAD since 1986 and is a LISP-derived language. Extensions: .lsp (source), .fas/.vlx (compiled).
1.1 How to Load
| Method | Description |
|---|---|
APPLOAD | Select file via dialog |
(load "C:/my.lsp") | Direct load from the command line |
| Startup Suite | APPLOAD → Contents → register in auto-load list |
acaddoc.lsp | Runs every time any drawing opens |
acad.lsp | Runs once at AutoCAD startup |
acaddoc.lsp — registering them individually in the Startup Suite is better for version control and debugging.1.2 Basic Structure — Hello World
(defun c:HELLO ()
(princ "\nHello, AutoCAD!")
(princ)
)
defun: Function definition.c:prefix: makes the function callable asHELLOfrom the command line.princ: output function. The trailing(princ)is a conventional call that suppresses the return value (nil) from being echoed at the command line.
1.3 Commonly Used Built-in Functions
| Function | Purpose |
|---|---|
getpoint | Get a point coordinate from the user |
getdist | Get a distance (two points or a number) |
getreal / getint | Real or integer input |
getstring | String input |
getangle / getorient | Angle input |
entsel | Select a single object |
ssget | Build a selection set (supports filters) |
command | Call a built-in AutoCAD command |
entget / entmod | Read/write DXF data of an entity |
assoc / cons / subst | Manipulate association lists |
mapcar / foreach | Iterate through lists |
1.4 Practical Routine Example — "Lock Layers of Selected Objects"
(defun c:LL ( / ss i ent lay)
(princ "\nSelect objects to lock their layers: ")
(setq ss (ssget))
(if ss
(repeat (setq i (sslength ss))
(setq ent (ssname ss (setq i (1- i))))
(setq lay (cdr (assoc 8 (entget ent))))
(command "_.LAYER" "_LO" lay "")
)
)
(princ)
)
After loading, type LL at the command line and the layers of the selected objects will all be locked. The key point is that DXF code 8 holds the layer name of an entity.
1.5 Visual LISP, COM, .NET
VLIDE: Visual LISP integrated development environment. Includes debugger and console.- After
(vl-load-com), you can manipulate the ActiveX object model via the(vla-*)family of functions — a more powerful form of automation. - .NET (C#/VB): Load DLLs with
NETLOADto deploy in-house tools. This is the domain of professional developers. - ObjectARX: C++ based. The standard development environment for third-party plug-ins.
.lsp files via acaddoc.lsp can double your perceived productivity.2. Command Macros
In the CUI "Macro" field, write a command sequence as a string and bind it to a toolbar, ribbon button, or keyboard shortcut.
2.1 Syntax
| Symbol | Meaning |
|---|---|
^C^C | Two Esc presses (cancel any running command) |
_ | Underscore — force English command (multilingual environments) |
. | Ignore user redefinition and use the default command |
; or newline | Enter |
\ | Pause for user input |
* | Repeat the command itself |
2.2 Examples
Switch current layer to DIMS, then start linear dimensioning:
^C^C_-LAYER;S;DIMS;;_DIMLINEAR
Insert company-standard block TB-A3 at the paper space origin:
^C^C_-INSERT;TB-A3;0,0;1;1;0
* to make the command auto-repeat. Useful for continuous insertion or continuous annotation.3. SCR Scripts & Batch Execution
3.1 SCR Files
An .scr file is a plain text file listing command-line input one line at a time.
ZOOM EXTENTS
PURGE ALL * N
AUDIT Y
QSAVE
Load and run with the SCRIPT command, or pass it with the /b option when launching AutoCAD.
3.2 Batch Processing Many DWGs
- ScriptPro 2.0 (free from Autodesk): pair an SCR with a DWG list for batch execution.
- accoreconsole.exe (AutoCAD 2013+): opens DWGs and runs SCRs in the background with no GUI. The standard way to process thousands of DWGs overnight on a server.
FILEDIA 0 and CMDDIA 0, and always restore them at the end.4. Performance Optimization — Keeping Drawings Lean
4.1 PURGE
PURGE (PU) removes unused definitions (layers, blocks, linetypes, text styles, dimension styles, materials, etc.).
| Option | Description |
|---|---|
| Default dialog | Select items via checkboxes |
-PURGE | Command-line version for automation |
-PURGE R | Clean up Registered Applications (Regapps) |
| Purge nested items | Purge blocks inside blocks |
| Purge zero-length geometry | Zero-length lines, empty text |
-PURGE A * N 2–3 times usually cleans it up.4.2 AUDIT / RECOVER / RECOVERALL
AUDIT: Integrity check on the current drawing. Answer "Fix errors? Y" for automatic repair.RECOVER: Opens a corrupted DWG in recovery mode. Use for files that won't open with plain OPEN.RECOVERALL: Recovers the current DWG and all Xrefs together.
RECOVER → (3) restore the .bak file → (4) autosave .sv$ (SAVEFILEPATH) → (5) commercial recovery services.4.3 OVERKILL
OVERKILL consolidates duplicate objects stacked on the same spot and collinear segmented lines into single entities.
- Filters by layer, color, linetype.
- Numeric fuzz (tolerance): treats slightly offset objects as identical.
- Optimize polylines: simplifies consecutive straight segments.
- Combine co-linear objects: merges collinear objects.
4.4 Recommended System Variable Values
| Variable | Default | Recommended | Description |
|---|---|---|---|
SAVETIME | 10 | 5 | Autosave interval (minutes) |
ISAVEBAK | 1 | 1 | Create .bak backup |
INDEXCTL | 0 | 3 | Optimize partial Xref loading |
WHIPTHREAD | 1 | 3 | Multi-threaded display |
VTENABLE | 15 | 0 | Disable zoom/pan animation (speed up) |
BACKGROUNDPLOT | 2 | 0–2 | For large Publish jobs, 0 is safest |
4.5 Troubleshooting Large Drawings
| Symptom | Likely Cause | Action |
|---|---|---|
| Slow open | Many Xrefs, huge images | Raise INDEXCTL, lower image resolution |
| Slow save | Drawing History enabled | Turn History off, -PURGE |
| Laggy selection | Duplicate objects | OVERKILL |
| Slow hatch | Dense patterns | Increase scale, switch to Solid, send to back |
| Long REGEN | Too many objects | Freeze unused layers, VP Freeze |
| Plot hangs | BACKGROUNDPLOT | Set to 0, lower PDF quality |
5. Collaboration — Autodesk Docs, AutoCAD Web, Share, Trace
5.1 Autodesk Docs / Construction Cloud
- Shared project file repository. DWG/PDF review, markup, and release management are unified.
- Open and save directly from AutoCAD via Open from Autodesk Docs / Save to Autodesk Docs.
- Versions, permissions, and activity logs are recorded automatically.
5.2 AutoCAD Web / Mobile
- From browser or tablet: open DWGs, make simple edits, measure, and annotate.
- Great for on-site quick checks and markups. Do full editing on the desktop.
5.3 SHARE — Link Sharing
SHARE turns the current drawing into a link that opens in Autodesk Viewer. Recipients can view it just from the URL, no install required. The default expiration is 7 days.
5.4 Drawing History / COMPARE / XCOMPARE
- For DWGs in versioned stores like Autodesk Docs, Drawing History lets you compare past versions via a slider.
COMPARE/XCOMPARE: Overlay differences between two DWGs in color.
5.5 Trace (2022+)
TRACE lets you overlay annotations and edit proposals on a semi-transparent layer without modifying the original drawing.
A Trace created on web or mobile can be loaded on desktop to review and merge.
Markup Assist: Uses AI to recognize PDF/image markups and proposes converting them into editable objects on the Trace layer.
5.6 Markup Import (2023+, improved in 2026)
MARKUPIMPORT inserts an external PDF, PNG, or JPG markup as a Trace layer.
Starting in 2026, it syncs bidirectionally with Autodesk Docs — markups edited in Docs are reflected back into AutoCAD automatically.
5.7 eTransmit — The Standard for External Distribution
ETRANSMIT bundles the current DWG along with all Xrefs, images, SHX/TTF fonts, and plot styles into a single ZIP or folder.
Plain file copying tends to miss references and fonts, so for outsourcing, inspection, and bid submissions, always use eTransmit.
5.8 Trusted DWG
A DWG created or saved by genuine, Autodesk-certified applications. Opening a DWG saved by another CAD tool may trigger a "Not a Trusted DWG" warning.
Functionally there is little difference, but to avoid assembly or compatibility incidents we recommend opening important drawings in AutoCAD and saving them once.
6. Collaboration Infrastructure — Standard Deployment
- DWS + CHECKSTANDARDS: Standards checking against corporate or national standards.
- Sheet Set: consistent project sheet management (see
03-blocks-xref.mdfor details). - Block Library / networked Tool Palette: same blocks for everyone.
- CUIx Partial deployment: identical ribbon, shortcuts, and macros for all.
- Profile (.arg): sync OPTIONS settings via export/import.
7. Field Checklist
- Frequently used LSPs are registered in the Startup Suite
-
acaddoc.lspis kept from bloating - In-house standard macros are deployed via Partial CUIx
- Overnight batch processing is based on accoreconsole.exe
- A weekly maintenance SCR (AUDIT→PURGE→SAVE) is running
-
SAVETIME=5,ISAVEBAK=1are enabled for autosave and backup -
INDEXCTL=3is applied on large Xrefs - OVERKILL is applied to scan and PDF→DWG output
- External submissions are packaged with
ETRANSMIT - Autodesk Docs or an equivalent VCS is the team repository
- Markup Import / Trace workflows are shared with the team
- Profile
.argis used for new-hire setup