<?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 Entity-list to search for layer in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entity-list-to-search-for-layer/m-p/6967948#M122030</link>
    <description>&lt;P&gt;I'm trying to get the layer of the last entity inserted in the drawing (not the current layer) and from what I understood, I need to use entget and entlast (in LISP), but I was told that Entity-List is not used to do this, and I became even more confused . Could someone help me with this problem, how to do what I need without using entity-list?&lt;/P&gt;</description>
    <pubDate>Thu, 23 Mar 2017 15:28:57 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-03-23T15:28:57Z</dc:date>
    <item>
      <title>Entity-list to search for layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entity-list-to-search-for-layer/m-p/6967948#M122030</link>
      <description>&lt;P&gt;I'm trying to get the layer of the last entity inserted in the drawing (not the current layer) and from what I understood, I need to use entget and entlast (in LISP), but I was told that Entity-List is not used to do this, and I became even more confused . Could someone help me with this problem, how to do what I need without using entity-list?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2017 15:28:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entity-list-to-search-for-layer/m-p/6967948#M122030</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-23T15:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: Entity-list to search for layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entity-list-to-search-for-layer/m-p/6967980#M122031</link>
      <description>&lt;P&gt;When you say "entity-list" do you mean "entget?" &amp;nbsp;What's wrong with your using entget? &amp;nbsp;Unless maybe you have an affection for vla-objects.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2017 15:42:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entity-list-to-search-for-layer/m-p/6967980#M122031</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2017-03-23T15:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: Entity-list to search for layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entity-list-to-search-for-layer/m-p/6968060#M122032</link>
      <description>&lt;P&gt;Yes, I referred to entget. And how do I save more than one entity in the case of more than one drawing? Would I have to put the values I get with entget into a list?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2017 16:03:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entity-list-to-search-for-layer/m-p/6968060#M122032</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-23T16:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: Entity-list to search for layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entity-list-to-search-for-layer/m-p/6968180#M122033</link>
      <description>&lt;P&gt;Computers are so fast these days that most of the time it's just as fast to extract the data anew rather than storing it in some other location. &amp;nbsp;Besides, entity names change from drawing to drawing and session to session. &amp;nbsp;BTW, the values returned by entget &lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;are&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt; in a list with dxf codes for each of the items so that you can snag exactly what property for which you are looking.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, to answer your question...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(setq layer (cdr (assoc 8 (entget (entlast)))))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now if there is some entity that you need to reference in the future, then you can get into using handles (cdr (assoc 5 (entget ...))), but where and how to store and retrieve the handle values is rather an advanced subject.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2017 16:36:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entity-list-to-search-for-layer/m-p/6968180#M122033</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2017-03-23T16:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: Entity-list to search for layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entity-list-to-search-for-layer/m-p/6968186#M122034</link>
      <description>&lt;P&gt;To get the Layer of the last thing drawn:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(cdr (assoc 8 (entget (entlast))))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You used the phrase "last entity inserted," and if by that you meant actually INSERTed [the last Block], rather than the last thing [of any kind] created in &lt;EM&gt;any&lt;/EM&gt; way, that would be a different challenge.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You mention "more than one drawing."&amp;nbsp; That's not going to be possible with AutoLisp, at least not&amp;nbsp;in a single list.&amp;nbsp; An AutoLisp routine can't work in more than one drawing at a time.&amp;nbsp; If you really want to "save more than one &lt;EM&gt;entity&lt;/EM&gt;" from more than one drawing, I think you would need to do something like WBLOCK them out, and INSERT the resulting external drawings into some common drawing afterwards.&amp;nbsp; If you really mean to save more than one [back to the beginning of Post 1]&amp;nbsp;&lt;EM&gt;Layer name&lt;/EM&gt; from the last entities in several drawings, those could be written out to a text file of some kind, and they &lt;EM&gt;could&lt;/EM&gt; be added into the &lt;EM&gt;same&lt;/EM&gt; text file from multiple drawings.&amp;nbsp; Entity names can't be handled that way&amp;nbsp;-- they may &lt;EM&gt;look&lt;/EM&gt; like text, but they're &lt;EM&gt;not&lt;/EM&gt; string objects, so even if they can be written out to a file in a textual form, when retrieved from it they would only be text strings, and would no longer&amp;nbsp;have their entity name meaning.&amp;nbsp; Besides, however unlikely, the &lt;EM&gt;same entity name&lt;/EM&gt; [or even the same&lt;EM&gt; handle&lt;/EM&gt; as &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3930636"&gt;@john.uhden&lt;/a&gt;&amp;nbsp;mentions] could occur in different drawings, representing &lt;EM&gt;different&lt;/EM&gt; entities.&amp;nbsp; And the same entity&amp;nbsp;can even&amp;nbsp;have a &lt;EM&gt;different&lt;/EM&gt; entity name [but never a different handle] when you close and get back into a drawing.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2017 16:40:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entity-list-to-search-for-layer/m-p/6968186#M122034</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2017-03-23T16:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: Entity-list to search for layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entity-list-to-search-for-layer/m-p/6968396#M122035</link>
      <description>&lt;P&gt;Maybe it would help us know what are you trying to do with that layer...&amp;nbsp;&lt;/P&gt;&lt;P&gt;As john and kent said, you can get the layer of last created object using&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(SETQ layer (CDR (ASSOC 8 (ENTGET (ENTLAST)))))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have learned that kind of stuff with a book (PDF) but its written in spanish. I attach it in case you can use it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2017 17:33:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/entity-list-to-search-for-layer/m-p/6968396#M122035</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-23T17:33:24Z</dc:date>
    </item>
  </channel>
</rss>

