AutoLISP: Select Text, Rename Layout Tab

Link to AutoCAD Tips

I used this LISP routine frequently for my old job. It is a routine that I found at and is very helpful. What it does is let you rename the current layout tab by selecting a text object that is on the layout tab. The text object can also be an attribute.

Here’s how:

  • NLAY <enter>
  • Select a text object (DTEXT, MTEXT or an ATTRIBUTE)

That’s it. Now your layout tab matches the sheet title or whatever other text on the layout tab…


;;; CADALYST 09/08
;;; Nlay.lsp Rename Layouts (c) 2008 Jim Sturgess
;NLay.lsp Written by Jim Sturgess 14-April-2008
;Renames the Current Layout Tab to Match Selected Attribute or Text
(DEFUN C:NLay (/ Match Text)
(WHILE (= Match NIL)
(SETQ Match (NENTSEL "\nSelect Attribute or Text: "))
(IF (= Match NIL)(ALERT "Please Select Attribute or Text..."))
);Ends WHILE Function
(IF (/= NIL Match)
(SETQ Match (ENTGET (CAR Match)))
);Ends IF Function
(IF(SETQ Text(CDR(ASSOC 1 Match)))
(COMMAND "layout" "rename" "" Text)
);Ends IF Function
(SETVAR "cmdecho" 1)
);Ends DEFUN

About AutoCAD Tips

This blog serves as a knowledge base for myself (and anyone else) so that I can reference tips & tricks that I have learned and also refer others to it as well. I hope that this blog helps you learn at least one tip to make your drafting/design experience better.
This entry was posted in Attributes, AutoLISP, AutoLISP: Attributes, AutoLISP: Text, Layout, Paper Space, Text, TIPS. Bookmark the permalink.

3 Responses to AutoLISP: Select Text, Rename Layout Tab

  1. Sam says:

    I wonder if there’s a way to make this script place the current layout’s SHEET NUMBER (from the Sheetset manager) into the layout name. I can use the sheet number in a FIELD but not in the layout name. In a field, the SHEET NUMBER looks like this:

    posibble errors are:
    a) the layout is not linked to s sheetset
    b) the layout does not have a sheet number in the sheetset
    Thanks for the tips, they are very helpful.

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 )

Facebook photo

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

Connecting to %s