<?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: Redefine only blocks with a prefix name and synchronise attributes in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13050934#M15264</link>
    <description>&lt;P&gt;Is it possible to add more block starting name? for example &lt;EM&gt;&lt;STRONG&gt;"TM*"&lt;/STRONG&gt;&amp;nbsp;,&amp;nbsp;&lt;STRONG&gt;"KG*"&lt;/STRONG&gt;&amp;nbsp;,&amp;nbsp;&lt;STRONG&gt;"AM*"&lt;/STRONG&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 27 Sep 2024 21:09:30 GMT</pubDate>
    <dc:creator>francine.zimmermannSRSWJ</dc:creator>
    <dc:date>2024-09-27T21:09:30Z</dc:date>
    <item>
      <title>Redefine only blocks with a prefix name and synchronise attributes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/12710259#M15262</link>
      <description>&lt;P&gt;I have a lisp written by Lee Mac which works very well.&lt;/P&gt;&lt;P&gt;My only problem is that when I have hundred of blocks on my drawing the lisp takes a very long time to run.&lt;/P&gt;&lt;P&gt;Is it possible to redefine only the blocks starting with the block name&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;TM&lt;/STRONG&gt;.....?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;example of block name : TM-1005, TM-0349, TM-1006........&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 19:30:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/12710259#M15262</guid>
      <dc:creator>francine.zimmermannSRSWJ</dc:creator>
      <dc:date>2024-04-15T19:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: Redefine only blocks with a prefix name and synchronise attributes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/12710572#M15263</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11263383"&gt;@francine.zimmermannSRSWJ&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(and
  (= :vlax-false (vla-get-isxref blk))
  (= :vlax-false (vla-get-islayout blk))
  (not (wcmatch (setq bln (vla-get-name blk)) "`**,*|*"))
  ;; Add this line
  (wcmatch bln "TM*")
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 22:16:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/12710572#M15263</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2024-09-27T22:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: Redefine only blocks with a prefix name and synchronise attributes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13050934#M15264</link>
      <description>&lt;P&gt;Is it possible to add more block starting name? for example &lt;EM&gt;&lt;STRONG&gt;"TM*"&lt;/STRONG&gt;&amp;nbsp;,&amp;nbsp;&lt;STRONG&gt;"KG*"&lt;/STRONG&gt;&amp;nbsp;,&amp;nbsp;&lt;STRONG&gt;"AM*"&lt;/STRONG&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 21:09:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13050934#M15264</guid>
      <dc:creator>francine.zimmermannSRSWJ</dc:creator>
      <dc:date>2024-09-27T21:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: Redefine only blocks with a prefix name and synchronise attributes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13051019#M15265</link>
      <description>&lt;P&gt;Yes. Separate the patterns with commas like so:&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;(wcmatch bln "TM*,KG*,AM*")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 22:16:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13051019#M15265</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2024-09-27T22:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Redefine only blocks with a prefix name and synchronise attributes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13051607#M15266</link>
      <description>&lt;P&gt;Thank you , it works well.&lt;/P&gt;&lt;P&gt;I have an other lisp to redefine multiple block from a list of different directories.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;(setq G:LISTDIR (list "C:\\000_Block\\Block" &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;"C:\\000_Block\\Profile" &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Is it also possible, on that lisp, to redefine&amp;nbsp;&lt;SPAN&gt;only blocks with a defined prefix name&amp;nbsp;?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I don't know where or how to integrate the command line solution &lt;EM&gt;(wvmatch bln "TM*, KG*")&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Sep 2024 09:47:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13051607#M15266</guid>
      <dc:creator>francine.zimmermannSRSWJ</dc:creator>
      <dc:date>2024-09-28T09:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: Redefine only blocks with a prefix name and synchronise attributes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13051997#M15267</link>
      <description>&lt;P&gt;check this mod. did not check thou.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun C:REDEF-P( / BLK BLT LAUF N WAH )
	(setq G:LISTDIR (list "C:\\000_Block\\Block" 
			      "C:\\000_Block\\Profile" 
			)
	)
	(if G:LISTDIR
		(progn
			(princ "\n\nDirectory list\n")
 			(foreach N G:LISTDIR 
				(princ (strcat "\n" N))
			)
			(princ "\n***********************\n")
	  		(setvar "cmdecho" 0)
			(setvar "regenmode" 0) 
	  		(setq BLK nil
	        		LAUF 0
	  		)
	  		(while (setq BLT (tblnext "BLOCK" (= LAUF 0)))
	         	        (setq LAUF 1)
	         	        (setq BLK (cdr (assoc 2 BLT)) )
			        (setq L:FLAGINSERT nil)
				(if (and (/= "*" (substr BLK 1 1))
					 (wcmatch BLK "TM*,KG*")
				    )
					(progn
	  					(foreach N G:LISTDIR 
								(progn
	 								(setq L:FILE (strcat N "\\" BLK ".DWG"))
									(if (and (findfile L:FILE) (not L:FLAGINSERT))
										(progn
				 							(command "._INSERT" (strcat BLK "=" L:FILE) "0.0,0.0,0.0" "" "" "")
											(command "._erase" "l" "")
											(setq L:FLAGINSERT T)
											(princ (strcat "\n" L:FILE " reinserted"))
				 						)
;;;				 						(progn
						;					(princ (strcat L:FILE " not found\n"))
;;;				 						)
									)
								)
	  					)
						(if (not L:FLAGINSERT )
							(princ (strcat "\nBlock " BLK " unchanged"))
						)
					)
				)
			)
	  		(setvar "cmdecho" 1)
			(setvar "regenmode" 1) 
			(princ "\n")
 			(command "regen")
		)
	)
 	(princ)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Sep 2024 06:01:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13051997#M15267</guid>
      <dc:creator>komondormrex</dc:creator>
      <dc:date>2024-09-29T06:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: Redefine only blocks with a prefix name and synchronise attributes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13052037#M15268</link>
      <description>&lt;P&gt;I test it and I get that answer:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="francinezimmermannSRSWJ_0-1727548251315.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1415548i9E15A46EC5FBA1DB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="francinezimmermannSRSWJ_0-1727548251315.png" alt="francinezimmermannSRSWJ_0-1727548251315.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Sep 2024 18:31:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13052037#M15268</guid>
      <dc:creator>francine.zimmermannSRSWJ</dc:creator>
      <dc:date>2024-09-28T18:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Redefine only blocks with a prefix name and synchronise attributes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13052070#M15269</link>
      <description>&lt;P&gt;I found the error , you have write&amp;nbsp;&lt;EM&gt;wvmatch &lt;/EM&gt;and it is&amp;nbsp;&lt;EM&gt;wcmatch&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Now the lisp is working&lt;/P&gt;&lt;P&gt;many thank&lt;/P&gt;</description>
      <pubDate>Sat, 28 Sep 2024 19:12:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13052070#M15269</guid>
      <dc:creator>francine.zimmermannSRSWJ</dc:creator>
      <dc:date>2024-09-28T19:12:18Z</dc:date>
    </item>
    <item>
      <title>Re: Redefine only blocks with a prefix name and synchronise attributes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13055617#M15270</link>
      <description>&lt;P&gt;The lisp work well and redefine only those with given prefix name.&lt;/P&gt;&lt;P&gt;But is it possible to avoid all others unnecessary blocks on the command line ? For example : &lt;EM&gt;Duplicate definition of block ISO13918_M6x12 ignore.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;All blocks from the drawing are listed on the command line and it takes too much time, especially as I'm limiting the type of blocks to be reinserted.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to notify only what we're looking for?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 19:09:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13055617#M15270</guid>
      <dc:creator>francine.zimmermannSRSWJ</dc:creator>
      <dc:date>2024-09-30T19:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: Redefine only blocks with a prefix name and synchronise attributes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13058935#M15271</link>
      <description>&lt;P&gt;hth&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun c:redefine_block (/ where_dirs block_mask block_name redefine_block_list dir_blocks)
	(setq where_dirs (list "C:\\000_Block\\Block" 
			      		   "C:\\000_Block\\Profile"
			   	   	 )
		  block_mask "TM*,KG*"
	)
	(vlax-map-collection (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
						'(lambda (block) (if (and (zerop (vlax-get block 'isxref))
												  (zerop (vlax-get block 'islayout))
												  (wcmatch (setq block_name (vla-get-name block)) block_mask)
											 )
											 (setq redefine_block_list (cons (strcase block_name) redefine_block_list))
										 )
						 )
	)
	(if (setq dir_blocks 
				(vl-remove-if-not 'cadr 
								   (mapcar '(lambda (dir) (cons dir 
								   								(list (vl-remove-if-not '(lambda (file_name) (member (strcase (vl-filename-base file_name))
																													 redefine_block_list
																							 				 )
																		  				 )
																		  				 (vl-directory-files dir "*.dwg" 1)
																	  )
												  				)
														  )
						  					)
									  		where_dirs
							 		)  
				)
		 )     
		 (progn
		 	(foreach dir dir_blocks
		 		(foreach file_name (cadr dir)
		 			(vla-erase
		 				(vla-insertblock (vla-get-block (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object))))
		 								 (vlax-3d-point 0 0 0)
		 								 (strcat (car dir) "\\" file_name) 
		 								 1 1 1 0
		 				)
		 			)
					(princ (strcat "Block \"" (vl-filename-base file_name) "\" redefined\n")) 
		 		)
		 	)
			(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;</description>
      <pubDate>Wed, 02 Oct 2024 12:33:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13058935#M15271</guid>
      <dc:creator>komondormrex</dc:creator>
      <dc:date>2024-10-02T12:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: Redefine only blocks with a prefix name and synchronise attributes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13059134#M15272</link>
      <description>&lt;P&gt;&amp;nbsp;I tested your lisp, the list of block is working well but it don't redefine the modify blocks&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 08:41:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13059134#M15272</guid>
      <dc:creator>francine.zimmermannSRSWJ</dc:creator>
      <dc:date>2024-10-02T08:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: Redefine only blocks with a prefix name and synchronise attributes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13059147#M15273</link>
      <description>&lt;P&gt;what do you mean exactly?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 08:48:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13059147#M15273</guid>
      <dc:creator>komondormrex</dc:creator>
      <dc:date>2024-10-02T08:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Redefine only blocks with a prefix name and synchronise attributes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13059262#M15274</link>
      <description>&lt;P&gt;ah, i see now. check the updated code above.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 09:35:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13059262#M15274</guid>
      <dc:creator>komondormrex</dc:creator>
      <dc:date>2024-10-02T09:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: Redefine only blocks with a prefix name and synchronise attributes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13059578#M15275</link>
      <description>&lt;P&gt;Now it works perfectly&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 12:29:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/redefine-only-blocks-with-a-prefix-name-and-synchronise/m-p/13059578#M15275</guid>
      <dc:creator>francine.zimmermannSRSWJ</dc:creator>
      <dc:date>2024-10-02T12:29:15Z</dc:date>
    </item>
  </channel>
</rss>

