<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: batch add suffix to layout tabs in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-add-suffix-to-layout-tabs/m-p/7482776#M113022</link>
    <description>&lt;P&gt;Unfortunately Layouts can only be renamed when the drawing is openen by the user in AutoCAD.&lt;/P&gt;&lt;P&gt;When opening a drawing with ODBX (like with Lee Mac's ObjectDBX Wrapper), the Layout objects are read-only as far as I can tell and thus it will not be possible to rename the layouts. So the only way to rename Layouts in drawings in batch is by using a script I'm afraid (or perhaps with .NET).&lt;/P&gt;</description>
    <pubDate>Mon, 23 Oct 2017 08:30:24 GMT</pubDate>
    <dc:creator>DannyNL</dc:creator>
    <dc:date>2017-10-23T08:30:24Z</dc:date>
    <item>
      <title>batch add suffix to layout tabs</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-add-suffix-to-layout-tabs/m-p/7478838#M113020</link>
      <description>&lt;P&gt;I have never done lisp, so I hope this is possible&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At my work the AutoCAD layout tabs are named with the item number.&amp;nbsp;Then before it is sent to the client I need to add&amp;nbsp;a date in parenthesis and a letter. An example would be... 3-512(10-20-17)P.&amp;nbsp; I was looking for a lisp or something that would batch add a suffix to the layout tab without opening each drawing. So with a&amp;nbsp;drawing&amp;nbsp;that already has the&amp;nbsp;tab&amp;nbsp;named&amp;nbsp;with the&amp;nbsp;item number I could add (10-20-17)P to each existing tab in several closed drawings and it would be ready to be sent without opening each one to edit the tab names.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I currently use the batch attribute editor found here:&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.lee-mac.com/batte.html" target="_blank"&gt;http://www.lee-mac.com/batte.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;to batch edit attributes without opening each file and was hoping for something that would work similar to add a suffix to the existing layout tabs without opening each drawing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2017 17:44:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-add-suffix-to-layout-tabs/m-p/7478838#M113020</guid>
      <dc:creator>sschaper392FD</dc:creator>
      <dc:date>2017-10-20T17:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: batch add suffix to layout tabs</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-add-suffix-to-layout-tabs/m-p/7480781#M113021</link>
      <description>&lt;P&gt;please upload a few dwg , and the way it will be the las letter after the close parenthesis.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Oct 2017 18:58:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-add-suffix-to-layout-tabs/m-p/7480781#M113021</guid>
      <dc:creator>devitg</dc:creator>
      <dc:date>2017-10-21T18:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: batch add suffix to layout tabs</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-add-suffix-to-layout-tabs/m-p/7482776#M113022</link>
      <description>&lt;P&gt;Unfortunately Layouts can only be renamed when the drawing is openen by the user in AutoCAD.&lt;/P&gt;&lt;P&gt;When opening a drawing with ODBX (like with Lee Mac's ObjectDBX Wrapper), the Layout objects are read-only as far as I can tell and thus it will not be possible to rename the layouts. So the only way to rename Layouts in drawings in batch is by using a script I'm afraid (or perhaps with .NET).&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2017 08:30:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-add-suffix-to-layout-tabs/m-p/7482776#M113022</guid>
      <dc:creator>DannyNL</dc:creator>
      <dc:date>2017-10-23T08:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: batch add suffix to layout tabs</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-add-suffix-to-layout-tabs/m-p/7484421#M113023</link>
      <description>&lt;P&gt;So for a script.. As I go thru the commands: LAYOUT; RENAME....then it has the entire text of the tab shown and highlighted. I able to keep the item number but get to the end of the text to add&amp;nbsp;the date and letter&amp;nbsp;if I use the arrow key and then the end key (end key by itself does not work). How would that be shown in notepad? Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2017 17:09:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-add-suffix-to-layout-tabs/m-p/7484421#M113023</guid>
      <dc:creator>sschaper392FD</dc:creator>
      <dc:date>2017-10-23T17:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: batch add suffix to layout tabs</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-add-suffix-to-layout-tabs/m-p/7486065#M113024</link>
      <description>&lt;P&gt;You cannot use commands in a script that require user input as that would halt the script.&lt;/P&gt;&lt;P&gt;So for renaming the layouts in a script with just a pre- and/or suffix, the easiest way would to use a LISP that does the work for you. See code below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use the TEST command to run with user input on your current drawing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(defun c:Test ()
   (if
      (and
         (setq T_Prefix (getstring T "\nPrefix: "))
         (setq T_Suffix (getstring T "\nSuffix: "))
         (or
            (/= T_Prefix "")
            (/= T_Suffix "")
         )
      )
      (PreSufLayouts T_Prefix T_Suffix)
   )
   (princ)
)

(defun PreSufLayouts (PSL_Prefix PSL_Suffix / PSL_Layouts PSL_ActiveDoc)
   (if     
      (and
         (= (type PSL_Prefix) 'STR)
         (= (type PSL_Suffix) 'STR)
         (or
            (/= PSL_Prefix "")
            (/= PSL_Suxfix "")
         )
      )
      (progn
         (vla-StartUndoMark (setq PSL_ActiveDoc (vla-get-ActiveDocument (vlax-get-acad-object))))
         (setq PSL_Layouts (vla-get-Layouts PSL_ActiveDoc))
         (vlax-for PSL_Item PSL_Layouts
            (if
               (/= (strcase (vla-get-Name PSL_Item)) "MODEL")
               (vla-put-Name PSL_Item (strcat PSL_Prefix (vla-get-Name PSL_Item) PSL_Suffix))
            )
         )
         (vla-EndUndoMark PSL_ActiveDoc)
         (mapcar 'vlax-release-object (list PSL_Layouts PSL_ActiveDoc))
      )
   )
)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For a script you&amp;nbsp;need to use the syntax: &lt;STRONG&gt;(PreSufLayouts "" "\&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;(10-20-17\)P")&lt;/STRONG&gt;&amp;nbsp; &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;-- mind the \ before the ( and ) in the suffix string!&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Be sure the LISP is loaded in each drawing before&amp;nbsp;using the command by loading it after opening each drawing (like in the script example below)&amp;nbsp;or by adding it to your StartUp suite in AutoCAD (or other automatically loaded LISP). But if you automatically load the LISP in each drawing, you need to remove the &lt;STRONG&gt;(load .....&amp;nbsp;&lt;/STRONG&gt; lines in the script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Create the script something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;open "C:\Folder\Drawing-001.dwg"
(load "C:\\Folder2\\YourFile.LSP")
(PreSufLayouts "" "\(10-20-17\)P")
.qsave
.close
open "C:\Folder\Drawing-002.dwg"
(load "C:\\Folder2\\YourFile.LSP")
(PreSufLayouts "" "\(10-20-17\)P")
.qsave
.close
....
....
....&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 07:42:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-add-suffix-to-layout-tabs/m-p/7486065#M113024</guid>
      <dc:creator>DannyNL</dc:creator>
      <dc:date>2017-10-24T07:42:29Z</dc:date>
    </item>
    <item>
      <title>Re: batch add suffix to layout tabs</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-add-suffix-to-layout-tabs/m-p/7487882#M113025</link>
      <description>&lt;P&gt;Thanks so much for your help! Got it working and it will be a time saver around here for sure!&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 18:25:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-add-suffix-to-layout-tabs/m-p/7487882#M113025</guid>
      <dc:creator>sschaper392FD</dc:creator>
      <dc:date>2017-10-24T18:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: batch add suffix to layout tabs</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-add-suffix-to-layout-tabs/m-p/7488968#M113026</link>
      <description>&lt;P&gt;You're welcome &amp;amp; glad I could help&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 05:36:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-add-suffix-to-layout-tabs/m-p/7488968#M113026</guid>
      <dc:creator>DannyNL</dc:creator>
      <dc:date>2017-10-25T05:36:01Z</dc:date>
    </item>
  </channel>
</rss>

