<?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: Stepping through block to get Text value. in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018337#M28852</link>
    <description>Ahhh ok I see. That works.&lt;BR /&gt;I always thought it was a lot harder than it seems.&lt;BR /&gt;Basically I can change the&lt;BR /&gt;(alert (cdr (assoc 1 (entget e)))&lt;BR /&gt;to&lt;BR /&gt;(setq attv (cdr (assoc 1 (entget e)))&lt;BR /&gt;to use that obtained value later on in the lisp.&lt;BR /&gt;One other thing, nentsel and entsel always confuse me a bit.&lt;BR /&gt;How do I go about using entdel to delete the selected object at the end of the code?&lt;BR /&gt;For some reason I can never wrap my head around where the initial Entity Name is using Nentsel.&lt;BR /&gt;</description>
    <pubDate>Wed, 07 Jun 2023 19:35:54 GMT</pubDate>
    <dc:creator>Strydaris2492</dc:creator>
    <dc:date>2023-06-07T19:35:54Z</dc:date>
    <item>
      <title>Stepping through block to get Text value.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018185#M28850</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking for some help here with something.&lt;/P&gt;&lt;P&gt;What I am looking to do is to get a text or mtext value inside a block.&lt;/P&gt;&lt;P&gt;Issue may be that that text value could be another block nested in another block nest in another one.&lt;/P&gt;&lt;P&gt;All depends on how the consultants we work with decide to send them.&lt;/P&gt;&lt;P&gt;The other issue may be that there my be 2 text values inside the nested block, but what I want is the one that will be selected by the LISP.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have moderate knowledge of LISP, but have never looked into stepping through a block to get to a nested block. Not sure where to begin with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for the knowledge and help.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 18:30:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018185#M28850</guid>
      <dc:creator>Strydaris2492</dc:creator>
      <dc:date>2023-06-07T18:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Stepping through block to get Text value.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018211#M28851</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13171171"&gt;@Strydaris2492&lt;/a&gt;&amp;nbsp;If you can pick the item then NENTSEL should work:&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(defun c:foo (/ e)
  (if (and (setq e (car (nentsel "\nPick your text: "))) (cdr (assoc 1 (entget e))))
    (alert (cdr (assoc 1 (entget e))))
  )
  (princ)
)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 07 Jun 2023 18:41:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018211#M28851</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2023-06-07T18:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Stepping through block to get Text value.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018337#M28852</link>
      <description>Ahhh ok I see. That works.&lt;BR /&gt;I always thought it was a lot harder than it seems.&lt;BR /&gt;Basically I can change the&lt;BR /&gt;(alert (cdr (assoc 1 (entget e)))&lt;BR /&gt;to&lt;BR /&gt;(setq attv (cdr (assoc 1 (entget e)))&lt;BR /&gt;to use that obtained value later on in the lisp.&lt;BR /&gt;One other thing, nentsel and entsel always confuse me a bit.&lt;BR /&gt;How do I go about using entdel to delete the selected object at the end of the code?&lt;BR /&gt;For some reason I can never wrap my head around where the initial Entity Name is using Nentsel.&lt;BR /&gt;</description>
      <pubDate>Wed, 07 Jun 2023 19:35:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018337#M28852</guid>
      <dc:creator>Strydaris2492</dc:creator>
      <dc:date>2023-06-07T19:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: Stepping through block to get Text value.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018360#M28853</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13171171"&gt;@Strydaris2492&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Ahhh ok I see. That works.&lt;BR /&gt;I always thought it was a lot harder than it seems.&lt;BR /&gt;Basically I can change the&lt;BR /&gt;(alert (cdr (assoc 1 (entget e)))&lt;BR /&gt;to&lt;BR /&gt;(setq attv (cdr (assoc 1 (entget e)))&lt;BR /&gt;to use that obtained value later on in the lisp. &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;YES&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;One other thing, nentsel and entsel always confuse me a bit.&lt;BR /&gt;How do I go about using entdel to delete the selected object at the end of the code?&amp;nbsp;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;TO DELETE THE TEXT OR THE BLOCK?&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;For some reason I can never wrap my head around where the initial Entity Name is using Nentsel.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13171171"&gt;@Strydaris2492&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See above.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 19:45:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018360#M28853</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2023-06-07T19:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: Stepping through block to get Text value.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018370#M28854</link>
      <description>To delete the initial block that the text is nested in.&lt;BR /&gt;What I am looking to do is select the block with the nested text, store it in a variable, delete the block and insert my own block with the text I retrieved to fill out an attribute.&lt;BR /&gt;To my understanding entsel only grabs the list of the first level of block with the entity name at the begining as assoc 0?&lt;BR /&gt;Whereas nentsel grabs the list and puts all the entities at the end?</description>
      <pubDate>Wed, 07 Jun 2023 19:52:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018370#M28854</guid>
      <dc:creator>Strydaris2492</dc:creator>
      <dc:date>2023-06-07T19:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: Stepping through block to get Text value.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018377#M28855</link>
      <description>&lt;P&gt;Here's a quick example:&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(defun c:foo (/ e)
  (if (and (setq e (nentsel "\nPick your text: ")) (cdr (assoc 1 (entget (car e)))))
    (progn (alert (cdr (assoc 1 (entget (car e))))) (entdel (car (last e))))
  )
  (princ)
)&lt;/LI-CODE&gt;
&lt;P&gt;This is a typical output for NENTSEL where the top item (0) is the deepest and the first item of the last (3) is the topmost host for the text.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ronjonp_0-1686167760204.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1224827i251131C9AC399577/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ronjonp_0-1686167760204.png" alt="ronjonp_0-1686167760204.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you do have crazy nesting this will delete all the 'host' blocks:&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(defun c:foo (/ e)
  (if (and (setq e (nentsel "\nPick your text: ")) (cdr (assoc 1 (entget (car e)))))
    (progn (alert (cdr (assoc 1 (entget (car e))))) (mapcar 'entdel (last e)))
  )
  (princ)
)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 07 Jun 2023 20:04:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018377#M28855</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2023-06-07T20:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: Stepping through block to get Text value.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018396#M28856</link>
      <description>&lt;P&gt;Hmmm that doesnt seem to be working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I played around a bit because I think I understand what you are saying.&lt;/P&gt;&lt;P&gt;This is what worked to del the initial block.&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun c:foo (/ e)
  (if (and (setq e (nentsel "\nPick your text: ")) (cdr (assoc 1 (entget (car e)))))
    (progn (alert (cdr (assoc 1 (entget (car e))))) (entdel (last (last e))))
  )
  (princ)
)&lt;/LI-CODE&gt;&lt;P&gt;To my understanding, the entdel needs to look in the last part of the list, to the last entity in that list.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 20:16:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018396#M28856</guid>
      <dc:creator>Strydaris2492</dc:creator>
      <dc:date>2023-06-07T20:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: Stepping through block to get Text value.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018401#M28857</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13171171"&gt;@Strydaris2492&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;.... select the block with the nested text, store it in a variable, delete the block ....&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;For that, I would use plain (entsel) to select the Block, but be sure to select it on the Text piece:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(setq esel (entsel "\nSelect Text element in Block: "))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then pull &lt;FONT color="#3366FF"&gt;&lt;EM&gt;the point you picked it by&lt;/EM&gt;&lt;/FONT&gt;&amp;nbsp;to use in an &lt;STRONG&gt;(nentsel&lt;FONT color="#FF0000"&gt;p&lt;/FONT&gt;)&lt;/STRONG&gt; function to get the Text piece, and you can pull its content at the same time:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(setq attv (cdr (assoc 1 (entget (car (nentsel&lt;FONT color="#FF0000"&gt;p&lt;/FONT&gt; &lt;FONT color="#3366FF"&gt;(cadr esel)&lt;/FONT&gt;))))))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then use &lt;FONT color="#FF00FF"&gt;&lt;EM&gt;the entity name&lt;/EM&gt;&lt;/FONT&gt; from the original (entsel) function to delete the Block:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(entdel &lt;FONT color="#FF00FF"&gt;(car esel)&lt;/FONT&gt;)&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 20:23:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018401#M28857</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-06-07T20:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: Stepping through block to get Text value.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018414#M28858</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13171171"&gt;@Strydaris2492&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hmmm that doesnt seem to be working.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I played around a bit because I think I understand what you are saying.&lt;/P&gt;
&lt;P&gt;This is what worked to del the initial block.&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(defun c:foo (/ e)
  (if (and (setq e (nentsel "\nPick your text: ")) (cdr (assoc 1 (entget (car e)))))
    (progn (alert (cdr (assoc 1 (entget (car e))))) (entdel (last (last e))))
  )
  (princ)
)&lt;/LI-CODE&gt;
&lt;P&gt;To my understanding, the entdel needs to look in the last part of the list, to the last entity in that list.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13171171"&gt;@Strydaris2492&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use my second example above:&amp;nbsp;&lt;/P&gt;
&lt;PRE class="lia-code-sample line-numbers language-lisp" tabindex="0"&gt;&lt;CODE&gt;(mapcar 'entdel (last e))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Your:&lt;/P&gt;
&lt;PRE class="lia-code-sample line-numbers language-lisp" tabindex="0"&gt;&lt;CODE&gt;(entdel (last (last e)))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Should work as well. My previous example was for a simple non-nested block.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 20:47:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018414#M28858</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2023-06-07T20:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: Stepping through block to get Text value.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018419#M28859</link>
      <description>&lt;P&gt;Hey Kent,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure I 100% understand what you are saying here.&lt;/P&gt;&lt;P&gt;Let me see if I understand this correctly&lt;/P&gt;&lt;P&gt;Using Entsel will only pull the Parent block info (Pardon the terminology, but this is how I understand it better)&lt;/P&gt;&lt;P&gt;I can then use nentselp to pull the nested block info.&lt;/P&gt;&lt;P&gt;The idea being that I can easily get the parent block info I need without going to deep into the info returned by nentselp?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 20:31:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018419#M28859</guid>
      <dc:creator>Strydaris2492</dc:creator>
      <dc:date>2023-06-07T20:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: Stepping through block to get Text value.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018700#M28860</link>
      <description>&lt;P&gt;Thanks for the help today.&lt;/P&gt;&lt;P&gt;I was able to get the code working as I had hoped and added a couple extras.&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun _NextTrick  (pt obj / end code pt2)
      (while
            (and (null end)
                 (setq p    (grread t 15 0)
                       code (car p)))
                 (cond
                       ((= 5 code)
                        (vlax-put
                              obj
                              'TextAlignmentPoint
                              (setq pt2 (trans (cadr p) 1 0)))
                        (setq pt pt2)
                        )
                       ((or (= 2 code) (= code 3))
                        (setq end T)))
                 )
      );defun      
  ;radians to degrees &amp;amp; degrees to radian
(defun rtd (r) (* 180.0 (/ r pi)))
(defun DtR (D) (/ (* D pi) 180))

(defun c:foo2 (/ ent)
    ;Set Layers and block names
  (setq lay1 "S-Slope-Frozen"
	lay2 "PROP-GRADE"
	lay3 "SLOPE-PH1"
	blk1 "DRAR"
	blk2 "Grade_Point"
	blk3 "PSEX"
	);End setq for varible layers and blocks
(setvar 'clayer lay2)
  (setq ent (entsel "\nSelect Grade Elevation Text: ")
  	attv (cdr (assoc 1 (entget (car (nentselp (cadr ent))))))
  	ang (cdr (assoc 50 (entget (car (nentselp (cadr ent))))))
	ins (cdr (assoc 10 (entget (car ent))))
	ins (list(car ins)(cadr ins) 0 )
	)
  		(cond	
                      (	
			(setq blk (vlax-invoke
			                (vlax-get
			                      (vla-get-ActiveLayout
			                            (vla-get-activedocument
			                                  (vlax-get-acad-object)))
			                      'Block)
			                'InsertBlock  (trans ins 1 0)
			                blk2 1 1 1 ang))

                       
		            (setq atb  (Car (vlax-invoke blk 'Getattributes)))
                            (vla-put-textstring atb attv)
                       	    (princ "\n&amp;lt;&amp;lt; Pick point for text location &amp;gt;&amp;gt;")	
                       		(_NextTrick (trans (vlax-get atb 'TextAlignmentPoint) 0 1) atb)
		            (setq inserted (cons blk inserted)
                                  )
                       						)
                      (	(and  (setq str (eq (type ins) 'STR))(eq ins "U") inserted)
                       		(vla-delete (car inserted))
                       		(setq inserted (Cdr inserted)
                                      counter (1- counter) )
		                      				)
                      (	str (princ "\nNothing to UNDO")	)
                      )
(entdel (car ent))
    (princ)
)&lt;/LI-CODE&gt;&lt;P&gt;It was a lot easier than I thought.&lt;/P&gt;&lt;P&gt;Only thing I need to add is maybe some conditions just in case the text is not within a block.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 22:30:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018700#M28860</guid>
      <dc:creator>Strydaris2492</dc:creator>
      <dc:date>2023-06-07T22:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Stepping through block to get Text value.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018851#M28861</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13171171"&gt;@Strydaris2492&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;Using Entsel will only pull the Parent block info ....&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT color="#FF6600"&gt;KC:&amp;nbsp; Not quite -- (entsel) doesn't pull any information, but just returns the object's [in this case the Block's] entity name and the point at which you picked it, both of which you can use without pulling any information..&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;I can then use nentselp to pull the nested block info.&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF6600"&gt;&lt;EM&gt;KC:&amp;nbsp; Use (&lt;FONT color="#339966"&gt;n&lt;/FONT&gt;entsel&lt;FONT color="#0000FF"&gt;p&lt;/FONT&gt;), with the &lt;FONT color="#0000FF"&gt;p&lt;/FONT&gt; part being the selection &lt;FONT color="#0000FF"&gt;p&lt;/FONT&gt;oint that's part of what (entsel) returned, to get the entity name of the Text object &lt;FONT color="#339966"&gt;n&lt;/FONT&gt;ested inside the Block.&amp;nbsp; My suggestion expands around that to extract the text content from it and put it into your 'attv' variable, all in that one line of code.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;The idea being that I can easily get the parent block info I need without going to deep into the info returned by nentselp?&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT color="#FF6600"&gt;KC:&amp;nbsp; You don't &lt;U&gt;need&lt;/U&gt; any parent Block information except its entity name, which is the first thing in the list that (entsel) returns.&amp;nbsp; The (entdel) function will use that to delete the Block after the Text's content has been extracted/saved.&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Putting my earlier suggested lines together:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun C:TRYIT (/ esel)
  (setq esel (entsel "\nSelect Text element in Block: "))
  (setq attv (cdr (assoc 1 (entget (car (nentselp (cadr esel)))))))
  (entdel (car esel))
  (prin1)
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That should [I don't have AutoCAD up to try it] leave the Text content in the 'attv' variable, to do with what you will.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 00:44:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stepping-through-block-to-get-text-value/m-p/12018851#M28861</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-06-08T00:44:56Z</dc:date>
    </item>
  </channel>
</rss>

