AutoCAD – Drawings

Batch plotting in AutoCAD: a whole set to PDF in one pass

Batch plotting in AutoCAD sends a whole set of title blocks to PDF in one pass. Settings go in a dialog box and are remembered. An open lisp you can read.

  • TS. Đỗ Quốc Hoàng
  • 15 min read
Four A3 title blocks laid out in model space, turned into four PDF files by a single command Photo: AutoCAD 2027

A thirty-sheet set plotted one sheet at a time eats an afternoon, which is why batch plotting in AutoCAD is the second most downloaded kind of lisp there is. The catch is that the most widely shared file comes compiled, so you cannot read what it does before loading it into your machine.

This article covers the real plot sequence on AutoCAD 2027, shows why plotting by hand takes so long, and offers the Institute's file with its source left open. For the whole documentation and printing workflow, see the AutoCAD for Construction course.

The plot command is already there, but it is long-winded

AutoCAD plots without any lisp, through the -PLOT command. That is the command-line form of plotting, and it is what every batch-plot lisp calls underneath.

The trouble is how much it asks. One pass on AutoCAD 2027, with every prompt copied verbatim — nineteen questions for one sheet.

Detailed plot configuration? [Yes/No] <No>:
Enter a layout name or [?] <Model>:
Enter an output device name or [?] <...>:
Enter paper size or [?] <...>:
Enter paper units [Inches/Millimeters] <Inches>:
Enter drawing orientation [Portrait/Landscape] <Portrait>:
Plot upside down? [Yes/No] <No>:
Enter plot area [Display/Extents/Limits/View/Window] <Window>:
Enter lower left corner of window <...>:
Enter upper right corner of window <...>:
Enter plot scale (Plotted Millimeters=Drawing Units) or [Fit] <Fit>:
Enter plot offset (x,y) or [Center] <0.00,0.00>:
Plot with plot styles? [Yes/No] <Yes>:
Enter plot style table name or [?] (enter . for none) <...>:
Plot with lineweights? [Yes/No] <Yes>:
Enter shade plot setting [As displayed/...] <As displayed>:
Enter file name <...>:
Save changes to page setup [Yes/No]? <N>
Proceed with plot [Yes/No] <Y>:

Multiply nineteen by thirty sheets and the appetite for a lisp explains itself. After each sheet AutoCAD also reports the area it actually used, for example Effective plotting area: 420.00 wide by 297.00 high.

Two more things came out of the measuring, and both decide whether the command runs at all.

The first question forks into two quite different paths. Answer No to Detailed plot configuration? and AutoCAD drops every detail question, asking instead one that the list above does not contain: Enter a page setup name <>:. That path is quick but sets no paper size, no orientation, no plot area and no plot style. Declaring those means answering Yes, and that is the nineteen questions listed above.

After the lineweight question the two kinds of device ask different things. A file-writing device such as DWG To PDF.pc3 asks Enter file name <...>:, while a real printer asks Write the plot to a file [Yes/No] <N>:. Both paths behave that way, and the printer path can be stopped before Proceed with plot so no paper is used. The lisp therefore reads the prompt before answering rather than assuming: one wrong guess and every later answer lands on the wrong question.

One small detail that saves a lot of grief: the paper name must be typed exactly. To see the list, answer the paper question with a question mark and AutoCAD prints them all. The line for landscape A3 reads ISO full bleed A3 (420.00 x 297.00 MM). That is the string a lisp needs.

A compiled file you cannot read

The most widely shared batch-plot lisp, opened and read through, tells its own story. It is not a .lsp file but a .VLX — a compiled one.

A few figures about that file: 23,964 bytes, starting with the identifier VRTLIB-1, and on the next line a declaration of (:protected . T). Scanning the whole file for the string (defun, which begins every AutoLISP function, finds not one occurrence.

To be fair: compiling is the author's right, and nothing suggests the file does anything wrong. But the consequences are plain.

You cannot read what it does. You cannot change its default paper size or plot style. And when AutoCAD raises the Security - Unsigned Executable File dialog asking whether to load it, you have no way of checking for yourself before answering. Handling that dialog is covered in our article on numbering lisps.

So the Institute's file stays a plain .lsp. Open it in Notepad and every line is there.

Three ways to plot a whole set, differing in effort and in whether you can read the code Photo: Diagram by the Institute of Information Technology in Civil Engineering

IN-IIC.lsp: one title block, one PDF

Download IN-IIC.lsp29 KB, three commands, source left open. The new version takes its settings in a dialog box and remembers them for next time.
CommandWhat it does
INHLplots by title block, sorted into rows then left to right
INHLCplots by rectangles on one layer, no block needed
INHL1plots a single frame so you can check the settings first

If a command name clashes with another lisp you have loaded, use the fallback names INHLIIC, INHLCIIC and INHL1IIC.

All three open the same dialog. Plotter, paper size and plot style are picked from lists read straight from AutoCAD, so you no longer type the paper size name letter for letter. Pressing OK stores the settings in the Windows Registry; close AutoCAD, open it again, and the dialog is already filled in.

The call to the plot command sits in one small function, with a comment on each line saying which -PLOT question it answers:

(defun iic-in-mot (p1 p2 tep)
  (command "_.-PLOT"
           "_Y"                                  ; Detailed plot configuration? -> Yes
           ""                                    ; Enter a layout name -> Model
           *iic-in-may*                          ; Enter an output device name
           *iic-in-kho*                          ; Enter paper size
           "_M"                                  ; Enter paper units -> Millimeters
           (if (= *iic-in-huong* "P") "_P" "_L") ; Enter drawing orientation
           "_N"                                  ; Plot upside down? -> No
           "_W"                                  ; Enter plot area -> Window
           p1                                    ; Enter lower left corner of window
           p2                                    ; Enter upper right corner of window
           "_F"                                  ; Enter plot scale -> Fit
           "_C"                                  ; Enter plot offset -> Center
           "_Y"                                  ; Plot with plot styles? -> Yes
           *iic-in-ctb*                          ; Enter plot style table name
           "_Y")                                 ; Plot with lineweights? -> Yes
  (command "")                                   ; Enter shade plot setting -> As displayed
  ;; Den day hai loai thiet bi hoi khac nhau, nen doc dong nhac.
  (if (wcmatch (strcase (getvar "lastprompt")) "*PLOT TO A FILE*")
    (command "_N")                               ; may in that: khong ghi ra tep
    (command tep)                                ; thiet bi ghi tep: dua ten tep
  )
  (command "_N")                                 ; Save changes to page setup? -> No
  (command "_Y")                                 ; Proceed with plot -> Yes
  (princ)
)

INHL1 is the one to run first. Plot a single frame, open the PDF, check the scale and lineweights, and only then run the whole set. A mistake on the test sheet costs one fix; a mistake on the thirtieth costs the whole run.

Using it, step by step

Step 1 — Load it and declare a trusted folder

Copy the file into a folder of its own, say C:\Lisp, then type APPLOAD, pick the file and press Load. The command line reports Đã nạp IN-IIC... when it is in. If the security dialog appears, declare that folder trusted under OPTIONS, the Files tab, Trusted Locations.

To have the commands ready every time AutoCAD starts, press Contents... under Startup Suite in the APPLOAD dialog and Add the file.

Step 2 — Prepare the drawing

The frames sit in model space, laid out in rows. The example below has five title blocks, block KHUNG-A3, in two rows, plus a red rectangle on layer KHUNG-IN for the INHLC command.

Five title blocks in two rows in model space, next to a red rectangle on layer KHUNG-IN for plotting with INHLC Photo: AutoCAD 2027

Step 3 — Point at a sample title block

Type INHL. The prompt reads:

Chọn MỘT khung tên mẫu (phải là block):

Click a line of any title block. AutoCAD reports the block name it recognised, for example Tên block khung tên: KHUNG-A3, then opens the IN HANG LOAT - IIC dialog.

The INHL dialog: plotter, paper size, plot style, orientation, output folder, prefix, start number and row tolerance Photo: AutoCAD 2027

Step 4 — Fill in the dialog

FieldWhat to enter
Máy in (plotter)The plotters AutoCAD knows about. For PDF pick DWG To PDF.pc3. Changing the plotter reloads the paper sizes for that device.
Khổ giấy (paper size)Picked from the plotter's own list. For drawings with no white margin pick an ISO full bleed size, such as ISO full bleed A3 (420.00 x 297.00 MM).
Kiểu in (plot style)A .ctb file (or .stb if the drawing uses named plot styles). For black and white pick monochrome.ctb; pick (Không dùng) to plot true colour.
Hướng giấy (orientation)Landscape or Portrait.
Thư mục lưu PDF (output folder)Type a path or press ... to browse. A missing folder is created. Ignored when plotting to a real printer.
Prefix and start numberThe file name is the prefix plus a three-digit counter: prefix TO-, start 1 gives TO-001.pdf, TO-002.pdf... The Tệp đầu tiên line at the bottom previews the first name.
Dung sai hàng (row tolerance)Frames whose centres differ in Y by less than this count as one row. About half the frame height is safe: an A3 frame at 1:1 is 297 high, so 100–150; a frame scaled 100 times (29,700 high) is fine with the default 1000. Too large and two rows merge, scrambling the order.
Lớp khung in (frame layer)Used only by INHLC: the layer holding the frame rectangles.
Paper sizes come from the selected plotter's own list rather than being typed by hand Photo: AutoCAD 2027

Press OK and the lisp checks every field before plotting. A bad value is reported on the last line of the dialog, the cursor jumps back to that field and the dialog stays open. Cancel leaves the command without plotting anything.

Letters typed into the start number field: the dialog stays open and reports the error on its last line Photo: AutoCAD 2027

Step 5 — Select, then let it plot

Chọn các khung tên cần in:

Window the whole set and press Enter. Catching other objects does no harm; the lisp keeps only the title block inserts. AutoCAD reports the sheet count, for example Sẽ in 4 tờ, theo thứ tự từ trái sang phải, trên xuống dưới., and works through them.

Four A3 title blocks in two rows in model space. One INHL command produced TO-001 to TO-004, in the right order Photo: AutoCAD 2027

Step 6 — Let the PDF writer finish

This is the step most likely to look like a failure.

Listing the folder the instant the command returned gave this: TO-001.pdf already at its full 2,142 bytes, while TO-002.pdf had a name but zero bytes. A few seconds later it was complete. The command had finished; the PDF writer had not.

The BACKGROUNDPLOT variable stands at 2. By Autodesk's table that means plotting runs in the foreground and only publishing runs in the background. So the lag is not background plotting — it is the PDF writer completing after the command hands control back.

That is why the Institute's file does not decide by looking for the file straight away, which would under-report. It says how many sheets it sent, then counts the .pdf files in the folder so you can compare.

Plotting by rectangle, and plotting one test frame

By rectangle (INHLC). Create a layer of its own, say KHUNG-IN, and draw a rectangle with RECTANG around each sheet. Set the layer to Plot = No so the frame lines stay off the paper. Type INHLC; the dialog opens with the Lớp khung in field enabled. Pick the layer, press OK, then window the rectangles. Only polylines on that layer are used.

The INHLC dialog adds the frame layer field Photo: AutoCAD 2027

One test frame (INHL1). Type INHL1 and click the lower-left then upper-right corner of one frame. In the dialog, row tolerance and layer are greyed out because they do not apply. Open the PDF and check scale, lineweights and paper size. If it is right, run INHL or INHLC for the whole set: the settings you just entered are already filled in.

The INHL1 dialog: row tolerance and frame layer are greyed out because only one frame is plotted Photo: AutoCAD 2027

Where the settings are remembered

Every OK writes the settings to the Registry key HKEY_CURRENT_USER\Software\IIC\IN-IIC. The start number is kept too, so when you plot another set into the same folder, change the start number or the prefix to avoid overwriting the earlier files. To return to the defaults, delete that key.

Two more things worth knowing. To read the paper sizes, the lisp briefly switches the Model page's plotter and then restores it, so AutoCAD may mark the drawing as modified. And if for any reason the dialog cannot open, the lisp falls back to asking for each setting on the command line.

Preparing the drawing: the plot style matters

Three things, done once for good.

The title block must be a block. Every batch-plot lisp requires this, ours included, because the command needs a reliable way to tell where one sheet ends. A frame drawn as loose lines gives it nothing to group. Creating blocks is covered in our article on blocks in AutoCAD.

If an old file already has frames drawn as lines, there is still a way: use INHLC, put a rectangle around each sheet on a layer of its own such as KHUNG-IN, and plot by that layer.

Keep the frames in line. The command sorts by row, so frames in one row should share a similar Y. A few hundred units is what the tolerance is for; a whole metre and AutoCAD sees two rows.

Settle on one plot style. The .ctb file decides which lines print heavy and which print light. Set it once and stop thinking about it. Managing lineweight by layer is covered in our article on layers in AutoCAD.

When to reach for a layout instead

Everything above assumes the Vietnamese habit of laying sheets out side by side in model space. It is not the only way, and it is worth knowing when the other way wins.

A layout holds one sheet with its own paper size, plot style and viewports, and AutoCAD can publish a whole stack of layouts in one go without any lisp at all. If a project is set up that way from the start, that route is tidier: the settings live with each sheet rather than being typed again at every plot.

The reason model space still dominates here is history. Older sets were built that way, subcontractors send files that way, and changing a whole office's habit mid-project costs more than it saves. So both routes stay useful, and the lisp exists for the one that has no built-in equivalent.

What does not change either way: the plot style table decides the lineweights, and a test sheet before the full run saves the most time of anything in this article.

Three things often repeated that are not true

Often repeatedWhat the 2027 release does
Batch plotting needs a lisp-PLOT does it, at nineteen answers per sheet
Any lisp can be read, it is a text fileThe most shared file is a compiled .VLX declaring (:protected . T)
When the command ends, the files are thereThe next file had a name and zero bytes, complete seconds later

Frequently asked questions

Can batch plotting in AutoCAD go straight to PDF?

Yes. Pick DWG To PDF.pc3 in the plotter field of the dialog and give an output folder. Each sheet becomes its own file, numbered in sequence.

Where can I download a lisp for batch plotting in AutoCAD safely?

From somewhere you know, and prefer a readable .lsp over a compiled .VLX. Open it in a text editor before loading it.

AutoCAD says I picked the wrong thing when I click the title block.

Your title block is not a block. Use INHLC instead and put a rectangle around each sheet on a layer of its own.

The plot order comes out scrambled.

Raise the row tolerance. If frames in one row differ in Y by more than that number, AutoCAD treats them as separate rows.

Can it plot from layouts?

This file plots windows in model space, which is how most Vietnamese documentation is set up. For a set built around layouts, AutoCAD's own publishing command is the tidier route.

Why is the folder short of files when it says it has finished?

Because the PDF writer completes after the command hands control back. Wait a few seconds, and watch for the Plot and Publish Job Complete balloon at the bottom right.

About the author

TS. Đỗ Quốc Hoàng — Vice Director of the Institute of Information Technology in Civil Engineering, Hanoi University of Civil Engineering, and a specialist in software development for construction