<?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: (entlast) deeper in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entlast-deeper/m-p/12443507#M20416</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun entlast-i (i / d)
  (setq d (vla-get-block (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object)))))
  (vlax-vla-object-&amp;gt;ename (vla-item d (- (vla-get-count d) (1+ i))))
  )&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Dec 2023 13:34:50 GMT</pubDate>
    <dc:creator>ВeekeeCZ</dc:creator>
    <dc:date>2023-12-15T13:34:50Z</dc:date>
    <item>
      <title>(entlast) deeper</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entlast-deeper/m-p/12443450#M20415</link>
      <description>&lt;P&gt;The (entlast) function returns the element that was inserted last.&lt;BR /&gt;Is it possible to find out what element was inserted 2,3,4,n steps earlier?&lt;/P&gt;&lt;P&gt;Jerzy&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2023 13:08:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entlast-deeper/m-p/12443450#M20415</guid>
      <dc:creator>jerzy.bajor</dc:creator>
      <dc:date>2023-12-15T13:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: (entlast) deeper</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entlast-deeper/m-p/12443507#M20416</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun entlast-i (i / d)
  (setq d (vla-get-block (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object)))))
  (vlax-vla-object-&amp;gt;ename (vla-item d (- (vla-get-count d) (1+ i))))
  )&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2023 13:34:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entlast-deeper/m-p/12443507#M20416</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2023-12-15T13:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: (entlast) deeper</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entlast-deeper/m-p/12443510#M20417</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8290272"&gt;@jerzy.bajor&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The (entlast) function returns the element that was inserted last.&lt;BR /&gt;Is it possible to find out what element was inserted 2,3,4,n steps earlier?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That should be possible, but clarify something....&amp;nbsp; Since an individual "step" could result it &lt;EM&gt;multiple&lt;/EM&gt; objects [Array, Offset of an object convoluted enough that more than one object results, Inserting a Block pre-exploded, Exploding of a Polyline or Mtext, etc.], do you want &lt;EM&gt;the results of a given step&lt;/EM&gt;, or are you looking for selecting the [for example] &lt;EM&gt;fourth-to-last&lt;/EM&gt; [individual] &lt;EM&gt;object&lt;/EM&gt; in the drawing?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the latter, a modification of &lt;STRONG&gt;LastNo.lsp&lt;/STRONG&gt;, &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/select-a-second-last-entity/m-p/7709552/highlight/true#M364014" target="_blank" rel="noopener"&gt;&amp;gt;here&amp;lt;&lt;/A&gt;, should be able to do it.&amp;nbsp; That Selects the last given quantity of objects in the drawing for example typing &lt;STRONG&gt;(LN 4)&lt;/STRONG&gt; gets the last 4 objects, and I'm sure it could be adjusted to select only the specified one.&amp;nbsp; It does it by actually deleting objects [temporarily] and taking advantage of the fact that (entdel) removes an object if it's there, but &lt;EM&gt;brings it back&lt;/EM&gt; if it has been removed.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2023 13:35:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entlast-deeper/m-p/12443510#M20417</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-12-15T13:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: (entlast) deeper</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entlast-deeper/m-p/12443516#M20418</link>
      <description>Thank you. This is the result I wanted to get.</description>
      <pubDate>Fri, 15 Dec 2023 13:38:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entlast-deeper/m-p/12443516#M20418</guid>
      <dc:creator>jerzy.bajor</dc:creator>
      <dc:date>2023-12-15T13:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: (entlast) deeper</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entlast-deeper/m-p/12443682#M20419</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;.... a modification of &lt;STRONG&gt;LastNo.lsp&lt;/STRONG&gt;, &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/select-a-second-last-entity/m-p/7709552/highlight/true#M364014" target="_blank" rel="noopener"&gt;&amp;gt;here&amp;lt;&lt;/A&gt;, should be able to do it.&amp;nbsp; ....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;By way of asking for further clarification, here's such a modification:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;;|  NthToLast.LSP [function name: NL]
To select the Nth-To-Last entity at user-specified number N.
Use by typing (NL qu) where 'qu' is integer quantity from last
  [inclusive -- (NL 1) is the same as plain (entlast)]
Kent Cooper; 15 December 2023
|;
(defun NL (qu / ss)
  (setq ss (ssadd))
  (if (and (entlast) (&amp;gt;= (sslength (ssget "_X")) qu))
    (progn ; then
      (repeat (1- qu)
        (ssadd (entlast) ss) (entdel (entlast))
      ); repeat
      (setq nthtolast (entlast)); target object
      (repeat (setq qu (1- qu))
        (entdel (ssname ss (setq qu (1- qu)))); bring back
      ); repeat
      nthtolast
    ); progn
    (prompt "\nNot that many objects in drawing."); else
  ); if
); defun
&lt;/LI-CODE&gt;
&lt;P&gt;The clarification question is:&amp;nbsp;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt;&amp;nbsp;'s solution takes the one that is the designated number of objects before the last object, that is,&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt; (entlast-i&lt;/FONT&gt; &lt;FONT color="#0000FF"&gt;&lt;EM&gt;3&lt;/EM&gt;&lt;/FONT&gt;) &lt;/STRONG&gt;finds &lt;EM&gt;the &lt;FONT color="#0000FF"&gt;3&lt;/FONT&gt;rd object before the last object&lt;/EM&gt;, that is, the &lt;FONT color="#FF0000"&gt;&lt;EM&gt;&lt;STRONG&gt;4th&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;-to-last object in the drawing.&amp;nbsp; That may be what you meant in your request, but it doesn't sound like what I would want the specified number to represent -- with mine&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt; (NL &lt;FONT color="#0000FF"&gt;&lt;EM&gt;3&lt;/EM&gt;&lt;/FONT&gt;)&lt;/STRONG&gt; &lt;/FONT&gt;finds the matching-number&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;3rd&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;-to-last object.&amp;nbsp; [It can do it the other way by changing line 11 to just&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt; (repeat qu&lt;/FONT&gt; &lt;/STRONG&gt;&lt;/FONT&gt;.]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It also checks first whether there are enough objects in the drawing to go back as far as requested, and notifies you if not in understandable terms, instead of with the cryptic&lt;FONT face="courier new,courier" color="#000000"&gt;&amp;nbsp;; error: Automation Error. Description was not provided&lt;/FONT&gt;.&lt;BR /&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2023 14:45:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entlast-deeper/m-p/12443682#M20419</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-12-15T14:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: (entlast) deeper</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entlast-deeper/m-p/12447042#M20420</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I am very glad to see that you have given attention to an error condition.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Dec 2023 22:22:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entlast-deeper/m-p/12447042#M20420</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2023-12-17T22:22:47Z</dc:date>
    </item>
  </channel>
</rss>

