AutoCAD LT – Layout name and page number diesel expression


These diesel expressions output the variable for the current layout and cuts it at a specified length, this way parts of the name of the layout tab can be inserted into the drawing header:

From this into this!

In this case E63-01_2 is automatically inserted into a drawing header as E63-01 in the name box and 2 in the page number box . DRAWING NAME_PAGENUMBER


To create this in your drawing you first need to create two multiline text objects (MTEXT command). Place them where you would like the data to be inserted.

Double click on the MTEXT object and you will see the following toolbar, click on the small button on the top right and select insert field. See image below:

You will find lots of menus and options you can reference here. The data entry for the current layout name is called CTAB and can be located from the dropbox other. In this case we will use a Diesel expression to “chop it up”.

Copy and paste the following into the expression textbox depending on what you wish the MTEXT to display:

DIESEL Expression Code

Single letter page number: $(substr,$(getvar,ctab),$(-,$(strlen,$(getvar,ctab)),0))
Single letter page name: $(substr,$(getvar,ctab),1,$(-,$(strlen, $(getvar,ctab)),3))

Double letter page number: $(substr,$(getvar,ctab),$(-,$(strlen,$(getvar,ctab)),1))
Double letter page name: $(substr,$(getvar,ctab),1,$(-,$(strlen, $(getvar,ctab)),4))

Thats it!


2 Comments on “AutoCAD LT – Layout name and page number diesel expression”

  1. Hadi says:

    Hey. Thanks for sharing this.

    Is there a way to get the total number of layouts?
    So that we can have for example drawing #1 of 8?


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s