<?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: Lisp to add link to block attribute in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-add-link-to-block-attribute/m-p/6350162#M131900</link>
    <description>&lt;P&gt;That works perfectly!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks very much Henrique.&lt;/P&gt;</description>
    <pubDate>Thu, 26 May 2016 11:19:08 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-05-26T11:19:08Z</dc:date>
    <item>
      <title>Lisp to add link to block attribute</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-add-link-to-block-attribute/m-p/6348855#M131898</link>
      <description>&lt;P&gt;Hello - I have a number of drawings that contain numerous instances of a block named TAG-PART. &amp;nbsp;This block contains a number of attributes, one of which is FRAME-QTY.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I would like to do is to link the value of this attribute in all instances of the block to a custom property in the drawing called QUANTITY.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Right now I have the following code that reads the value of QUANTITY and updates the attribute value, but does not link it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;;;============================================================================== 
;; Definition: Program

  (defun c:QtyLinkSetup ()


;;==============================================================================
;; Load ActiveX

    (vl-load-com)


;;==============================================================================
;; Definition: blkset
;; Args: blname
;; Example: (blname "11x17_Fabrication_TB-2013")

    (defun blkset (blname)
      (if 
        (not (setq sset (ssget "X" (list (cons 2 blname)))))	
	(setq sset (ssadd))
      );end if
      (if 
        (setq ss-dyn (ssget "X" (list (cons 2 "`*U*"))))
	(progn
	  (setq num 0)
	  (repeat (sslength ss-dyn)
	    (setq ent (ssname ss-dyn num))
	    (setq effname (vla-get-EffectiveName (vlax-ename-&amp;gt;vla-object ent)))
	    (if
              (= blname effname)
	      (ssadd ent sset)
	    );end if
	    (setq num (1+ num))
	  );end repeat
	);end progn
      );end if
      sset
    );end defun


;;==============================================================================
;; Get Quantity value in drawing properties custom tab

    (setq acadObject   (vlax-get-acad-object)
          acadDocument (vla-get-ActiveDocument acadObject)
          suminfo      (vlax-get-Property acadDocument 'SummaryInfo)
    );end setq

    (vla-getCustomByKey suminfo "QUANTITY" 'qty)


;;==============================================================================================
;; Get "TAG-PART" blocks and link quantity value to drawing custom properties quantity

    (setq blname "TAG-PART"
          sset nil
          ss1 (blkset blname)
          memb 0
    );end setq
    (if ss1	  
      (repeat (sslength ss1)
	(progn
          (setq entname (vlax-ename-&amp;gt;vla-object (ssname ss1 memb))
	        entlist (vlax-safearray-&amp;gt;list (vlax-variant-value (vla-getattributes entname)))
          );end setq
          (vla-put-textstring (nth 5 entlist) qty)
	  (setq memb (1+ memb))
	);end progn
      );end repeat
    );end if


;;============================================================================== 
;; End routine

    (princ)
  );end progn&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 May 2016 16:21:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-add-link-to-block-attribute/m-p/6348855#M131898</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-25T16:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to add link to block attribute</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-add-link-to-block-attribute/m-p/6350004#M131899</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;
&lt;P&gt;Hello - I have a number of drawings that contain numerous instances of a block named TAG-PART. &amp;nbsp;This block contains a number of attributes, one of which is FRAME-QTY.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I would like to do is to link the value of this attribute in all instances of the block to a custom property in the drawing called QUANTITY.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Right now I have the following code that reads the value of QUANTITY and updates the attribute value, &lt;STRONG&gt;but does not link it.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help would be appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hi gpeneltonHSYMG,&lt;/P&gt;
&lt;P&gt;if by 'link it' you mean&amp;nbsp;using a&amp;nbsp;FIELD, try to change&lt;/P&gt;
&lt;PRE&gt;(vla-put-textstring (nth 5 entlist) qty)&lt;/PRE&gt;
&lt;P&gt;to&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vla-put-textstring (nth 5 entlist) "%&amp;lt;\\AcVar CustomDP.QUANTITY&amp;gt;%")&lt;/PRE&gt;
&lt;P&gt;and a regen should be required...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps, &lt;BR /&gt;Henrique&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 08:56:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-add-link-to-block-attribute/m-p/6350004#M131899</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2016-05-26T08:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to add link to block attribute</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-add-link-to-block-attribute/m-p/6350162#M131900</link>
      <description>&lt;P&gt;That works perfectly!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks very much Henrique.&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 11:19:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-add-link-to-block-attribute/m-p/6350162#M131900</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-26T11:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to add link to block attribute</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-add-link-to-block-attribute/m-p/6350163#M131901</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;
&lt;P&gt;That works perfectly!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks very much Henrique.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You're welcome, gpeneltonHSYMG&lt;BR /&gt;Glad I could help&lt;BR /&gt;&lt;BR /&gt;Henrique&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 11:20:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-add-link-to-block-attribute/m-p/6350163#M131901</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2016-05-26T11:20:22Z</dc:date>
    </item>
  </channel>
</rss>

