<?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: Copy Values From one Attribute Block to Selected Block Using Prompt in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/13028669#M9699</link>
    <description>&lt;P&gt;You’re very welcome and glad to have helped you learn more Autolisp as well…cheers!!!&lt;/P&gt;</description>
    <pubDate>Wed, 18 Sep 2024 15:03:37 GMT</pubDate>
    <dc:creator>paullimapa</dc:creator>
    <dc:date>2024-09-18T15:03:37Z</dc:date>
    <item>
      <title>Copy Values From one Attribute Block to Selected Block Using Prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12984677#M9679</link>
      <description>&lt;P&gt;I found the lisp routine below and I changed vla-get-tagstring to vla-get-promptstring and I get the error... ActiveX Server returned the error: unknown name: PromptString.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The presence of duplicate attribute tags with the blocks I'm working with requires me to opting to use the attribute prompt to identify the attributes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me to understand what can be done to copy Copy values from one Attribute block to selected block using prompt.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun c:MAV (/ AT:GetSel atts ss i ass)&lt;BR /&gt;;; Match Attribute Values&lt;BR /&gt;;; Alan J. Thompson, 2017.01.31&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;(defun AT:GetSel (meth msg fnc / ent)&lt;BR /&gt;;; meth - selection method (entsel, nentsel, nentselp)&lt;BR /&gt;;; msg - message to display (nil for default)&lt;BR /&gt;;; fnc - optional function to apply to selected object&lt;BR /&gt;;; Ex: (AT:GetSel entsel "\nSelect arc: " (lambda (x) (eq (cdr (assoc 0 (entget (car x)))) "ARC")))&lt;BR /&gt;;; Alan J. Thompson, 05.25.10&lt;BR /&gt;(while&lt;BR /&gt;(progn (setvar 'ERRNO 0)&lt;BR /&gt;(setq ent (meth (cond (msg)&lt;BR /&gt;("\nSelect object: ")&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(cond ((eq (getvar 'ERRNO) 7) (princ "\nMissed, try again."))&lt;BR /&gt;((eq (type (car ent)) 'ENAME)&lt;BR /&gt;(if (and fnc (not (fnc ent)))&lt;BR /&gt;(princ "\nInvalid object!")&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;ent&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;(if (and (AT:GetSel entsel&lt;BR /&gt;"\nSelect source attributed block: "&lt;BR /&gt;(lambda (x / d)&lt;BR /&gt;(if (and (eq (cdr (assoc 0 (setq d (entget (car x))))) "INSERT")&lt;BR /&gt;(eq (cdr (assoc 66 d)) 1)&lt;BR /&gt;)&lt;BR /&gt;(setq atts (mapcar (function (lambda (a) (cons (vla-get-&lt;STRONG&gt;promp&lt;/STRONG&gt;tstring a) (vla-get-textstring a))))&lt;BR /&gt;(vlax-invoke (vlax-ename-&amp;gt;vla-object (car x)) 'GetAttributes)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(progn&lt;BR /&gt;(princ "\nSelect destination attributed block(s): ")&lt;BR /&gt;(setq ss (ssget "_:L" '((0 . "INSERT") (66 . 1))))&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(repeat (setq i (sslength ss))&lt;BR /&gt;(foreach a (vlax-invoke (vlax-ename-&amp;gt;vla-object (ssname ss (setq i (1- i)))) 'GetAttributes)&lt;BR /&gt;(if (setq ass (cdr (assoc (vla-get-&lt;STRONG&gt;prompt&lt;/STRONG&gt;string a) atts)))&lt;BR /&gt;(vla-put-textstring a ass)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;(princ)&lt;BR /&gt;)&lt;BR /&gt;(vl-load-com)&lt;BR /&gt;(princ)&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 18:48:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12984677#M9679</guid>
      <dc:creator>aamos</dc:creator>
      <dc:date>2024-08-27T18:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values From one Attribute Block to Selected Block Using Prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12984753#M9680</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15983585"&gt;@aamos&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PromptString is a property of an &lt;EM&gt;IAcadAttribute&lt;/EM&gt; (0 . "ATTDEF") and you're cycling through&amp;nbsp;&lt;EM&gt;IAcadAttribute&lt;STRONG&gt;Reference&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp;(0 . "ATTRIB") which is why you're getting an error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post a sample drawing of what you're working with.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 19:34:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12984753#M9680</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2024-08-27T19:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values From one Attribute Block to Selected Block Using Prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12984800#M9681</link>
      <description>&lt;P&gt;There are duplicate tags on an existing block with attributes. The Prompt information on the block is more&amp;nbsp;diverse. Is there a line in the lisp program that can be changed to cycle through IAcadAttribute&amp;nbsp;(0 . "ATTDEF")?&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-inline" image-alt="aamos_0-1724788025458.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1402639iCD6EDA3FE36BAA92/image-size/medium?v=v2&amp;amp;px=400" role="button" title="aamos_0-1724788025458.png" alt="aamos_0-1724788025458.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 19:57:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12984800#M9681</guid>
      <dc:creator>aamos</dc:creator>
      <dc:date>2024-08-27T19:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values From one Attribute Block to Selected Block Using Prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12984830#M9682</link>
      <description>&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Assuming&lt;/STRONG&gt;&lt;/U&gt; you're matching one titleblock with another that is &lt;U&gt;exactly&lt;/U&gt; the same, then all you have to do is fill the attributes in top to bottom. Give this mod a try:&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:mav (/ at:getsel atts ss i ass)
  ;; Match Attribute Values
  ;; Alan J. Thompson, 2017.01.31
  (defun at:getsel (meth msg fnc / ent)
    ;; meth - selection method (entsel, nentsel, nentselp)
    ;; msg - message to display (nil for default)
    ;; fnc - optional function to apply to selected object
    ;; Ex: (AT:GetSel entsel "\nSelect arc: " (lambda (x) (eq (cdr (assoc 0 (entget (car x)))) "ARC")))
    ;; Alan J. Thompson, 05.25.10
    (while (progn (setvar 'errno 0)
		  (setq	ent (meth (cond	(msg)
					("\nSelect object: ")
				  )
			    )
		  )
		  (cond	((eq (getvar 'errno) 7) (princ "\nMissed, try again."))
			((eq (type (car ent)) 'ename)
			 (if (and fnc (not (fnc ent)))
			   (princ "\nInvalid object!")
			 )
			)
		  )
	   )
    )
    ent
  )
  (if
    (and
      (at:getsel
	entsel
	"\nSelect source attributed block: "
	(lambda	(x / d)
	  (if
	    (and (eq (cdr (assoc 0 (setq d (entget (car x))))) "INSERT") (eq (cdr (assoc 66 d)) 1))
	     (setq atts	(mapcar	'vla-get-textstring
				(vlax-invoke (vlax-ename-&amp;gt;vla-object (car x)) 'getattributes)
			)
	     )
	  )
	)
      )
      (progn (princ "\nSelect destination attributed block(s): ")
	     (setq ss (ssget "_:L" (list '(0 . "INSERT") '(66 . 1))))
      )
    )
     (repeat (setq i (sslength ss))
       (foreach	a (vlax-invoke (vlax-ename-&amp;gt;vla-object (ssname ss (setq i (1- i)))) 'getattributes)
	 (vla-put-textstring a (car atts))
	 (setq atts (cdr atts))
       )
     )
  )
  (princ)
)
(vl-load-com)
(princ)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 20:15:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12984830#M9682</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2024-08-27T20:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values From one Attribute Block to Selected Block Using Prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12984869#M9683</link>
      <description>&lt;P&gt;To get the attdef prompt value you'll have to get both the source &amp;amp; &lt;SPAN&gt;destination&lt;/SPAN&gt; block's name:&lt;/P&gt;&lt;P&gt;Source block's name:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq blknam-source(cdr (assoc 2 d)))&lt;/LI-CODE&gt;&lt;P&gt;Destination block's name:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq blknam-destination (ssname ss (cdr (assoc 2 (entget (setq i (1- i)))))))&lt;/LI-CODE&gt;&lt;P&gt;Then use this function to get the block definition's entity for both:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq en-source (tblobjname "Block" blknam-source)
      en-destination (tblobjname "Block" blknam-destination)
)&lt;/LI-CODE&gt;&lt;P&gt;The first attribute def would then be the next entity:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq sen-source (entnext en-source)
      sen-destination (entnext en-destination)
)&lt;/LI-CODE&gt;&lt;P&gt;Now you get the entity data of this attribute definition with:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq sed-source (entget sen-source)
      sed-destination (entget sen-destination)
)&lt;/LI-CODE&gt;&lt;P&gt;The associated pairs to focus on are:&lt;/P&gt;&lt;P&gt;1 = default value&lt;/P&gt;&lt;P&gt;2 = tag name&lt;/P&gt;&lt;P&gt;3 = prompt value&lt;/P&gt;&lt;P&gt;So to get the tag vs prompt for each:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq tag-source (cdr (assoc 2 sed-source))
      tag-destination (cdr (assoc 2 sed-destination))
      prompt-source (cdr (assoc 3 sed-source))
      prompt-destination (cdr (assoc 3 sed-destination))
)&lt;/LI-CODE&gt;&lt;P&gt;So you can setup a while loop to loop through using entnext function till you reach end of the attribute definition list which will eq "SEQEND"&lt;/P&gt;&lt;LI-CODE lang="general"&gt;; for looping through source attdef
(while sen-source
 (if(/= (cdr(assoc 0 sed-source)) "SEQEND")
    (progn
     (setq sen-source (entnext sen-source)
           sed-source (entget sen-source)
     ) 
    )
    (setq sen-source nil)
 ) ; if
) ; while
; for looping through destination attdef
(while sen-destination
 (if(/= (cdr(assoc 0 sed-destination)) "SEQEND")
    (progn
     (setq sen-destination (entnext sen-destination)
           sed-destination (entget sen-destination)
     ) 
    )
    (setq sen-destination nil)
 ) ; if
) ; while&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 20:32:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12984869#M9683</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2024-08-27T20:32:22Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values From one Attribute Block to Selected Block Using Prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12984886#M9684</link>
      <description>&lt;P&gt;Yes, it works for the same blocks. The goal is to create a lisp routine that will copy the attribute values from the old block DIEBORD to the new block DIE_TEMPLATE using the prompt information from the old block DIEBORD. Attached is an Excel file with the information of the attribute Prompt and Tag of the old and new block. &amp;nbsp; The comparison is horizontal on each row between attributes on the file. Data transfer can be done to the&amp;nbsp;new block DIE_TEMPLATE easily since all tags are different.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 20:41:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12984886#M9684</guid>
      <dc:creator>aamos</dc:creator>
      <dc:date>2024-08-27T20:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values From one Attribute Block to Selected Block Using Prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12985216#M9685</link>
      <description>&lt;P&gt;Another hurdle using ASSOC on a list ( as done in the code ) is it's going to grab the first item and change it. Drawn by, rev desc and rev date will be updated with the last value found unless removed from the checked list and it still may not be in the correct order.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ronjonp_0-1724805077246.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1402733i23583F5744508778/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ronjonp_0-1724805077246.png" alt="ronjonp_0-1724805077246.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 00:36:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12985216#M9685</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2024-08-28T00:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values From one Attribute Block to Selected Block Using Prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12991797#M9686</link>
      <description>&lt;P&gt;Thank you for the reply Paul. I have used the information you sent me on the lisp code below. I changed the information below line 35 only to have&amp;nbsp;&lt;SPAN&gt;prompt-source and&amp;nbsp;tag-destination.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made a compare-list to associate the prompts on the source block to the tags on the destination block.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I use the&amp;nbsp;compare-list to loop through the source block to get value data and then through the&amp;nbsp;destination block to transfer value data?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun c:diebordtodietemplate (/)

  (setq compare-list '(("ALLOY AND TEMPER" "MATERIAL") ("APPROVED BY" "APPRD_BY") ("DATE" "DATE")
						  ("DESCRIPTION" "DESCRIPTION") ("DRAWING NUMBER (LOW)" "PART_NO_LOW")
						  ("DRAWING NUMBER (UPPER)" "PART_NO_UP") ("ENG. CHANGE NO. (1st)" "ECO_NO_1")
						  ("ENG. CHANGE NO. (2nd)" "ECO_NO_2") ("ENG. CHANGE NO. (3rd)" "ECO_NO_3")
						  ("FINISH" "FINISH") ("MATES W/ EXTRUSIONS" "MATE_WITH")
						  ("REVISION LEVEL (LOWER)" "REV_LOW") ("REVISION LEVEL (UPPER)" "REV_UP")
						  ("REVISION NUMBER (1st)" "ECO_REV_1") ("REVISION NUMBER (2nd)" "ECO_REV_2")
						  ("REVISION NUMBER (3rd)" "ECO_REV_3") ("SCALE" "SCALE")
						  ("SYSTEM" "SYS") ("Typ. Radius" "TYP_RAD"))) ;search list of DIEBORD Attribute Prompts to DIE_TEMPLATE Attribute Tags
						  
;To get the attdef prompt value you'll have to get both the source &amp;amp; destination block's name:	
	(setq blknam-source(cdr (assoc 2 d))) ;Source block's name
	(setq blknam-destination (ssname ss (cdr (assoc 2 (entget (setq i (1- i))))))) ;Destination block's name
	
;Then use this function to get the block definition's entity for both:	
	(setq en-source (tblobjname "DIEBORD" blknam-source)
      en-destination (tblobjname "DIE_TEMPLATE" blknam-destination)
)

;The first attribute def would then be the next entity
	(setq sen-source (entnext en-source)
      sen-destination (entnext en-destination)
)
;Now you get the entity data of this attribute definition with
	(setq sed-source (entget sen-source)
      sed-destination (entget sen-destination)
)

;The associated pairs to focus on are:
;1 = default value
;2 = tag name
;3 = prompt value
;So to get the tag vs prompt for each:	
	(setq prompt-source (cdr (assoc 3 sed-source))
      tag-destination (cdr (assoc 2 sed-destination))
)

;So you can setup a while loop to loop through using entnext function till you reach end of the attribute definition list which will eq "SEQEND"
; for looping through source attdef
(while sen-source
 (if(/= (cdr(assoc 0 sed-source)) "SEQEND")
    (progn
     (setq sen-source (entnext sen-source)
           sed-source (entget sen-source)
     ) 
    )
    (setq sen-source nil)
 ) ; if
) ; while
; for looping through destination attdef
(while sen-destination
 (if(/= (cdr(assoc 0 sed-destination)) "SEQEND")
    (progn
     (setq sen-destination (entnext sen-destination)
           sed-destination (entget sen-destination)
     ) 
    )
    (setq sen-destination nil)
 ) ; if
) ; while

  (princ)) &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2024 15:47:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12991797#M9686</guid>
      <dc:creator>aamos</dc:creator>
      <dc:date>2024-08-30T15:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values From one Attribute Block to Selected Block Using Prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12991832#M9687</link>
      <description>&lt;P&gt;Could you share your old &amp;amp; new title blocks with these attributes for me to take a look?&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2024 16:04:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12991832#M9687</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2024-08-30T16:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values From one Attribute Block to Selected Block Using Prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12992008#M9688</link>
      <description>&lt;P&gt;Yes, attached are the&amp;nbsp;old &amp;amp; new title blocks with these attributes. I also included an Excel file for comparison.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 14:22:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12992008#M9688</guid>
      <dc:creator>aamos</dc:creator>
      <dc:date>2024-09-06T14:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values From one Attribute Block to Selected Block Using Prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12992825#M9689</link>
      <description>&lt;P&gt;Give this modified mav.lsp a try...seems to work when I ran it on your sample dwg.&lt;/P&gt;&lt;P&gt;Since the block attributes for the source and destination needs to be specific so that the attribute tags can be matched and found I went ahead and just defined the source and destination block names at the beginning. If you need to change them these can be easily modified in the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq blkname-source "DIEBORD" 
      blkname-destination "DIE_TEMPLATE"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I first did an attsync to make sure the block attribute definition macthes with the inserted block and then I looped through the block definition collecting all the prompts into a list.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt; (command "_.Attsync" "_N" blkname-source) ; make sure source inserted block attributes match with block definition order
 (while en-source ; cycle through block definition to get prompt list order
  (setq ed-source (entget en-source))
  (if (eq "ATTDEF" (cdr (assoc 0 ed-source))) 
   (progn
    (setq prompt (cdr(assoc 3 ed-source)))
     (setq prompt-source (append prompt-source (list prompt)))
   ) ; progn
  )     
  (setq en-source (entnext en-source))
 ) ; while&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since the source inserted block attribute order is the same as the prompt list from the block definition, this is the same order I retrieved the values ignoring the need to look at the tagname&amp;nbsp; and I used that to find the matching tagname to the destination-list based on your compare-list:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(while sen-source
    (setq sed-source (entget sen-source))
;1 = value
;2 = tag name
;3 = prompt value	
    (cond
     ((eq (cdr (assoc 0 sed-source)) "ATTRIB") ; found attrib
;     (if (and (/= "FILENAME" prompt)(/= "DRAWN BY" prompt)(/= "REV. DESCRIPTION" prompt)(/= "REVISION DATE" prompt)) ; there are more than one 
  	   (if (setq itm (assoc (nth count prompt-source) compare-list)) ; locate item from compare-list
	     ; list of destination tag &amp;amp; source attrib value
        (setq destination-list (append destination-list (list (cons (cadr itm) (cdr (assoc 1 sed-source)))))) 
       ) ; if
;	    )
      (setq count (1+ count) ; move onto next
            sen-source (entnext sen-source)
	    ) 
	   )
	   ((/= (cdr (assoc 0 sed-source)) "SEQEND")
      (setq sen-source nil) ; end while loop
	   )
	   (t 
	    (setq sen-source (entnext sen-source)) ; move onto next
	   )
    ) ; cond
   ) ; while    &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then the last step uses your code to loop through all the destination block attributes matching the tag name to the found value in the destination-list:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(repeat (setq count (sslength entsel-destination))
  (foreach a (vlax-invoke (vlax-ename-&amp;gt;vla-object (ssname entsel-destination (setq count (1- count)))) 'getattributes)
    (if (setq found (assoc (vla-get-TagString a) destination-list)) ; look for match in list
	   (vla-put-textstring a (cdr found)) ; replace attrib value
    ) ; if
  ) ; foreach
 ) ; repeat&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 31 Aug 2024 05:28:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12992825#M9689</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2024-08-31T05:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values From one Attribute Block to Selected Block Using Prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12998462#M9690</link>
      <description>&lt;P&gt;Paul,&amp;nbsp;It works for the unique prompts, thank you very much. I'm grateful for the knowledge you've shared.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the remaining duplicated prompts it is possible to add them based on a specified order from the Enhanced Attribute Editor on the source to the destination tag name. Message 4 from&amp;nbsp;ronjonp lisp code transfers the&amp;nbsp;attributes in top to bottom. On the LISP code below I added compare-list2&lt;SPAN&gt;&amp;nbsp;to associate the specified order on the source block to the tags on the destination block.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What will need to be added to the modified mav.lsp file to also search based on the&amp;nbsp;compare-list2 to retrieved the values?&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="lisp"&gt;(setq blkname-source "DIEBORD" 
      blkname-destination "DIE_TEMPLATE"
      en-source (tblobjname "BLOCK" blkname-source) 
      compare-list '(("ALLOY AND TEMPER" "MATERIAL") ("APPROVED BY" "APPRD_BY") ("DATE" "DATE")
					 ("DESCRIPTION" "DESCRIPTION") ("DRAWING NUMBER (LOW)" "PART_NO_LOW")
					 ("DRAWING NUMBER (UPPER)" "PART_NO_UP") ("ENG. CHANGE NO. (1st)" "ECO_NO_1")
					 ("ENG. CHANGE NO. (2nd)" "ECO_NO_2") ("ENG. CHANGE NO. (3rd)" "ECO_NO_3")
					 ("FINISH " "FINISH") ("MATES W/ EXTRUSIONS" "MATE_WITH")
					 ("REVISION LEVEL (LOWER)" "REV_LOW") ("REVISION LEVEL (UPPER)" "REV_UP")
					 ("REVISION NUMBER (1st)" "ECO_REV_1") ("REVISION NUMBER (2nd)" "ECO_REV_2")
					 ("REVISION NUMBER (3rd)" "ECO_REV_3") ("SCALE" "SCALE")
					 ("SYSTEM" "SYS") ("Typ. Radius" "TYP_RAD")
					) ; list of source prompt &amp;amp; destination tag
	  compare-list2 '(("12" "DWN_BY") ("18" "ECO_REV_BY_1")
						  ("19" "ECO_REV_DESC_1") ("20" "ECO_REV_DATE_1")
						  ("23" "ECO_REV_BY_2") ("24" "ECO_REV_DESC_2")
						  ("25" "ECO_REV_DATE_2") ("28" "ECO_REV_BY_3")
						  ("29" "ECO_REV_DESC_3") ("30" "ECO_REV_DATE_3")
					) ; list of source order &amp;amp; destination tag
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Numbers on the left on image below shows source order number for duplicated prompts on source block. Orange line is a path from source to to destination.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="aamos_0-1725383582196.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1405275i8A57D8A1F821C269/image-size/medium?v=v2&amp;amp;px=400" role="button" title="aamos_0-1725383582196.png" alt="aamos_0-1725383582196.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2024 17:35:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12998462#M9690</guid>
      <dc:creator>aamos</dc:creator>
      <dc:date>2024-09-03T17:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values From one Attribute Block to Selected Block Using Prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12998684#M9691</link>
      <description>&lt;P&gt;Updated &lt;STRONG&gt;mav.lsp&lt;/STRONG&gt; but no error checking...again assumes destination block has all the tag names defined in your compare-list2.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically added the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;((eq (cdr (assoc 0 sed-source)) "ATTRIB") ; found attrib
       (setq complete-list (append complete-list (list (cdr (assoc 1 sed-source))))) ; create complete list of attribute values baesd on current order
  	   (if (setq itm (assoc (nth count prompt-source) compare-list)) ; locate item from compare-list
	     ; list of destination tag &amp;amp; source attrib value
        (setq destination-list (append destination-list (list (cons (cadr itm) (cdr (assoc 1 sed-source)))))) 
       ) ; if
      (setq count (1+ count) ; move onto next
            sen-source (entnext sen-source)
	    ) 
	   )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Defined a&amp;nbsp;&lt;STRONG&gt;complete-list&lt;/STRONG&gt; based on attrib order of all the values currently entered in source block regardless if these are found in &lt;STRONG&gt;compare-list&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Then as code loops through the selected destination blocks do a second &lt;STRONG&gt;foreach&lt;/STRONG&gt; in this case on &lt;STRONG&gt;compare-list2&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(repeat (setq count (sslength entsel-destination))
  (foreach a (vlax-invoke (vlax-ename-&amp;gt;vla-object (setq ent (ssname entsel-destination (setq count (1- count))))) 'getattributes)
    (if (setq found (assoc (vla-get-TagString a) destination-list)) ; look for match in list
	   (vla-put-textstring a (cdr found)) ; replace attrib value
    ) ; if
  ) ; foreach
  (foreach itm compare-list2 
   (setq idx (1- (atoi (car itm))) ; get order list index
         tag (cadr itm) ; get tag name
   )
   (setpropertyvalue ent tag (nth idx complete-list)) ; assumes attrib tag name exists in selected destination block
  ) ; foreach
 )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Breaking the above 2nd &lt;STRONG&gt;foreach&lt;/STRONG&gt; lines of code down:&lt;/P&gt;&lt;P&gt;Since the first item in each of your &lt;STRONG&gt;compare-list2&lt;/STRONG&gt; items is defined as a string "&lt;STRONG&gt;12&lt;/STRONG&gt;" "&lt;STRONG&gt;18&lt;/STRONG&gt;" "&lt;STRONG&gt;19&lt;/STRONG&gt;" and etc, then just use &lt;STRONG&gt;car&lt;/STRONG&gt; function to get this. But to get this position as the index number of&amp;nbsp;&lt;STRONG&gt;complete-list&lt;/STRONG&gt;&amp;nbsp;it needs to be converted from a string to an integer using &lt;STRONG&gt;atoi&lt;/STRONG&gt; function and subtracted by one &lt;STRONG&gt;1-&lt;/STRONG&gt; because AutoLISP treats the first item in a list not as #1 but #0:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq idx (1- (atoi (car itm))) 
      tag (cadr itm) ; get tag name
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since the 2nd item in each of your &lt;STRONG&gt;compare-list2&lt;/STRONG&gt; is the attribute tag, then just use &lt;STRONG&gt;cadr&lt;/STRONG&gt; function.&lt;/P&gt;&lt;P&gt;Finally use AutoLISP's built-in &lt;STRONG&gt;setpropertyvalue&lt;/STRONG&gt; function to place the attribute value from source block found using the index of &lt;STRONG&gt;complete-list &lt;/STRONG&gt;and then&amp;nbsp;reference the &lt;STRONG&gt;tag &lt;/STRONG&gt;name from your &lt;STRONG&gt;compare-list2&lt;/STRONG&gt;&amp;nbsp;onto the destination block:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setpropertyvalue ent tag (nth idx complete-list))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: I defined&amp;nbsp;&lt;STRONG&gt;ent&lt;/STRONG&gt; to reference the destination block back in the first foreach loop:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq ent (ssname entsel-destination (setq count (1- count))))&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>Tue, 03 Sep 2024 19:14:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/12998684#M9691</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2024-09-03T19:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values From one Attribute Block to Selected Block Using Prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/13005041#M9692</link>
      <description>&lt;P&gt;Paul,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The updated mav file now transfers all the information from the old template to the new.&lt;/P&gt;&lt;P&gt;Thank you for taking the time to share this knowledge with me. I truly appreciate it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 14:21:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/13005041#M9692</guid>
      <dc:creator>aamos</dc:creator>
      <dc:date>2024-09-06T14:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values From one Attribute Block to Selected Block Using Prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/13005044#M9693</link>
      <description>&lt;P&gt;Glad to have helped…cheers!!!&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 14:22:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/13005044#M9693</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2024-09-06T14:22:30Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values From one Attribute Block to Selected Block Using Prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/13023959#M9694</link>
      <description>&lt;P&gt;Paul,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I removed the command _.Attsync line because the source text height and width factor must be keep as is to fit within the specified block area when the text runs beyond the default for height and width.&amp;nbsp; Is there a way to also transfer the source value&amp;nbsp;text height and width factor to the specified&amp;nbsp;selected destination block tags?&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-inline" image-alt="aamos_0-1726501181841.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1409777i78E9BBD9CC5D9869/image-size/medium?v=v2&amp;amp;px=400" role="button" title="aamos_0-1726501181841.png" alt="aamos_0-1726501181841.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 16:02:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/13023959#M9694</guid>
      <dc:creator>aamos</dc:creator>
      <dc:date>2024-09-16T16:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values From one Attribute Block to Selected Block Using Prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/13023991#M9695</link>
      <description>&lt;P&gt;Assuming &lt;STRONG&gt;attsync&lt;/STRONG&gt; is not required to run first because the source inserted block attribute sequence still matches with the actual block definition, do all the Tags have unique height and width factors that need to be transferred or are there specific one or two that have this requirement?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 16:19:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/13023991#M9695</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2024-09-16T16:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values From one Attribute Block to Selected Block Using Prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/13025869#M9696</link>
      <description>&lt;P&gt;Most of the tags have the default 0.08 for the height and 1.0 for the width. In some the attribute values from the old block DIEBORD there are some text values that have a different&amp;nbsp;height and&amp;nbsp;width. On the source block the prompts DESCRIPTION, and MATES W/ EXTRUSIONS, and&amp;nbsp;source order numbers 19, 24, and 29 are the ones most likely to have&amp;nbsp;a different&amp;nbsp;height and&amp;nbsp;width.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It maybe easier just to have a &lt;STRONG&gt;default transfer of all the source block text value height and width&lt;/STRONG&gt; because the source and destination block are mostly visually identical and maintaining the source text height and width will always fit into the destination block.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2024 13:27:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/13025869#M9696</guid>
      <dc:creator>aamos</dc:creator>
      <dc:date>2024-09-17T13:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values From one Attribute Block to Selected Block Using Prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/13026910#M9697</link>
      <description>&lt;P&gt;Attach revised &lt;STRONG&gt;MAV.lsp&lt;/STRONG&gt; should transfer all matching source prompt/value height &amp;amp; width factors over to the destination tag/value height &amp;amp; width factors.&lt;/P&gt;&lt;P&gt;Hopefully without running &lt;STRONG&gt;ATTSYNC&lt;/STRONG&gt; first would not be an issue with the &lt;STRONG&gt;Block Def Attrib&lt;/STRONG&gt;&amp;nbsp;order sequence vs the &lt;STRONG&gt;Inserted BLock Attrib&lt;/STRONG&gt;&amp;nbsp;order sequence.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2024 21:38:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/13026910#M9697</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2024-09-17T21:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values From one Attribute Block to Selected Block Using Prompt</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/13028594#M9698</link>
      <description>&lt;P&gt;Paul,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for the updated mav file. It now works as expected. While reviewing the lisp file I was able to learn how to get the&amp;nbsp;value&amp;nbsp;height and width factor form the source and replace in destination for the value&amp;nbsp;height and width factor.&amp;nbsp; I'm grateful for the knowledge you've shared.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2024 14:35:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-values-from-one-attribute-block-to-selected-block-using/m-p/13028594#M9698</guid>
      <dc:creator>aamos</dc:creator>
      <dc:date>2024-09-18T14:35:26Z</dc:date>
    </item>
  </channel>
</rss>

