<?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: Changing layers names - autolisp in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/13384822#M45113</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the command to create or edit layers, is LAYER or -LAYER&lt;/P&gt;&lt;P&gt;create a script macro or lisp-command to controle it by commandline.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Open F2 to follow the command workflow easier&lt;/P&gt;&lt;P&gt;-Layer&amp;lt;enter&amp;gt;&lt;/P&gt;&lt;P&gt;Co&amp;lt;enter&amp;gt;&lt;/P&gt;&lt;P&gt;5&amp;lt;enter&amp;lt;&lt;/P&gt;&lt;P&gt;A&amp;lt;enter&amp;gt;&lt;/P&gt;&lt;P&gt;Co&amp;lt;enter&amp;gt;&lt;/P&gt;&lt;P&gt;1&amp;lt;enter&amp;gt;&lt;/P&gt;&lt;P&gt;B,C&amp;lt;enter&amp;gt;&lt;/P&gt;&lt;P&gt;Co&amp;lt;enter&amp;gt;&lt;/P&gt;&lt;P&gt;6&amp;lt;enter&amp;gt;&lt;/P&gt;&lt;P&gt;[D-E]&amp;lt;enter&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;enter&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[F1]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 22 Mar 2025 11:49:46 GMT</pubDate>
    <dc:creator>cadffm</dc:creator>
    <dc:date>2025-03-22T11:49:46Z</dc:date>
    <item>
      <title>Changing layers names - autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11194593#M45094</link>
      <description>&lt;P&gt;Hi, I have a drawing (attached DWG). Is there a way to automaticity change the layers name according to this EXCEL file (attached)? from OLD column to NEW column?&lt;/P&gt;&lt;P&gt;Thanl you very much&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 11:29:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11194593#M45094</guid>
      <dc:creator>yu85.info</dc:creator>
      <dc:date>2022-05-26T11:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: Changing layers names - autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11195976#M45095</link>
      <description>&lt;P&gt;Does not read Excel, but if you structure your data in a list it's very easy.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(defun c:foo (/ a l)
  ;; Make your data list like so
  (setq l '(("A" "WATER") ("B" "ELEC") ("C" "GROUND") ("D" "PEOPLE")))
  (vlax-for lyr	(vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
    (if	(setq a (assoc (strcase (vla-get-name lyr)) l))
      (vl-catch-all-apply 'vla-put-name (list lyr (cadr a)))
    )
  )
  (princ)
)&lt;/LI-CODE&gt;
&lt;P&gt;Then if you want to make the list in Excel, it can be formatted to lisp like so:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ronjonp_1-1653598008163.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1072556iE6A35E78BFF63CF1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ronjonp_1-1653598008163.png" alt="ronjonp_1-1653598008163.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Copy paste into list 'l' and rock and roll!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 20:47:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11195976#M45095</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2022-05-26T20:47:30Z</dc:date>
    </item>
    <item>
      <title>Betreff: Changing layers names - autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11196068#M45096</link>
      <description>&lt;P&gt;without Lisp - specially for LT users&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(just a sample, because the best way use LayMrg instead rename - if the new layer is already present)&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 21:27:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11196068#M45096</guid>
      <dc:creator>cadffm</dc:creator>
      <dc:date>2022-05-26T21:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: Changing layers names - autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11196097#M45097</link>
      <description>Thank you very much. But what do you mean to arrange it in a list? In the&lt;BR /&gt;script you wrote?&lt;BR /&gt;I don't really need an Excel file. It was just for the example.&lt;BR /&gt;</description>
      <pubDate>Thu, 26 May 2022 21:42:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11196097#M45097</guid>
      <dc:creator>yu85.info</dc:creator>
      <dc:date>2022-05-26T21:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: Changing layers names - autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11196122#M45098</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3808012"&gt;@yu85.info&lt;/a&gt;&amp;nbsp; schrieb:&lt;BR /&gt;I don't really need an Excel file. It was just for the example.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Okay, then write a simple script like my sample in the xls file&lt;/P&gt;
&lt;P&gt;_.rename _layer A&lt;/P&gt;
&lt;P&gt;Water&lt;/P&gt;
&lt;P&gt;_.rename _layer B&lt;/P&gt;
&lt;P&gt;ELEC&lt;/P&gt;
&lt;P&gt;_.rename _layer C&lt;/P&gt;
&lt;P&gt;GROUND&lt;/P&gt;
&lt;P&gt;_.rename _layer D&lt;/P&gt;
&lt;P&gt;PEOPLE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or look at the STANDARDS command or better LAYTRANS [F1]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and for the lisp solution above - see how the OLD and NEW names are arranged - so you can change it if you need&lt;/P&gt;
&lt;P&gt;safe the .lsp file&lt;/P&gt;
&lt;P&gt;load this .lsp file&lt;/P&gt;
&lt;P&gt;start the command foo &lt;/P&gt;
&lt;P&gt;You can change the name foo to ehatever you want, c:MyLayTrans instead of c:foo for example&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(setq l '(("A" "WATER") ("B" "ELEC") ("C" "GROUND") ("D" "PEOPLE")))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 21:52:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11196122#M45098</guid>
      <dc:creator>cadffm</dc:creator>
      <dc:date>2022-05-26T21:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: Changing layers names - autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11196305#M45099</link>
      <description>&lt;P&gt;An extra alternative is to make a csv file from excel would have oldlayername,newlayername.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;; rename layers

(defun C:renlay ( / fo ans )
; thanks to Lee-mac for this defun
(defun csv-&amp;gt;lst ( str / pos )
(if (setq pos (vl-string-position 44 str))
    (cons (substr str 1 pos) (csv-&amp;gt;lst (substr str (+ pos 2))))
    (list str)
    )
)

(setq fo (open (getfiled "Select CSV File" "" "csv" 16) "R"))
(setq dummy (read-line fo))
(while (setq str (read-line fo))
(setq ans (csv-&amp;gt;lst  str))
(princ ans)
(setq layold (car ans) laynew (cadr ans))
(if (tblsearch "Layer" laynew)
(alert (strcat "The layer "laynew " already exists so skipping that layer "))
(command "-rename" "layer" layold laynew)
)
)
(close fo)

(princ)
)
(c:renlay)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 27 May 2022 00:07:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11196305#M45099</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2022-05-27T00:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: Changing layers names - autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11197657#M45100</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3808012"&gt;@yu85.info&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The list in the code is formatted as ((OLDNAME NEWNAME)(OLDNAME NEWNAME)...) .. modify it to your needs then run the code. Understand?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(setq l '(("A" "WATER") ("B" "ELEC") ("C" "GROUND") ("D" "PEOPLE")))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ronjonp_0-1653657618751.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1072878iCD72607C369776A4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ronjonp_0-1653657618751.png" alt="ronjonp_0-1653657618751.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;If you run the code in your sample drawing you will see that it works per your example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 13:20:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11197657#M45100</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2022-05-27T13:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: Changing layers names - autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11197679#M45101</link>
      <description>Thank you very much for your help. I will try what you said.&lt;BR /&gt;</description>
      <pubDate>Fri, 27 May 2022 13:26:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11197679#M45101</guid>
      <dc:creator>yu85.info</dc:creator>
      <dc:date>2022-05-27T13:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: Changing layers names - autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11197817#M45102</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3808012"&gt;@yu85.info&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thank you very much for your help. I will try what you said.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Glad to help. Let me know how it goes.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 14:27:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11197817#M45102</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2022-05-27T14:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: Changing layers names - autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11197901#M45103</link>
      <description>&lt;P&gt;Or the "plain" way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;(setq pairs '(&lt;FONT color="#33CCCC"&gt;("A" "WHO") ("B" "WHAT") ("C" "WHY")&lt;/FONT&gt;))&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;(defun RLL (pairs) ; = Rename Layers from List&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;&amp;nbsp; (foreach pair pairs&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;&amp;nbsp; &amp;nbsp; (if (tblsearch "layer" (car pair))&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; (command "_.rename" "_layer" (car pair) (cadr pair))&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;&amp;nbsp; &amp;nbsp; )&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;&amp;nbsp; )&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;&amp;nbsp; (princ)&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Interestingly, there's a Layer option in the RENAME command, &lt;STRONG&gt;and&lt;/STRONG&gt; also the converse -- a Rename option in the -LAYER command.&amp;nbsp; I used the former because the latter would take an extra enter "" to conclude the Layer command.&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;EDIT:&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp; Removed the C: before the RLL function name.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 19:26:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11197901#M45103</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2022-05-27T19:26:42Z</dc:date>
    </item>
    <item>
      <title>Re: Changing layers names - autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11197904#M45104</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/71745"&gt;@cadffm&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;.... write a simple script like my sample in the xls file&lt;/P&gt;
&lt;P&gt;_.rename _layer A&lt;/P&gt;
&lt;P&gt;Water&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;[That will have trouble if any of the old Layer names does not exist in the drawing.]&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 19:24:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11197904#M45104</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2022-05-27T19:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Changing layers names - autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11197924#M45105</link>
      <description>&lt;P&gt;You answering to me?&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":rolling_on_the_floor_laughing:"&gt;🤣&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 15:15:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11197924#M45105</guid>
      <dc:creator>cadffm</dc:creator>
      <dc:date>2022-05-27T15:15:51Z</dc:date>
    </item>
    <item>
      <title>Re: Changing layers names - autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11197981#M45106</link>
      <description>Sounds good I will try that also. Thank you very much friend.&lt;BR /&gt;</description>
      <pubDate>Fri, 27 May 2022 15:39:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11197981#M45106</guid>
      <dc:creator>yu85.info</dc:creator>
      <dc:date>2022-05-27T15:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: Changing layers names - autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11197993#M45107</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Or the "plain" way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;(setq pairs '(&lt;FONT color="#33CCCC"&gt;("A" "WHO") ("B" "WHAT") ("C" "WHY")&lt;/FONT&gt;))&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;(defun C:RLL (pairs) ; = Rename Layers from List&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;&amp;nbsp; (foreach pair pairs&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;&amp;nbsp; &amp;nbsp; (if (tblsearch "layer" (car pair))&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; (command "_.rename" "_layer" (car pair) (cadr pair))&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;&amp;nbsp; &amp;nbsp; )&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;&amp;nbsp; )&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;&amp;nbsp; (princ)&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Interestingly, there's a Layer option in the RENAME command, &lt;STRONG&gt;and&lt;/STRONG&gt; also the converse -- a Rename option in the -LAYER command.&amp;nbsp; I used the former because the latter would take an extra enter "" to conclude the Layer command.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;That code won't work with C:.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you mean?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(rll '(("A" "WHO") ("B" "WHAT") ("C" "WHY")))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 15:46:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11197993#M45107</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2022-05-27T15:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Changing layers names - autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11198132#M45108</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/593837"&gt;@ronjonp&lt;/a&gt;&amp;nbsp;wrote:....
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;....That code won't work with C:.&amp;nbsp; ....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You're right.&amp;nbsp; I first wrote it up with the list of Layer-name pairs built into the command, and the C: was appropriate, but when I decided to pull the list out and make it an argument, so it could be used with different lists, I forgot to pull the C: out of the (defun) line.&amp;nbsp; I've made the correction there.&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 19:27:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/11198132#M45108</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2022-05-27T19:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: Changing layers names - autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/12086672#M45109</link>
      <description>&lt;P&gt;i have a lisp and we changed the layer names but only by a little so how do i make it search like *hatch/Hatch&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:HS nil
  ;; Set pattern scale
  (if (&amp;gt; (getvar 'dimscale) 0)
    (setvar 'hpscale (* 0.05 (getvar 'dimscale)))
  )
  ;; Set pattern name
  (setvar 'hpname "AR-SAND")
  (command "._BHATCH")
  (while (&amp;gt; (getvar 'cmdactive) 0) (command "\\"))
  ;; Hatches to back
  (command "._HATCHTOBACK")
  (command "_.chprop" "_last" "" "_layer" "E-Hatch" "")
  (princ)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it used to be Ehatch and now its E-Hatch sometimes old drawings are used about 50% of the time so im just tryna make it so the lisp works for everyone regardless of old or new drawing is open.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2023 15:41:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/12086672#M45109</guid>
      <dc:creator>JohnC_ISM</dc:creator>
      <dc:date>2023-07-07T15:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: Changing layers names - autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/12086814#M45110</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2832802"&gt;@JohnC_ISM&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;.... how do i make it search like *hatch/Hatch&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;....
  (command "_.chprop" "_last" "" "_layer" "E-Hatch" "")
....&lt;/LI-CODE&gt;
&lt;P&gt;it used to be Ehatch and now its E-Hatch sometimes old drawings are used about 50% of the time so im just tryna make it so the lisp works for everyone regardless of old or new drawing is open.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It can check through all the possibilities for the Layer name until it finds the one that is in the current drawing [or, the &lt;EM&gt;first&lt;/EM&gt; one it finds, if there are more than one of them]:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(command
  "_.chprop" "_last" "" "_layer"
  (cond ; find a Layer that exists
    ((tblsearch "layer" "E-hatch") "E-hatch")
    ((tblsearch "layer" "Ehatch") "Ehatch")
    ((tblsearch "layer" "Hatch") "Hatch")
    ((tblsearch "layer" "Whatever") "Whatever")
    ("0")
  ); cond
  "" ; conclude CHPROP
)&lt;/LI-CODE&gt;
&lt;P&gt;[That would not be case-sensitive.]&lt;/P&gt;
&lt;P&gt;It will stop looking as soon as it finds one of those Layer names exists and uses it.&amp;nbsp; I added a there-aren't-any fallback to put it on Layer 0, so that it can't cause an error, since that Layer will always exist, but it could be made to just keep it on the current Layer instead.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2023 16:48:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/12086814#M45110</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-07-07T16:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: Changing layers names - autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/12086832#M45111</link>
      <description>Either one is fine theyre the same everything just the name changed. It was annoying trying to read a list of Ehatch, Eboundary. So I just changed it so itd slightest bit easier with E-Hatch, E-Boundary and so on. Thanks ill give this a go.&lt;BR /&gt;</description>
      <pubDate>Fri, 07 Jul 2023 16:55:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/12086832#M45111</guid>
      <dc:creator>JohnC_ISM</dc:creator>
      <dc:date>2023-07-07T16:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: Changing layers names - autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/13384640#M45112</link>
      <description>&lt;P&gt;Hello everyone, how can I create an autolisp that will change the color of the layers with the corresponding names A, B, C, D in the drawing without changing the layer name?&lt;/P&gt;</description>
      <pubDate>Sat, 22 Mar 2025 06:17:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/13384640#M45112</guid>
      <dc:creator>632_23</dc:creator>
      <dc:date>2025-03-22T06:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: Changing layers names - autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/13384822#M45113</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the command to create or edit layers, is LAYER or -LAYER&lt;/P&gt;&lt;P&gt;create a script macro or lisp-command to controle it by commandline.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Open F2 to follow the command workflow easier&lt;/P&gt;&lt;P&gt;-Layer&amp;lt;enter&amp;gt;&lt;/P&gt;&lt;P&gt;Co&amp;lt;enter&amp;gt;&lt;/P&gt;&lt;P&gt;5&amp;lt;enter&amp;lt;&lt;/P&gt;&lt;P&gt;A&amp;lt;enter&amp;gt;&lt;/P&gt;&lt;P&gt;Co&amp;lt;enter&amp;gt;&lt;/P&gt;&lt;P&gt;1&amp;lt;enter&amp;gt;&lt;/P&gt;&lt;P&gt;B,C&amp;lt;enter&amp;gt;&lt;/P&gt;&lt;P&gt;Co&amp;lt;enter&amp;gt;&lt;/P&gt;&lt;P&gt;6&amp;lt;enter&amp;gt;&lt;/P&gt;&lt;P&gt;[D-E]&amp;lt;enter&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;enter&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[F1]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Mar 2025 11:49:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-layers-names-autolisp/m-p/13384822#M45113</guid>
      <dc:creator>cadffm</dc:creator>
      <dc:date>2025-03-22T11:49:46Z</dc:date>
    </item>
  </channel>
</rss>

