<?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 Get attribute values from xref dynamic block in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/get-attribute-values-from-xref-dynamic-block/m-p/7116066#M119647</link>
    <description>&lt;P&gt;Anyone can help to enhance this lisp to list the attribute value of xref block (dynamic block) for a grid line.&lt;/P&gt;
&lt;P&gt;Below is the link to attached lisp, which can be a starting point. Need to improve this lisp to select xref block and it's a dynamic block.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &lt;A href="http://forums.augi.com/showthread.php?150072-Get-Attribute-Value-from-Block-Tag" target="_blank"&gt;http://forums.augi.com/showthread.php?150072-Get-Attribute-Value-from-Block-Tag&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Attached is a sample grid lines. Xref-attached this grid to a new drawing. It is in this new drawing I want to list any grid to get the Grid-Ref value.&lt;/P&gt;
&lt;P&gt;This is to avoid zoom in/out and pan to find out the xref grid number when working in the center of he drawing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vl-load-com)

(defun c:GAV (/ LM:GetAttributeValue ss attValue)

  (defun LM:GetAttributeValue (blk tag / val enx)
    (while
      (and
        (null val)
        (= "ATTRIB"
           (cdr (assoc 0 (setq enx (entget (setq blk (entnext blk))))))
        )
      )
       (if (= (strcase tag) (strcase (cdr (assoc 2 enx))))
         (setq val (cdr (assoc 1 enx)))
       )
    )
  )

  (if (and (setq ss (ssget ":S:E" '((0 . "INSERT") (2 . "GRID") (66 . 1))))
           (setq attValue (LM:GetAttributeValue (ssname ss 0) "GRID-REF"))
      )
    (prompt (strcat "\n[Attribute Value] : " attValue))
  )
  (princ)
)&lt;/PRE&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Tue, 30 May 2017 07:46:06 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-05-30T07:46:06Z</dc:date>
    <item>
      <title>Get attribute values from xref dynamic block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/get-attribute-values-from-xref-dynamic-block/m-p/7116066#M119647</link>
      <description>&lt;P&gt;Anyone can help to enhance this lisp to list the attribute value of xref block (dynamic block) for a grid line.&lt;/P&gt;
&lt;P&gt;Below is the link to attached lisp, which can be a starting point. Need to improve this lisp to select xref block and it's a dynamic block.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &lt;A href="http://forums.augi.com/showthread.php?150072-Get-Attribute-Value-from-Block-Tag" target="_blank"&gt;http://forums.augi.com/showthread.php?150072-Get-Attribute-Value-from-Block-Tag&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Attached is a sample grid lines. Xref-attached this grid to a new drawing. It is in this new drawing I want to list any grid to get the Grid-Ref value.&lt;/P&gt;
&lt;P&gt;This is to avoid zoom in/out and pan to find out the xref grid number when working in the center of he drawing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vl-load-com)

(defun c:GAV (/ LM:GetAttributeValue ss attValue)

  (defun LM:GetAttributeValue (blk tag / val enx)
    (while
      (and
        (null val)
        (= "ATTRIB"
           (cdr (assoc 0 (setq enx (entget (setq blk (entnext blk))))))
        )
      )
       (if (= (strcase tag) (strcase (cdr (assoc 2 enx))))
         (setq val (cdr (assoc 1 enx)))
       )
    )
  )

  (if (and (setq ss (ssget ":S:E" '((0 . "INSERT") (2 . "GRID") (66 . 1))))
           (setq attValue (LM:GetAttributeValue (ssname ss 0) "GRID-REF"))
      )
    (prompt (strcat "\n[Attribute Value] : " attValue))
  )
  (princ)
)&lt;/PRE&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2017 07:46:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/get-attribute-values-from-xref-dynamic-block/m-p/7116066#M119647</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-05-30T07:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: Get attribute values from xref dynamic block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/get-attribute-values-from-xref-dynamic-block/m-p/7120668#M119648</link>
      <description>&lt;P&gt;Since the Attribute is in a Block inside of an Xref, and you don't have access directly to pick the attribute entity itself, you could consider the following.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Select the point on the xref for reference. (Basically touch the line you are wanting the grind info for.&lt;/P&gt;
&lt;P&gt;Discover the XREF's name and full path. (get any other info needed ins point, rotation, scale.)&lt;/P&gt;
&lt;P&gt;Use ODBX to open the file&lt;/P&gt;
&lt;P&gt;Since it is an xref the space to search is model space. Search model space entities until you come to the desired block you are looking for,&lt;/P&gt;
&lt;P&gt;Compare it's insertion point parameters to see if the point selected is along that axis, (translate the points as needed for the scale rotation and ins point)&lt;/P&gt;
&lt;P&gt;If the point matches retrieve the attribute data.&lt;/P&gt;
&lt;P&gt;Keep stepping til you find it.&lt;/P&gt;
&lt;P&gt;display data to user or provide to calling function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck,&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 19:57:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/get-attribute-values-from-xref-dynamic-block/m-p/7120668#M119648</guid>
      <dc:creator>SeeMSixty7</dc:creator>
      <dc:date>2017-05-31T19:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: Get attribute values from xref dynamic block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/get-attribute-values-from-xref-dynamic-block/m-p/7124398#M119649</link>
      <description>&lt;P&gt;Thanks SeeMSixty7. That's a bit high level for me.&lt;/P&gt;
&lt;P&gt;I changed the selection to be able to select dynamic block. I then incorporate refedit into this routine, list the attribute then close refedit.&lt;/P&gt;
&lt;P&gt;It's all good. Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2017 05:18:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/get-attribute-values-from-xref-dynamic-block/m-p/7124398#M119649</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-06-02T05:18:46Z</dc:date>
    </item>
  </channel>
</rss>

