AutoLISP Plotting & PDF Automation
AutoLISP can remove repetitive plotting work. A routine can loop through layouts, create one PDF per sheet, name the files automatically and apply standard settings. The safest way to learn it is to automate one small task first, verify the result, and only then expand to a large batch.
AutoLISP can remove repetitive plotting work. A routine can loop through layouts, create one PDF per sheet, name the files automatically and apply standard settings. The safest way to learn it is to automate one small task first, verify the result, and only then expand to a large batch.
Start here — what you are going to do
Your goal: Load a simple AutoLISP plotting routine, test it on one Layout, and only then use it for batch PDF output.
Where to go: AutoCAD command line is the easiest beginner entry point. Load .lsp files with APPLOAD, then run the command name defined by the routine.
Beginner rule: Change one thing at a time. After each important change, use Preview or create one test PDF/print before continuing.
Step by step — follow this in order
Step 1 — Make one Layout plot correctly by hand
Where: AutoCAD Layout > Output > Plot / Page Setup Manager.
Do this: Before using LISP, create one correct PDF manually.
Check: Keep this file as the reference result the routine must reproduce.
Step 2 — Save the routine as a .lsp file
Where: Use a plain-text editor and save the code with a .lsp extension.
Do this: Keep the file in a simple test folder while learning.
Check: The file should be plain text, not a Word document.
Step 3 — Load the LISP in AutoCAD
Where: AutoCAD command line > type APPLOAD > Enter.
Do this: Browse to the .lsp file, select it and click Load.
Check: AutoCAD should confirm the application was loaded, or show an error you can diagnose.
Step 4 — Run the routine command
Where: Command line.
Do this: Type the command name defined by the routine, for example a command created with (defun c:NAME …).
Check: The routine should run on the current/test drawing only.
Step 5 — Test one Layout first
Where: Use a test drawing with one or two Layouts.
Do this: Create one PDF and stop to inspect its filename, page size, scale and CTB.
Check: Do not move to a full loop until the first output matches the manual reference.
Step 6 — Add the batch loop only after the single-sheet test
Where: Edit/reload the LISP.
Do this: Loop through Paper Space layouts, skip Model, validate output folder/device/paper/style, and log failures.
Check: A failed dependency should be reported instead of silently creating wrong PDFs.
Step 7 — Test copies before production drawings
Where: Work on copies of representative DWGs.
Do this: Run several different layout names and sizes before production deployment.
Check: Only then consider using the routine on a large project batch.
A simple example
From one layout to a batch
Start with a routine that reads the active layout name and creates one PDF. Once the file is correct, extend the routine to the next layout. A batch routine should be the same tested action repeated safely, not a completely different plotting setup.
The main pieces of a plotting routine
Check current settings first
Inspect the active layout, layout list, current Page Setup, printer/PDF device and plot-style settings before changing anything.
Running commands from AutoLISP
AutoLISP can send command-line input, but prompt sequences and localization/version differences can make raw command automation brittle.
Using the AutoCAD programming API
Visual LISP/ActiveX can offer more structured access on supported platforms, but software version and operating system support must be stated.
Protect existing PDF files
Never overwrite output silently. Sanitize layout names and check path collisions.
Avoid changing the DWG unless needed
A plotting routine should avoid saving persistent layout changes unless that is explicitly its purpose.
How AutoLISP plotting automation should be structured
Minimal inspection example
Functions such as (getvar "CTAB") and layout-list routines can identify the current/available layouts before any plotting command is issued. The point is not the two lines of code; it is the habit of reading state before changing state.
Using command
Autodesk documents that the AutoLISP command function sends arguments to successive AutoCAD prompts. This makes it powerful but also dependent on a predictable command-line sequence.
SCR versus LISP
A script file is a linear list of command-line instructions. Use SCR when the sequence is fixed; use AutoLISP when you need conditions, loops, filename construction, checking or error handling.
Cross-platform/BricsCAD
Do not label a routine “AutoCAD + BricsCAD” because it happens to load. CADPlotting downloads will state tested product/version/platform and identify code paths that rely on Windows-only ActiveX or other APIs.
Common problems and what to check first
| What you see | What may be causing it | Check this first |
|---|---|---|
| Command prompts shift | Version/localization/device changes. | Prefer stable command options or API and test supported versions. |
| Paper name invalid | The printer uses a different paper name than the routine expects. | Read/check available media before plotting. |
| CTB missing | The CTB file may be missing from the configured support path. | Check file before batch loop. |
| Layout name invalid in filename | Characters/path collision. | Sanitize and deduplicate. |
| Hundreds of wrong PDFs | Routine did not check first sample. | Stop after first output unless checking passes. |
For production AutoLISP routines
Production routines should check required files and settings before they start, log failures, protect existing PDFs and avoid changing saved layout settings unless that is the stated purpose. State which AutoCAD/BricsCAD versions and operating systems were actually tested.
Official references
Frequently asked questions
Can AutoLISP plot every layout to a separate PDF?
Yes. A routine can list Paper Space layouts and call the plot workflow for each one using controlled filenames and settings.
Will the same plotting LISP work in AutoCAD and BricsCAD?
Some routines can work in both, but command behavior and API details must be tested. Compatibility should be stated for each download or tutorial.
Is it safe to run plot automation on hundreds of drawings?
Only after the routine has been tested on copies that represent the real project. check devices, paper sizes, plot styles and naming before a large batch run.
Why should a LISP routine check one PDF before plotting the full batch?
A wrong device, media name, CTB or filename rule can otherwise create hundreds of incorrect files. A first-output checkpoint catches environment assumptions before the loop continues.
Explore more in CAD Plot Automation Guide.
Continue with CADPlotting
Browse all guides in this section (17)
AutoLISP Foundations
- AutoLISP Command Calls vs ActiveX for Plotting Automation
- AutoLISP Error Handling for Plotting: Restore State and Fail Safely
- AutoLISP Plotting Automation for Beginners: Start Here
- AutoLISP vs SCR for AutoCAD Plot Automation
- How to Debug an AutoLISP Plotting Routine
- How to Load AutoLISP Plotting Routines with APPLOAD
- How to Test AutoLISP Plotting Scripts Safely Before Production
- SECURELOAD and TRUSTEDPATHS for AutoLISP Plotting Scripts
