<?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: Block layer fix for multiple blocks in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12530647#M18481</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6400150"&gt;@DC-MWA&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you very very much.&lt;/P&gt;
&lt;P&gt;I am burning through drawings lighting fast!!!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You're welcome!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jan 2024 01:07:47 GMT</pubDate>
    <dc:creator>ronjonp</dc:creator>
    <dc:date>2024-01-31T01:07:47Z</dc:date>
    <item>
      <title>Block layer fix for multiple blocks</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12527802#M18469</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have inherited a project and received cad files for the project. I need help fixing the block layers.&lt;/P&gt;&lt;P&gt;All the blocks are on layer 0, and each block has a layer inside the block.&lt;/P&gt;&lt;P&gt;I need to put the block on the layer inside the block, and set the block layer to 0.&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Example.&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Existing:&amp;nbsp;&lt;/STRONG&gt; Sink block on layer "&lt;STRONG&gt;0&lt;/STRONG&gt;" and geometry inside block is on layer "&lt;STRONG&gt;A-Appl&lt;/STRONG&gt;".&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Desired:&lt;/STRONG&gt; put Sink block on layer "&lt;STRONG&gt;A-Appl&lt;/STRONG&gt;" and geometry inside block to be on layer "&lt;STRONG&gt;0&lt;/STRONG&gt;".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are dozens of blocks that need to be corrected. I'm hoping to selected multiple blocks at once.&lt;/P&gt;&lt;P&gt;I'm hoping somebody has run into this before and has a solution.&lt;/P&gt;&lt;P&gt;Thanks in advance for your assistance.&lt;/P&gt;&lt;P&gt;-dc&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2024 23:16:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12527802#M18469</guid>
      <dc:creator>DC-MWA</dc:creator>
      <dc:date>2024-01-29T23:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: Block layer fix for multiple blocks</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12528827#M18471</link>
      <description>&lt;P&gt;hey there,&lt;/P&gt;&lt;P&gt;yet another one. no checks on layers' lock.&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="lisp"&gt;(defun c:change_layer_all_inserts ( / block_definition processed_list insert_layer block_name insert_dxf)
	(vlax-map-collection (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))
		'(lambda (insert)
			(if (and 
				 (= "AcDbBlockReference" (vla-get-objectname insert))
				 (zerop (vlax-get (setq block_definition (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) 
										   (vla-get-effectivename insert)
						 			)
						  ) 'isxref
					)
				 )
		      		(if (not (assoc (setq block_name (vla-get-name block_definition)) processed_list))
				  	(setq processed_list (append processed_list (list (cons (vla-get-name block_definition) (vla-get-layer (vla-item block_definition 0))))))
				  	(vla-put-layer insert (cdr (assoc block_name processed_list)))  
				) 
			)
				(progn
					(vlax-map-collection block_definition
						'(lambda (object)
							(progn
								(vla-put-layer object "0")
	;								(vla-put-color object 256)
							)
						 )
					)
				  	(vla-put-layer insert (cdr (assoc block_name processed_list)))  
				)
		    	)
		 )
	)
  	(vla-regen (vla-get-activedocument (vlax-get-acad-object)) acactiveviewport) 
  	(princ)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;updated_2&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 19:15:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12528827#M18471</guid>
      <dc:creator>komondormrex</dc:creator>
      <dc:date>2024-01-30T19:15:49Z</dc:date>
    </item>
    <item>
      <title>Re: Block layer fix for multiple blocks</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12528837#M18472</link>
      <description>&lt;P&gt;Try this, got from internet only.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 11:24:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12528837#M18472</guid>
      <dc:creator>smallƑish</dc:creator>
      <dc:date>2024-01-30T11:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: Block layer fix for multiple blocks</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12529507#M18473</link>
      <description>&lt;P&gt;I appreciate the replies. All of these only set the block layers to "0" which is half the battle.&lt;/P&gt;&lt;P&gt;I need to extract the layer inside the block put the block on that layer in addition to setting the layer inside the block to "0".&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 16:09:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12529507#M18473</guid>
      <dc:creator>DC-MWA</dc:creator>
      <dc:date>2024-01-30T16:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: Block layer fix for multiple blocks</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12529618#M18474</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6400150"&gt;@DC-MWA&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I appreciate the replies. All of these only set the block layers to "0" which is half the battle.&lt;/P&gt;
&lt;P&gt;I need to extract the layer inside the block put the block on that layer in addition to setting the layer inside the block to "0".&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you want to do the work... here is a lisp that is your requested process&amp;nbsp;&lt;A href="https://forums.augi.com/showthread.php?18929-Block-layer-Lisp-Finder&amp;amp;p=119922&amp;amp;viewfull=1#post119922" target="_blank"&gt;https://forums.augi.com/showthread.php?18929-Block-layer-Lisp-Finder&amp;amp;p=119922&amp;amp;viewfull=1#post119922&lt;/A&gt;&amp;nbsp;and you have the latter requested process above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 16:22:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12529618#M18474</guid>
      <dc:creator>pendean</dc:creator>
      <dc:date>2024-01-30T16:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: Block layer fix for multiple blocks</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12529644#M18475</link>
      <description>&lt;P&gt;Thank you. This does get the layer from the blocks selected. This is beyond my limited skill set.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Worse case I will get to work manually putting blocks on the appropriate layers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 16:29:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12529644#M18475</guid>
      <dc:creator>DC-MWA</dc:creator>
      <dc:date>2024-01-30T16:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: Block layer fix for multiple blocks</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12529916#M18476</link>
      <description>&lt;P&gt;sure, check update&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 18:23:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12529916#M18476</guid>
      <dc:creator>komondormrex</dc:creator>
      <dc:date>2024-01-30T18:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: Block layer fix for multiple blocks</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12530232#M18477</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6400150"&gt;@DC-MWA&lt;/a&gt;&amp;nbsp;Give this a shot:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(defun c:foo (/ blk lyr nm r)
  ;; RJP » 2024-01-30
  (vlax-for a (setq blk (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))))
    (if	(and (= 0 (vlax-get a 'islayout) (vlax-get a 'isxref)) (setq nm (vla-get-name a)))
      (vlax-for	b a
	(and nm (/= "0" (vla-get-layer b)) (setq r (cons (list nm (vla-get-layer b)) r)))
	(vl-catch-all-apply 'vla-put-layer (list b "0"))
	(setq nm nil)
      )
    )
  )
  (vlax-for a blk
    (if	(= -1 (vlax-get a 'islayout))
      (vlax-for	b a
	(and (= "AcDbBlockReference" (vla-get-objectname b))
	     (setq lyr (cadr (assoc (vla-get-effectivename b) r)))
	     (vl-catch-all-apply 'vla-put-layer (list b lyr))
	)
      )
    )
  )
  (princ)
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 21:21:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12530232#M18477</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2024-01-30T21:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: Block layer fix for multiple blocks</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12530290#M18478</link>
      <description>&lt;P&gt;This works. Is it possible to make it work on selected blocks only. Because if it does all the blocks, the blocks that are setup correctly end up on layer 0.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 20:56:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12530290#M18478</guid>
      <dc:creator>DC-MWA</dc:creator>
      <dc:date>2024-01-30T20:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: Block layer fix for multiple blocks</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12530334#M18479</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6400150"&gt;@DC-MWA&lt;/a&gt;&amp;nbsp;Try the code again .. I put an exception if the internal layer is already "0".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(and nm (/= "0" (vla-get-layer b)) (setq r (cons (list nm (vla-get-layer b)) r)))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 21:23:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12530334#M18479</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2024-01-30T21:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Block layer fix for multiple blocks</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12530448#M18480</link>
      <description>&lt;P&gt;Thank you very very much.&lt;/P&gt;&lt;P&gt;I am burning through drawings lighting fast!!!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 22:19:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12530448#M18480</guid>
      <dc:creator>DC-MWA</dc:creator>
      <dc:date>2024-01-30T22:19:48Z</dc:date>
    </item>
    <item>
      <title>Re: Block layer fix for multiple blocks</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12530647#M18481</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6400150"&gt;@DC-MWA&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you very very much.&lt;/P&gt;
&lt;P&gt;I am burning through drawings lighting fast!!!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You're welcome!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2024 01:07:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/12530647#M18481</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2024-01-31T01:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: Block layer fix for multiple blocks</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/13248509#M18482</link>
      <description>&lt;P&gt;can you please explain me how to use the written lisps/&amp;nbsp; i know how to load lisp files but dont know how to turn the written comand to a file and load&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 23:21:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/13248509#M18482</guid>
      <dc:creator>studiocz</dc:creator>
      <dc:date>2025-01-07T23:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: Block layer fix for multiple blocks</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/13251077#M18483</link>
      <description>&lt;P&gt;The program is ran by typing Foo on command line after loading. I would rename it to something else that matches the task. Blayfix ??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:foo (/ blk lyr nm r)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;The C: implies that what follows can be used as a command.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The second option is to add (c:foo) as the last line in the lisp this will run it after its loaded, if you want to run again just type FOO.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(princ)
)
(C:foo)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2025 02:44:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-layer-fix-for-multiple-blocks/m-p/13251077#M18483</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2025-01-09T02:44:50Z</dc:date>
    </item>
  </channel>
</rss>

