<?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: Modify Existing Layer Linetype &amp;amp; Lineweight in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-existing-layer-linetype-amp-lineweight/m-p/13290316#M3718</link>
    <description>&lt;P&gt;OK, some success with the following:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;;Renames layers according to RLN.TBL
;
;(^v^) CAD Studio, 1998
;updated 6-98: optional new colors
;
(defun C:RNL ( / cmde tbf tbl lin lis)
 (setq cmde (getvar "CMDECHO"))
 (setvar "CMDECHO" 0)
 (setq tbf (findfile "RNL.TBL"))
 (if tbf	;1
  (progn
   (princ "Renaming from table RNL.TBL ...")
   (setq tbl (open tbf "r"))
   (while (setq lin (read-line tbl))
    (if (/= ";" (substr lin 1 1))	;2
     (progn
      (setq lis (read (strcat "(" lin ")"))) ; (OLD NEW) or (OLD NEW NEWCOLOR)
      (if (tblsearch "LAYER" (nth 0 lis))	;3
       (if (tblsearch "LAYER" (nth 1 lis))	;4
        (princ (strcat "\nCannot rename " (nth 0 lis) " to " (nth 1 lis) " - already exists"))
        (progn
         (princ (strcat "\n" (nth 0 lis) "-&amp;gt;" (nth 1 lis)))
         (command "_RENAME" "_LA" (nth 0 lis) (nth 1 lis))
         (if (nth 2 lis) (command "_LAYER" "_CO" (nth 2 lis) (nth 1 lis) ""))		;5
		  (if (nth 3 lis) (command "_LAYER" "_ltype" (nth 3 lis) (nth 1 lis) ""))	;6
		   (if (nth 4 lis) (command "_LAYER" "_lw" (nth 4 lis) (nth 1 lis) ""))		;7
		  );if7
		 );if6
		);if5
       );if4
     );if3
    ));if2
   );while
   (princ "\nDone.")
  );else
  (prompt "Table RNL.TBL not found!")
 );if1
 (setvar "CMDECHO" cmde)
 (princ)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This actually works, however there is a bad argument error on line 18 (screen grab below):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="RNLT Bad Argument Error.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1460932iC09DFB10BFAAB52E/image-size/large?v=v2&amp;amp;px=999" role="button" title="RNLT Bad Argument Error.png" alt="RNLT Bad Argument Error.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Having searched on this sort of error, there a suggestion that I should be using 'cond' instead of 'if'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any comments gratefully received.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jan 2025 11:10:08 GMT</pubDate>
    <dc:creator>arkelec</dc:creator>
    <dc:date>2025-01-30T11:10:08Z</dc:date>
    <item>
      <title>Modify Existing Layer Linetype &amp; Lineweight</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-existing-layer-linetype-amp-lineweight/m-p/13288475#M3711</link>
      <description>&lt;P&gt;I have to clean up around 100 existing drawings &amp;amp; I want to do the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Convert existing Layer names to new ones.&lt;/LI&gt;&lt;LI&gt;Change existing layer colours to new ones.&lt;/LI&gt;&lt;LI&gt;Set all linetypes to "continuous".&lt;/LI&gt;&lt;LI&gt;Set all lineweights to "default".&lt;/LI&gt;&lt;LI&gt;Ensure all content on designated layers is "By Layer" for colour, linetype &amp;amp; lineweight.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found some code (attached) to change existing Layer Name &amp;amp; Colour (1 &amp;amp; 2 in the above list), but it doesn't include the change to the linetype &amp;amp; lineweight.&amp;nbsp; I'm assuming the the code can be modified to do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm really not strong on LISP, I can't even find the correct syntax for Linetype &amp;amp; Lineweight (as in, the equivalent for Colour, that being &amp;lt; command "_LAYER" "&lt;STRONG&gt;_CO&lt;/STRONG&gt;" &amp;gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If someone could point me in the right direction as to where I might find the library resources to access the functions (3 &amp;amp; 4 in the above list), I'd be grateful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There's also the solution to item 5 in the list above, but first things first.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2025 15:20:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-existing-layer-linetype-amp-lineweight/m-p/13288475#M3711</guid>
      <dc:creator>arkelec</dc:creator>
      <dc:date>2025-01-29T15:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Existing Layer Linetype &amp; Lineweight</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-existing-layer-linetype-amp-lineweight/m-p/13288582#M3712</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in your case (change ALL layers&lt;/P&gt;&lt;P&gt;and (change ALL objects (unnested/not part of a block)&lt;/P&gt;&lt;P&gt;You can easily use the CHANGE or CHPROP command&lt;/P&gt;&lt;P&gt;similiar to use it in commandline&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;run your RNL for rename and color&lt;/P&gt;&lt;P&gt;and these line for all other changes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(command "_.-LAYER" "_lw" "_default" "*" "_ltype" "Continuous" "*" "")&lt;/P&gt;&lt;P&gt;make sure you are in the space you want to edit objects, like MODEL for example&lt;/P&gt;&lt;P&gt;(command "_.CHPROP" "_all" "" "_co" "ByLayer" "_ltype" "ByLayer" "_lw" "ByLayer" "")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2025 16:05:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-existing-layer-linetype-amp-lineweight/m-p/13288582#M3712</guid>
      <dc:creator>cadffm</dc:creator>
      <dc:date>2025-01-29T16:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Existing Layer Linetype &amp; Lineweight</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-existing-layer-linetype-amp-lineweight/m-p/13288639#M3713</link>
      <description>&lt;P&gt;Great &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/71745"&gt;@cadffm&lt;/a&gt;, thanks for that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A couple of questions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The '&lt;SPAN&gt;_.-LAYER' &amp;amp;&lt;/SPAN&gt;&amp;nbsp;'_lw' variables, where would I be able to read up on them &amp;amp; their use?&amp;nbsp; I searched the in the AutoLISP section but nothing specific is returned.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, there will be some existing layers to which I won't actually want to be affected by the linetype change.&amp;nbsp; Is it possible to apply the change only to the layers listed in the .TBL file?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2025 16:33:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-existing-layer-linetype-amp-lineweight/m-p/13288639#M3713</guid>
      <dc:creator>arkelec</dc:creator>
      <dc:date>2025-01-29T16:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Existing Layer Linetype &amp; Lineweight</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-existing-layer-linetype-amp-lineweight/m-p/13288663#M3714</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. I don't like to comment the .lsp/.tbl file,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;wait for some others.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. You can't read about it in Lisp documentation, because all three are normal commands!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(Command....) is Lisp, what will send the content to your commandline,&lt;/P&gt;&lt;P&gt;as you can do the same by hand.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Type in:&lt;/P&gt;&lt;P&gt;-LAYER&amp;lt;enterhit&amp;gt;&lt;/P&gt;&lt;P&gt;[F1]&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2025 16:46:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-existing-layer-linetype-amp-lineweight/m-p/13288663#M3714</guid>
      <dc:creator>cadffm</dc:creator>
      <dc:date>2025-01-29T16:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Existing Layer Linetype &amp; Lineweight</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-existing-layer-linetype-amp-lineweight/m-p/13288664#M3715</link>
      <description>&lt;P&gt;How’s about AutoCADs Setbylayermode and Setbylayer command&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(command "setbylayer" "all" "" "y" "y")&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 29 Jan 2025 16:47:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-existing-layer-linetype-amp-lineweight/m-p/13288664#M3715</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2025-01-29T16:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Existing Layer Linetype &amp; Lineweight</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-existing-layer-linetype-amp-lineweight/m-p/13288841#M3716</link>
      <description>&lt;P&gt;You can give this a try.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It will change your layers names to your table, set all Colors to Bylayer and set one of them to color 3 per your table and change all Linetypes to Bylayer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just load and type RNL as you had before.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this works for you.&lt;/P&gt;&lt;P&gt;Thanks, JRR!&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2025 18:18:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-existing-layer-linetype-amp-lineweight/m-p/13288841#M3716</guid>
      <dc:creator>jreidKVSUZ</dc:creator>
      <dc:date>2025-01-29T18:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Existing Layer Linetype &amp; Lineweight</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-existing-layer-linetype-amp-lineweight/m-p/13290134#M3717</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/71745"&gt;@cadffm&lt;/a&gt;.&amp;nbsp; I get the &lt;SPAN&gt;-LAYER &lt;/SPAN&gt;structure now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1137264"&gt;@paullimapa&lt;/a&gt;&amp;nbsp;- I think I understand what that does, buy I'm not sure how it does what it does &amp;amp; how that fits my goal (given my post after yours &amp;amp; this one).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14775931"&gt;@jreidKVSUZ&lt;/a&gt;&amp;nbsp;- Thanks, I tried it but it didn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I've understood the original code properly (shown below), Line 17 sets up the reading of the list (the external file), the 'car', 'cadr' &amp;amp; 'caddr' locate the 1st, 2nd &amp;amp; 3rd elements of the list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ideally, I'd like to add a 4th &amp;amp; 5th element, being Linetype &amp;amp; Lineweight, and then add the necessary lines of code to effect the change, using the 'nth' function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I don't know is if I could/should retain the 'cad, cadr, caddr' functions &amp;amp; add the 'nth' in, or restructure that whole part just using 'nth'.&lt;/P&gt;&lt;P&gt;Nor do I know how to access the&amp;nbsp;Linetype &amp;amp; Lineweight elements.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm going to have a stab at modifying the code to try the above, using the info&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/71745"&gt;@cadffm&lt;/a&gt;&amp;nbsp;gave in his posts, but formatting it in a similar structure to the original code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;;Renames layers according to RNL.TBL
;
;(^v^) CAD Studio, 1998
;updated 6-98: optional new colors
;
(defun C:RNL ( / cmde tbf tbl lin lis)
 (setq cmde (getvar "CMDECHO"))
 (setvar "CMDECHO" 0)
 (setq tbf (findfile "RNL.TBL"))
 (if tbf
  (progn
   (princ "Renaming from table RNL.TBL ...")
   (setq tbl (open tbf "r"))
   (while (setq lin (read-line tbl))
    (if (/= ";" (substr lin 1 1))
     (progn
      (setq lis (read (strcat "(" lin ")"))) ; (OLD NEW) or (OLD NEW NEWCOLOR)
      (if (tblsearch "LAYER" (car lis))
       (if (tblsearch "LAYER" (cadr lis))
        (princ (strcat "\nCannot rename " (car lis) " to " (cadr lis) " - already exists"))
        (progn
         (princ (strcat "\n" (car lis) "-&amp;gt;" (cadr lis)))
         (command "_RENAME" "_LA" (car lis) (cadr lis))
         (if (caddr lis) (command "_LAYER" "_CO" (caddr lis) (cadr lis) ""))
        )
       );if
     );if
    ));if
   );while
   (princ "\nDone.")
  );else
  (prompt "Table RNL.TBL not found!")
 );if
 (setvar "CMDECHO" cmde)
 (princ)
)

(princ "\nRNL - tabular layer renaming,  (^v^) CAD Studio, http://www.cadstudio.cz")
(princ)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2025 09:32:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-existing-layer-linetype-amp-lineweight/m-p/13290134#M3717</guid>
      <dc:creator>arkelec</dc:creator>
      <dc:date>2025-01-30T09:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Existing Layer Linetype &amp; Lineweight</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-existing-layer-linetype-amp-lineweight/m-p/13290316#M3718</link>
      <description>&lt;P&gt;OK, some success with the following:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;;Renames layers according to RLN.TBL
;
;(^v^) CAD Studio, 1998
;updated 6-98: optional new colors
;
(defun C:RNL ( / cmde tbf tbl lin lis)
 (setq cmde (getvar "CMDECHO"))
 (setvar "CMDECHO" 0)
 (setq tbf (findfile "RNL.TBL"))
 (if tbf	;1
  (progn
   (princ "Renaming from table RNL.TBL ...")
   (setq tbl (open tbf "r"))
   (while (setq lin (read-line tbl))
    (if (/= ";" (substr lin 1 1))	;2
     (progn
      (setq lis (read (strcat "(" lin ")"))) ; (OLD NEW) or (OLD NEW NEWCOLOR)
      (if (tblsearch "LAYER" (nth 0 lis))	;3
       (if (tblsearch "LAYER" (nth 1 lis))	;4
        (princ (strcat "\nCannot rename " (nth 0 lis) " to " (nth 1 lis) " - already exists"))
        (progn
         (princ (strcat "\n" (nth 0 lis) "-&amp;gt;" (nth 1 lis)))
         (command "_RENAME" "_LA" (nth 0 lis) (nth 1 lis))
         (if (nth 2 lis) (command "_LAYER" "_CO" (nth 2 lis) (nth 1 lis) ""))		;5
		  (if (nth 3 lis) (command "_LAYER" "_ltype" (nth 3 lis) (nth 1 lis) ""))	;6
		   (if (nth 4 lis) (command "_LAYER" "_lw" (nth 4 lis) (nth 1 lis) ""))		;7
		  );if7
		 );if6
		);if5
       );if4
     );if3
    ));if2
   );while
   (princ "\nDone.")
  );else
  (prompt "Table RNL.TBL not found!")
 );if1
 (setvar "CMDECHO" cmde)
 (princ)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This actually works, however there is a bad argument error on line 18 (screen grab below):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="RNLT Bad Argument Error.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1460932iC09DFB10BFAAB52E/image-size/large?v=v2&amp;amp;px=999" role="button" title="RNLT Bad Argument Error.png" alt="RNLT Bad Argument Error.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Having searched on this sort of error, there a suggestion that I should be using 'cond' instead of 'if'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any comments gratefully received.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2025 11:10:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-existing-layer-linetype-amp-lineweight/m-p/13290316#M3718</guid>
      <dc:creator>arkelec</dc:creator>
      <dc:date>2025-01-30T11:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Existing Layer Linetype &amp; Lineweight</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-existing-layer-linetype-amp-lineweight/m-p/13294016#M3719</link>
      <description>&lt;P&gt;This is just the way I would start to approach this task. you can look at the length of each sub item in the laylst is it 1 2 3 4 etc so then with a cond call the correct change layer. One thing I did do to make life easier is removed the quotes as accept that the text is all strings, I would use a comma as Seperator then can change layer names that have a space in them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:chklay ( / lay lst laylst dummy lin)

(defun dolay2 ( / )
 (if (tblsearch "LAYER" (nth 0 lay))
  (command "-layer" "rename" (nth 0 lay) (nth 1 lay))
 )
)
(defun dolay3 ( / )
 (if (tblsearch "LAYER" (nth 0 lay))
  (command "-layer" "rename" (nth 0 lay) (nth 1 lay) "c" (atoi (nth 2 lay)) (nth 1 lay)  "")
 )
)
(defun dolay4 ( / )
 (if (tblsearch "LAYER" (nth 0 lay))
  (command "-layer" "rename" (nth 0 lay) (nth 1 lay) "c" (atoi (nth 2 lay)) (nth 1 lay) "LT" (nth 3 lnr) (nth 1 lay) "")
 )
)

; tab 9 space 32 (chr 32) comma 44 semicolum 59 slash / 47
; thanks to Lee-mac for this defun
(defun csv-&amp;gt;lst ( str / pos )
(if (setq pos (vl-string-position 32 str))
    (cons (substr str 1 pos) (csv-&amp;gt;lst (substr str (+ pos 2))))
    (list str)
    )
)

(setq laylst '())
(setq tbl (open tbf "r"))
(setq dummy (read-line tbl))
(setq dummy (read-line tbl))
(while (setq lin (read-line tbl))
  (setq lst (csv-&amp;gt;lst lin))
  (setq laylst (cons lst laylst))
)
(close tbl)


(foreach lay laylst
(cond
  ((= (length lay) 2)(dolay2))
  ((= (length lay) 3)(dolay3))
  ((= (length lay) 4)(dolay4))
)
)

(princ)
) ; chklay&lt;/LI-CODE&gt;&lt;LI-CODE lang="general"&gt;;List of renamed layers for RNL.LSP
;format: ORIGINALNAME NEWNAME newcolor
YYY BBB
CCC DDD
AAA XXX 3
EEE FFF 4 DASHED&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 01 Feb 2025 00:33:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-existing-layer-linetype-amp-lineweight/m-p/13294016#M3719</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2025-02-01T00:33:46Z</dc:date>
    </item>
  </channel>
</rss>

