<?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: Moving blocks to different layers based on a list (csv) / with color change in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12221376#M24581</link>
    <description>&lt;P&gt;It works, perfect!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The only problem are the dynamic blocks, these are not moved.&lt;BR /&gt;As I read, you have to find out the "effectivename" first. Or is there another way to do this?&lt;/P&gt;</description>
    <pubDate>Wed, 06 Sep 2023 09:11:55 GMT</pubDate>
    <dc:creator>ingo360</dc:creator>
    <dc:date>2023-09-06T09:11:55Z</dc:date>
    <item>
      <title>Moving blocks to different layers based on a list (csv) / with color change</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12218514#M24572</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need a LISP where different blocks (normal and dynamic) are moved to different layers based on a list (csv file). It would also be nice to be able to change the color of individual blocks after or before they are moved to the other layer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"blockname1" should be moved to layer "layer1" and get the color "fromlayer"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;blockname1,layer1,color_fromlayer&lt;/LI&gt;&lt;LI&gt;blockname2,layer2,color_fromlayer&lt;/LI&gt;&lt;LI&gt;blockname3,layer1,color_2&lt;/LI&gt;&lt;LI&gt;blockname4,layer4&lt;/LI&gt;&lt;LI&gt;blockanme5,layer2&lt;/LI&gt;&lt;LI&gt;etc.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the drawings are more than 200 blocks from therefore I would like to do the assignment "block,layer,color" in a csv file.&amp;nbsp;If the color change is not possible, I would be satisfied with just moving the blocks.&lt;BR /&gt;&lt;BR /&gt;I am looking forward to your help!&lt;BR /&gt;Unfortunately I did not find anything in the forum.&lt;BR /&gt;&lt;BR /&gt;BR&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 09:35:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12218514#M24572</guid>
      <dc:creator>ingo360</dc:creator>
      <dc:date>2023-09-05T09:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: Moving blocks to different layers based on a list (csv) / with color change</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12218838#M24573</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12854935"&gt;@ingo360&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if you do that manually (changing the block layer) what is happend? does the color change?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Moshe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 11:54:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12218838#M24573</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2023-09-05T11:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: Moving blocks to different layers based on a list (csv) / with color change</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12218916#M24574</link>
      <description>&lt;P&gt;No, the blocks basically all have the color of the layer set.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 12:26:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12218916#M24574</guid>
      <dc:creator>ingo360</dc:creator>
      <dc:date>2023-09-05T12:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: Moving blocks to different layers based on a list (csv) / with color change</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12218978#M24575</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12854935"&gt;@ingo360&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so just to make it clear:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if i have a block originally build on 3 layers (LAYER1+&lt;FONT color="#FF0000"&gt;color1&lt;/FONT&gt;,LAYER2+&lt;FONT color="#FFCC00"&gt;color2&lt;/FONT&gt;,LAYER3+&lt;FONT color="#339966"&gt;color3&lt;/FONT&gt;) that is lay on LAYER4+&lt;FONT color="#00FFFF"&gt;color4&lt;/FONT&gt; and you change it to LAYER6+&lt;FONT color="#FF00FF"&gt;color6&lt;/FONT&gt; what are expecting to have?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Moshe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 12:50:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12218978#M24575</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2023-09-05T12:50:43Z</dc:date>
    </item>
    <item>
      <title>Re: Moving blocks to different layers based on a list (csv) / with color change</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12219149#M24576</link>
      <description>&lt;P&gt;I think I have expressed myself in an incomprehensible way.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;The actual state&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;layer1 (color &lt;FONT color="#FF0000"&gt;red&lt;/FONT&gt;) --&amp;gt; blocks on this layer got the same color (&lt;FONT color="#FF0000"&gt;red&lt;/FONT&gt;)&lt;/LI&gt;&lt;LI&gt;layer2 (color &lt;FONT color="#3366FF"&gt;blue&lt;/FONT&gt;) --&amp;gt; blocks on this layer got the same color (&lt;FONT color="#3366FF"&gt;blue&lt;/FONT&gt;)&lt;/LI&gt;&lt;LI&gt;layer3 (color &lt;FONT color="#339966"&gt;green&lt;/FONT&gt;) --&amp;gt; blocks on this layer got the same color (&lt;FONT color="#339966"&gt;green&lt;/FONT&gt;)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;BR /&gt;For example, I want to move a block from "&lt;FONT color="#FF0000"&gt;Layer1&lt;/FONT&gt;" to "&lt;FONT color="#3366FF"&gt;Layer2&lt;/FONT&gt;", but I don't want this block to get the color of the layer but another color.&lt;/P&gt;&lt;P&gt;As I mentioned before, if the color matching issue gets too complicated, simply moving the blocks to the layers would be enough for me.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 13:44:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12219149#M24576</guid>
      <dc:creator>ingo360</dc:creator>
      <dc:date>2023-09-05T13:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: Moving blocks to different layers based on a list (csv) / with color change</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12219228#M24577</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12854935"&gt;@ingo360&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i asked you this:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"if you do that manually (changing the block layer) what is happend? does the color change?"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;you said NO!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;so if you change the block layer and it does not get the new color then how could you tell a change made?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;i'll tell how autocad behave with blocks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;it depend on the layer's of the entities involve.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if an entity lay's on none '0' zero layer (any other layer name but not '0' zero) at insert it stick with that layer no matter what.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;if an entity lay's on '0' zero layer, at insert it inherit the current layer properties...color, ltype, width (and all other layer properties). now base on this state test one of your blocks that does not change color to understand why?!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;attached sample1.dwg inside a test block to illustrate you how block works - just change the block to LAYER6 and tell me what were your expectaions and what actually happend?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Moshe&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;</description>
      <pubDate>Tue, 05 Sep 2023 14:16:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12219228#M24577</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2023-09-05T14:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: Moving blocks to different layers based on a list (csv) / with color change</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12219355#M24578</link>
      <description>&lt;P&gt;In the attachment you find a file how it works with me.&lt;BR /&gt;Inside the block everything is on layer 0. If I move the block to another layer the color changes.&lt;/P&gt;&lt;P&gt;Next to it you will find the block on the same layer with a different color. This is what I want to achieve.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry, it's hard to explain.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 14:57:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12219355#M24578</guid>
      <dc:creator>ingo360</dc:creator>
      <dc:date>2023-09-05T14:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Moving blocks to different layers based on a list (csv) / with color change</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12219560#M24579</link>
      <description>&lt;P&gt;Based on your original example of .csv file lines, some with color entries and some without, perhaps something like this [&lt;EM&gt;pieces&lt;/EM&gt; tested, but use real drawing and .csv file and filepath to really test]:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(defun C:BLT &lt;FONT color="#99CCFF"&gt;; = Block Layer Transfer&lt;/FONT&gt;&lt;BR /&gt;&amp;nbsp; (/ beforecomma aftercomma file txt ss)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (defun beforecomma (str)&amp;nbsp;(substr str 1 (vl-string-position 44 str)))&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (defun aftercomma (str)&amp;nbsp;(substr str (+ (vl-string-position 44 str) 2)))&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (setq file (open "&lt;FONT color="#33CCCC"&gt;&lt;EM&gt;X:/Your/File/Path/YourFileName&lt;/EM&gt;&lt;/FONT&gt;.csv" "r")&lt;BR /&gt;&amp;nbsp; (while&amp;nbsp;(setq txt (read-line file))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; (if (setq ss (ssget "_X" (list '(0 . "INSERT") (cons 2 (beforecomma txt)))))&lt;FONT color="#99CCFF"&gt;; any Blocks by that name?&lt;/FONT&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; (command "_.chprop" ss "" &lt;FONT color="#99CCFF"&gt;; then&lt;/FONT&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "_layer" (beforecomma (setq txt (aftercomma txt)))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "_color" (if (wcmatch txt "*`,*") (aftercomma txt) "")&lt;FONT size="3" color="#99CCFF"&gt;; accept current if no color entry in txt&lt;/FONT&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ""&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;FONT color="#99CCFF"&gt;; command&lt;/FONT&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; )&lt;FONT color="#99CCFF"&gt;; if&lt;/FONT&gt;&lt;BR /&gt;&amp;nbsp; )&lt;FONT color="#99CCFF"&gt;; while&lt;/FONT&gt;&lt;BR /&gt;&amp;nbsp; (close file)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (prin1)&lt;BR /&gt;)&lt;FONT color="#99CCFF"&gt;; defun&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;BUT&lt;/STRONG&gt;&lt;/FONT&gt; it needs your end-of-line color thing [where present] to be "ByLayer" [not case-sensitive] when that's what you want, and just a color number [or name] when applicable, so it can just use those.&amp;nbsp; That is:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;blockname2,layer2,bylayer&lt;/LI&gt;
&lt;LI&gt;blockname3,layer1,2&lt;/LI&gt;
&lt;LI&gt;blockname45,layer27,green&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;If you &lt;EM&gt;really&lt;/EM&gt; want the "&lt;FONT color="#000000"&gt;color_&lt;/FONT&gt;" part kept in there, it &lt;EM&gt;could&lt;/EM&gt; be accommodated, but it seems more complicated than necessary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;EDIT:&lt;/STRONG&gt;&amp;nbsp; And it assumes the Blocks involved are &lt;EM&gt;not dynamic&lt;/EM&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 18:02:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12219560#M24579</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-09-05T18:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: Moving blocks to different layers based on a list (csv) / with color change</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12219623#M24580</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12854935"&gt;@ingo360&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ok got you, here you go&lt;/P&gt;&lt;P&gt;the blk2lay.csv is sample data file. you need to create your&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Moshe&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;LI-CODE lang="general"&gt;(vl-load-com)

(defun c:blk2lay (/ LM:str-&amp;gt;lst ; local function
		   fname f rec data dataList ss)

;; String to List  -  Lee Mac
;; Separates a string using a given delimiter
;; str - [str] String to process
;; del - [str] Delimiter by which to separate the string
;; Returns: [lst] List of strings
 
 (defun LM:str-&amp;gt;lst ( str del / pos )
    (if (setq pos (vl-string-search del str))
        (cons (substr str 1 pos) (LM:str-&amp;gt;lst (substr str (+ pos 1 (strlen del))) del))
        (list str)
    )
 ); LM:str-&amp;gt;lst


 ; here start c:cdepth
 (setvar "cmdecho" 0)
 (command "._undo" "_begin")
  
 (if (and
       (setq fname (getfiled "Select csv data file" "" "csv" 8))
       (setq f (open fname "r"))
     )
  (progn
   (setq dataList nil) 
   (while (setq rec (read-line f))
    (setq dataList (cons (LM:str-&amp;gt;lst rec ",") dataList))
   ); while

   (setq f (close f)) ; close file
   
   (foreach data (reverse dataList)
    (if (and
	  (&amp;gt;= (vl-list-length data) 2)
	  (setq ss (ssget "_x" (list '(0 . "insert") (cons '2 (car data)))))
	)
     (if (not (caddr data))
      (command "._layer" "_make" (cadr data) "" "._chprop" "_si" ss "_layer" (cadr data) "")
      (command "._layer" "_make" (cadr data) "" "._chprop" "_si" ss "_layer" (cadr data) "_color" (caddr data) "")
     ); if
    ); if
   ); foreach
   
  ); progn
 ); if

 (command "._undo" "_end")
 (setvar "cmdecho" 1)

 (princ)
); blk2lay
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 17:13:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12219623#M24580</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2023-09-05T17:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: Moving blocks to different layers based on a list (csv) / with color change</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12221376#M24581</link>
      <description>&lt;P&gt;It works, perfect!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The only problem are the dynamic blocks, these are not moved.&lt;BR /&gt;As I read, you have to find out the "effectivename" first. Or is there another way to do this?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 09:11:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12221376#M24581</guid>
      <dc:creator>ingo360</dc:creator>
      <dc:date>2023-09-06T09:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: Moving blocks to different layers based on a list (csv) / with color change</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12221397#M24582</link>
      <description>&lt;P&gt;Of course, "Kent1Cooper"`s solution with the preset path is even nicer.&lt;BR /&gt;That saves me the search for the file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(setq file (open "&lt;/SPAN&gt;&lt;FONT color="#33CCCC"&gt;&lt;EM&gt;X:/Your/File/Path/YourFileName&lt;/EM&gt;&lt;/FONT&gt;&lt;SPAN&gt;.csv" "r")&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 09:19:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12221397#M24582</guid>
      <dc:creator>ingo360</dc:creator>
      <dc:date>2023-09-06T09:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: Moving blocks to different layers based on a list (csv) / with color change</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12222623#M24583</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12854935"&gt;@ingo360&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Of course, "Kent1Cooper"`s solution with the preset path is even nicer.&amp;nbsp; That saves me the search for the file. ....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;... provided, of course, that it's always the same file name in the same location.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[Did the rest of my suggestion work for you under real conditions?]&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 17:16:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12222623#M24583</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-09-06T17:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: Moving blocks to different layers based on a list (csv) / with color change</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12222894#M24584</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12854935"&gt;@ingo360&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;now, support dynamic blocks&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":rolling_on_the_floor_laughing:"&gt;🤣&lt;/span&gt;&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;;;; move block to layer

(vl-load-com)

(defun c:blk2lay (/ LM:str-&amp;gt;lst ; local function
		   fname f rec data dataList ss)

;; String to List  -  Lee Mac
;; Separates a string using a given delimiter
;; str - [str] String to process
;; del - [str] Delimiter by which to separate the string
;; Returns: [lst] List of strings
 
 (defun LM:str-&amp;gt;lst ( str del / pos )
    (if (setq pos (vl-string-search del str))
        (cons (substr str 1 pos) (LM:str-&amp;gt;lst (substr str (+ pos 1 (strlen del))) del))
        (list str)
    )
 ); LM:str-&amp;gt;lst


 ; here start c:cdepth
 (setvar "cmdecho" 0)
 (command "._undo" "_begin")
  
 (if (and
       (setq fname (getfiled "Select csv data file" "" "csv" 8))
       (setq f (open fname "r"))
     )
  (progn
   (setq dataList nil) 
   (while (setq rec (read-line f))
    (setq dataList (cons (LM:str-&amp;gt;lst rec ",") dataList))
   ); while

   (setq f (close f)) ; close file
   
   (foreach data (reverse dataList)
    (if (and
	  (&amp;gt;= (vl-list-length data) 2)
	  (setq ss (ssget "_x" (list '(0 . "insert") (cons '2 (strcat (car data) ",`*U*")))))
	)
     (foreach ename (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
      (if (eq (strcase (vla-get-effectivename (vlax-ename-&amp;gt;vla-object ename))) (strcase (car data)))
       (if (not (caddr data))
        (command "._layer" "_make" (cadr data) "" "._chprop" "_si" ename "_layer" (cadr data) "")
        (command "._layer" "_make" (cadr data) "" "._chprop" "_si" ename "_layer" (cadr data) "_color" (caddr data) "")
       ); if
      ); if
     ); foreach
    ); if
   ); foreach
   
  ); progn
 ); if

 (command "._undo" "_end")
 (setvar "cmdecho" 1)

 (princ)
); blk2lay
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 19:17:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12222894#M24584</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2023-09-06T19:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: Moving blocks to different layers based on a list (csv) / with color change</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12225642#M24585</link>
      <description>&lt;P&gt;&lt;FONT face="arial black,avant garde"&gt;**** good job!&lt;/FONT&gt;&lt;BR /&gt;It works.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":hugging_face:"&gt;🤗&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;So that it does not get boring:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Is it also possible to integrate a color book, because I have a self-created colors&lt;/LI&gt;&lt;LI&gt;The variant with the default file path would still be nice&amp;nbsp;&lt;SPAN&gt;(setq file (open "&lt;/SPAN&gt;&lt;FONT color="#33CCCC"&gt;&lt;EM&gt;X:/Your/File/Path/YourFileName&lt;/EM&gt;&lt;/FONT&gt;&lt;SPAN&gt;.csv" "r")&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Thu, 07 Sep 2023 19:25:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/moving-blocks-to-different-layers-based-on-a-list-csv-with-color/m-p/12225642#M24585</guid>
      <dc:creator>ingo360</dc:creator>
      <dc:date>2023-09-07T19:25:30Z</dc:date>
    </item>
  </channel>
</rss>

