CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products []
CZ | EN | DE
Login or
  Visitors: 5285
Plex.Earth connects AutoCAD and Google Earth

CAD tip CAD tip # 11171:

Question CAD 
 %  platform  category 
Q - question

Total number of layouts as a field (Page 3 of 7).

A - answer AutoCAD does not offer the total number of layouts as a system variable so you cannot easily use automatic text fields of the type "Page X of Y" to your title blocks.

With help of the TotalLayouts reactor (or the PageOf utility, see below) you can add this possibility of multiple layout numbering to your AutoCAD and automate your batch plots.


To compose such automatic text, you will need two text fields - the current page/layout name/number and the total number of layouts (pages). The current layout name can be accessed through the variable CTAB so this field is available in Other > System variable:

We will make the variable for the total number of layouts as an automatically updated LISP variable "totallayouts". This value will be then available in the Field dialog through Other > Lisp variable:

But first you will need to define this variable and make sure it is dynamically updated whenever you add or delete a layout. This can be achieved with this simple LISP code:

The code can be downloaded from Download. To load and run the code automatically in each DWG drawing session in your AutoCAD, add it to your Startup Suite in APPLOAD - drag the downloaded LSP file (stored in an AutoCAD support folder) onto the briefcase icon in the AppLoad dialog.

Then compose the MText, Field or Attribute using the above mentioned variables.




Another approach is used by the freeware LISP utility PageOf - see Download. This tool creates a field (text or block attribute) with an automatic counter "Page N of M" ("Seite N aus M"). The page number is generated from the order (position) of the individual layout tab. Just load the VLX file (APPLOAD), type the command PAGEOF and select a sample text object in paperspace of a layout (or a block attribute). The selected text is changed to the mentioned dynamic counter - e.g. "Page 2 of 5" for the second layout - and will change to "Page 2 of 6" if you add a new layout to the end of the layout list. This automatic counter then works also without any add-on utility or reactor.

The option "Name" (since version 1.2) allows to bulk-rename layouts - either with keeping the original name (Layout1 of 10) or in the same way as the field (Page 1 of 10). When you add a new layout, just re-run the command.


You can preset the displayed text using the following LISP variables (in every session, i.e. e.g. in ACADDOC.LSP):

(setq _PageOfPage "Page ") ; "Seite "
(setq _PageOfOf " of ") ; " aus "

to display "Page 1 of 10" or "Seite 1 aus 10", or:

(setq _PageOfPage "")
(setq _PageOfOf "/")

to display just "1/10", or:

(setq _PageOfPage "Sheet ")
(setq _PageOfOf " (of ")
(setq _PageOfSuf ")")

to display "Sheet 1 (of 10)".

100% *  CAD 
15.11.2016    44164×   FAQ  
Prices - CAD eShop:
applies to: AutoCAD ·

See also:
Tip 13778:How to publish several DWG drawings into one multi-page PDF?
Tip 13622:Bulk import pages from a multi-page PDF into AutoCAD.
Tip 13288:LayoutLF - automatic switching of group layer filters.
Tip 11821:How to publish PDF sheets (pages) under the plain layout name?
Tip 9331:What is contextual field and why it is not updated in a block?

Back   All CAD Tips

Have we helped you? If you want to support the CAD Forum web service, consider buying one of our CAD applications, or our custom software development offerings, or donating via PayPal (see above). You may also add a link to your web - like this "fan" link: CAD Forum - tips, utilities, blocks for Autodesk products
CAD:    OS:    Categ: 
Text:  FAQ glossary   

Publish interactive 3D PDF models from AutoCAD, Inventor or Revit with Share3D More info

Please use these tips at your own risk.
Arkance Systems is not responsible for possible problems that may occur as a result of using any of these tips.