<?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 Creating new layer name &amp;amp; assigning layer color autolisp in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/creating-new-layer-name-amp-assigning-layer-color-autolisp/m-p/8285734#M99225</link>
    <description>&lt;P&gt;Hi, I found an autolisp to rename &amp;amp; change layer color through googling. Though I understand how the autolisp work, I am still novice to modify it. The reason I want to modify the lisp is that, it cannot rename layer "0" &amp;amp; xref related layers. So instead of using rename, just want to make another new layer &amp;amp; transfer selected objects in that layer to the new&amp;nbsp; pre-defined layer. Any help &amp;amp; comments would be much appreciated. Thanks a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Autolisp Routine:&lt;BR /&gt;1. Select "pre-defined layer name" in the list.&lt;BR /&gt;2. Make this as "new layer name".&lt;/P&gt;&lt;P&gt;3. Select item/entity to change to the new added &lt;SPAN&gt;"pre-defined layer name"&lt;/SPAN&gt;. All same entities/same "old layer name" will transfer to the new added &lt;SPAN&gt;"pre-defined layer name"&lt;/SPAN&gt;.&lt;BR /&gt;3. Change layer color according to user choosen color.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please see below original autolisp:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun saveVars()&lt;BR /&gt;(setq ss(get_tile "mylayers1"))&lt;BR /&gt;(if(= ss "")&lt;BR /&gt;(setq newlay "Nothing is Selected")&lt;BR /&gt;(setq newlay (nth (atoi ss) mylayers1))&lt;BR /&gt;)&lt;BR /&gt;(princ)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun C:demo()&lt;/P&gt;&lt;P&gt;(setq mylayers1(list "a1" "a2" "a3" "a4" "b1" "b2" "b3" "b4" "c1" "c2" "c3" "c4" "x1" "x2" "x3" "x4" "y1" "y2" "y3" "y4" "z1" "z2" "z3" "z4" ))&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;(if(not(setq dcl_id (load_dialog "demo.dcl")))&lt;BR /&gt;(progn&lt;BR /&gt;(alert "The DCL file could not be loaded!")&lt;BR /&gt;(exit)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;(progn&lt;BR /&gt;(if (not(new_dialog "demo" dcl_id))&lt;BR /&gt;(progn&lt;BR /&gt;(alert "The demo.DCL file could not be loaded!")&lt;BR /&gt;(exit)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;(progn&lt;BR /&gt;(start_list "mylayers1" 3)&lt;BR /&gt;(mapcar 'add_list mylayers1)&lt;BR /&gt;(end_list)&lt;/P&gt;&lt;P&gt;(action_tile "accept" "(saveVars)(done_dialog 2)")&lt;BR /&gt;(action_tile "cancel" "(done_dialog 1)")&lt;/P&gt;&lt;P&gt;(setq ddiag(start_dialog))&lt;BR /&gt;(unload_dialog dcl_id)&lt;/P&gt;&lt;P&gt;(if(= ddiag 1)&lt;BR /&gt;(princ "\n Laye Rename cancelled!")&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;(if(= ddiag 2)&lt;BR /&gt;(progn&lt;BR /&gt;(princ "\n The user pressed Okay!")&lt;BR /&gt;&lt;BR /&gt;(if(and&lt;BR /&gt;(setq e (car (entsel "\nSelect ent⁪ity to rename: ")))&lt;BR /&gt;(setq e (tblsearch "layer" (cdr (assoc 8 (entget e)))))&lt;BR /&gt;)&lt;BR /&gt;(prompt(strcat"\nLayer: "(cdr (assoc 2 e))", Color: "(itoa (cdr (assoc 62 e)))))&lt;BR /&gt;)&lt;BR /&gt;(command "-LAYER" "R" (strcat(cdr (assoc 2 e))) newlay "")&lt;BR /&gt;(setq mycol (acad_colordlg (cdr (assoc 62 (tblsearch "layer" newlay))) ""))&lt;BR /&gt;(command "_.layer" "_color" mycol newlay "")&lt;BR /&gt;(setvar "clayer" newlay)&lt;BR /&gt;(princ)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;(princ)&lt;BR /&gt;)&lt;/P&gt;</description>
    <pubDate>Sat, 22 Sep 2018 09:26:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-09-22T09:26:38Z</dc:date>
    <item>
      <title>Creating new layer name &amp; assigning layer color autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/creating-new-layer-name-amp-assigning-layer-color-autolisp/m-p/8285734#M99225</link>
      <description>&lt;P&gt;Hi, I found an autolisp to rename &amp;amp; change layer color through googling. Though I understand how the autolisp work, I am still novice to modify it. The reason I want to modify the lisp is that, it cannot rename layer "0" &amp;amp; xref related layers. So instead of using rename, just want to make another new layer &amp;amp; transfer selected objects in that layer to the new&amp;nbsp; pre-defined layer. Any help &amp;amp; comments would be much appreciated. Thanks a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Autolisp Routine:&lt;BR /&gt;1. Select "pre-defined layer name" in the list.&lt;BR /&gt;2. Make this as "new layer name".&lt;/P&gt;&lt;P&gt;3. Select item/entity to change to the new added &lt;SPAN&gt;"pre-defined layer name"&lt;/SPAN&gt;. All same entities/same "old layer name" will transfer to the new added &lt;SPAN&gt;"pre-defined layer name"&lt;/SPAN&gt;.&lt;BR /&gt;3. Change layer color according to user choosen color.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please see below original autolisp:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun saveVars()&lt;BR /&gt;(setq ss(get_tile "mylayers1"))&lt;BR /&gt;(if(= ss "")&lt;BR /&gt;(setq newlay "Nothing is Selected")&lt;BR /&gt;(setq newlay (nth (atoi ss) mylayers1))&lt;BR /&gt;)&lt;BR /&gt;(princ)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun C:demo()&lt;/P&gt;&lt;P&gt;(setq mylayers1(list "a1" "a2" "a3" "a4" "b1" "b2" "b3" "b4" "c1" "c2" "c3" "c4" "x1" "x2" "x3" "x4" "y1" "y2" "y3" "y4" "z1" "z2" "z3" "z4" ))&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;(if(not(setq dcl_id (load_dialog "demo.dcl")))&lt;BR /&gt;(progn&lt;BR /&gt;(alert "The DCL file could not be loaded!")&lt;BR /&gt;(exit)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;(progn&lt;BR /&gt;(if (not(new_dialog "demo" dcl_id))&lt;BR /&gt;(progn&lt;BR /&gt;(alert "The demo.DCL file could not be loaded!")&lt;BR /&gt;(exit)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;(progn&lt;BR /&gt;(start_list "mylayers1" 3)&lt;BR /&gt;(mapcar 'add_list mylayers1)&lt;BR /&gt;(end_list)&lt;/P&gt;&lt;P&gt;(action_tile "accept" "(saveVars)(done_dialog 2)")&lt;BR /&gt;(action_tile "cancel" "(done_dialog 1)")&lt;/P&gt;&lt;P&gt;(setq ddiag(start_dialog))&lt;BR /&gt;(unload_dialog dcl_id)&lt;/P&gt;&lt;P&gt;(if(= ddiag 1)&lt;BR /&gt;(princ "\n Laye Rename cancelled!")&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;(if(= ddiag 2)&lt;BR /&gt;(progn&lt;BR /&gt;(princ "\n The user pressed Okay!")&lt;BR /&gt;&lt;BR /&gt;(if(and&lt;BR /&gt;(setq e (car (entsel "\nSelect ent⁪ity to rename: ")))&lt;BR /&gt;(setq e (tblsearch "layer" (cdr (assoc 8 (entget e)))))&lt;BR /&gt;)&lt;BR /&gt;(prompt(strcat"\nLayer: "(cdr (assoc 2 e))", Color: "(itoa (cdr (assoc 62 e)))))&lt;BR /&gt;)&lt;BR /&gt;(command "-LAYER" "R" (strcat(cdr (assoc 2 e))) newlay "")&lt;BR /&gt;(setq mycol (acad_colordlg (cdr (assoc 62 (tblsearch "layer" newlay))) ""))&lt;BR /&gt;(command "_.layer" "_color" mycol newlay "")&lt;BR /&gt;(setvar "clayer" newlay)&lt;BR /&gt;(princ)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;(princ)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Sat, 22 Sep 2018 09:26:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/creating-new-layer-name-amp-assigning-layer-color-autolisp/m-p/8285734#M99225</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-09-22T09:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new layer name &amp; assigning layer color autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/creating-new-layer-name-amp-assigning-layer-color-autolisp/m-p/8289164#M99226</link>
      <description>&lt;P&gt;You CANNOT rename layer "0" or xref dependant layers. Autocad won't let you, they are special layers.&lt;/P&gt;&lt;P&gt;&lt;A href="https://knowledge.autodesk.com/support/autocad/troubleshooting/caas/sfdcarticles/sfdcarticles/Unable-to-change-layer-name-in-AutoCAD.html" target="_blank"&gt;See link Here&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Sep 2018 19:41:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/creating-new-layer-name-amp-assigning-layer-color-autolisp/m-p/8289164#M99226</guid>
      <dc:creator>dlanorh</dc:creator>
      <dc:date>2018-09-24T19:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new layer name &amp; assigning layer color autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/creating-new-layer-name-amp-assigning-layer-color-autolisp/m-p/8289421#M99227</link>
      <description>&lt;P&gt;Try &lt;A href="https://www.kimprojects.com/new-layer-lisp/" target="_blank"&gt;this&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Sep 2018 21:17:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/creating-new-layer-name-amp-assigning-layer-color-autolisp/m-p/8289421#M99227</guid>
      <dc:creator>phanaem</dc:creator>
      <dc:date>2018-09-24T21:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new layer name &amp; assigning layer color autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/creating-new-layer-name-amp-assigning-layer-color-autolisp/m-p/8290483#M99228</link>
      <description>Hi dlanorth,&lt;BR /&gt;Thanks for that link..That's the reason why I need to modify the original lisp since it has limitation of renaming layer "0" or xref related layers. Some of my drawings are with layer "0" &amp;amp; xref related layers too. So instead of renaming, I wanted to make new layer, assign new layer name and color. But still new on autolisp..still figuring out how to do it.</description>
      <pubDate>Tue, 25 Sep 2018 10:30:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/creating-new-layer-name-amp-assigning-layer-color-autolisp/m-p/8290483#M99228</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-09-25T10:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new layer name &amp; assigning layer color autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/creating-new-layer-name-amp-assigning-layer-color-autolisp/m-p/8290505#M99229</link>
      <description>Hi phanaem,&lt;BR /&gt;Will try on this, thank you. But instead of typing pre-defined layers/new layer name, can you also teach me on how to call-out a dropdown list inside autolisp function? Thank you in advance.</description>
      <pubDate>Tue, 25 Sep 2018 10:59:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/creating-new-layer-name-amp-assigning-layer-color-autolisp/m-p/8290505#M99229</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-09-25T10:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new layer name &amp; assigning layer color autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/creating-new-layer-name-amp-assigning-layer-color-autolisp/m-p/8291054#M99230</link>
      <description>&lt;P&gt;hi phanaem,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the lisp, however, this is not what I wanted to do. What I wanted to do is to create/add new layer name (pre-defined layer name in dropdown list)&amp;amp; assign desired color from an existing old layer/original layer. Is it possible to just modify the original lisp? I can modify up to creating new layer name, but what I can't do is to transfer objects from old layer name to new layer name. Everytime I check on my new created layer, it is empty. Can you please teach me. Would appreciate your help.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 14:01:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/creating-new-layer-name-amp-assigning-layer-color-autolisp/m-p/8291054#M99230</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-09-25T14:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new layer name &amp; assigning layer color autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/creating-new-layer-name-amp-assigning-layer-color-autolisp/m-p/8291202#M99231</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, select the objects then start the command. Sorry, it's an old lisp.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or try the updated version, attached .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 14:45:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/creating-new-layer-name-amp-assigning-layer-color-autolisp/m-p/8291202#M99231</guid>
      <dc:creator>phanaem</dc:creator>
      <dc:date>2018-09-25T14:45:26Z</dc:date>
    </item>
  </channel>
</rss>

