GregGleason Posted April 10, 2019 Share Posted April 10, 2019 I think "entlast" doesn't do what I thought. I moved an object and the "entlast" object went to the last created object rather than the object I just moved. (setq ttt (vlax-ename->vla-object (entlast))) So I tried to go to the object directly by a region and that failed. (setq ttt (vlax-ename->vla-object (ssget "_C" '(15.3 0.58) '(15.2 0.57) '((0 . "ATTDEF"))))) What is the proper way to do this? Also, I tried to find something about "entlast" so I could learn but did not find anything useful. If someone has a link that's helpful then please let me know. Greg Quote Link to comment Share on other sites More sharing options...
dlanorh Posted April 10, 2019 Share Posted April 10, 2019 (edited) 18 minutes ago, GregGleason said: I think "entlast" doesn't do what I thought. I moved an object and the "entlast" object went to the last created object rather than the object I just moved. (setq ttt (vlax-ename->vla-object (entlast))) "Entlast" IS the last created object in the database. Quote So I tried to go to the object directly by a region and that failed. (setq ttt (vlax-ename->vla-object (ssget "_C" '(15.3 0.58) '(15.2 0.57) '((0 . "ATTDEF"))))) What is the proper way to do this? If this is an attribute in a block reference you can select it directly using the "nentsel" function. Otherwise you access it indirectly by selecting the block or iterating the block table depending on what you are trying to achieve. Edited April 10, 2019 by dlanorh Quote Link to comment Share on other sites More sharing options...
GregGleason Posted April 10, 2019 Author Share Posted April 10, 2019 Thanks dlanorh. This is the code that I wound up using: (setq ss1 (ssget "_C" '(15.3 0.58) '(15.2 0.57) '((0 . "ATTDEF")))) (setq ttt (vlax-ename->vla-object (ssname ss1 0))) It's probably not super elegant, but it worked. Quote Link to comment Share on other sites More sharing options...
ronjonp Posted April 10, 2019 Share Posted April 10, 2019 (edited) 13 hours ago, GregGleason said: Also, I tried to find something about "entlast" so I could learn but did not find anything useful. ,,, Are you serious? What about starting HERE. TheSwamp has a help file that covers most functions too. If you use the VLIDE ( which you should ) highlight the function you want to lookup, then CNTRL+SHIFT+A and you will get the help file. And of course there is just a simple Google search. HTH. Edited April 10, 2019 by ronjonp Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 10, 2019 Share Posted April 10, 2019 Nice one Ron - also this. Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted April 10, 2019 Share Posted April 10, 2019 (edited) I don't believe that (entlast) returns last created entity... It's some kind of bug, but not explained through documentation... It may return last entity, but not always... [EDIT : (entlast) returns always last created object - not entity as function name states...] Look here : http://www.theswamp.org/index.php?topic=53819.0 And also there is this topic with similar symptom : https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-entsel/m-p/8565775#M380396 For first link, you have to be logged to be able to download attachments relevant to the topic... HTH., M.R. Edited April 10, 2019 by marko_ribar Quote Link to comment Share on other sites More sharing options...
GregGleason Posted April 12, 2019 Author Share Posted April 12, 2019 On 4/10/2019 at 8:55 AM, ronjonp said: Are you serious? What about starting HERE. TheSwamp has a help file that covers most functions too. If you use the VLIDE ( which you should ) highlight the function you want to lookup, then CNTRL+SHIFT+A and you will get the help file. And of course there is just a simple Google search. HTH. Thanks ronjonp for the extra information. I should have also said that I did find the other the Autodesk info (poor Google Fu on my part) so that I began to get the idea. The other resources you provided I will look into and start doing homework. I appreciate the time you took to educate me, and I don't take that for granted, so "thank you" again for pointing me in the direction and the additional resources where I can educate myself. Greg Quote Link to comment Share on other sites More sharing options...
GregGleason Posted April 12, 2019 Author Share Posted April 12, 2019 On 4/10/2019 at 11:36 AM, Lee Mac said: Nice one Ron - also this. Well that's very helpful! Thanks Lee! Quote Link to comment Share on other sites More sharing options...
GregGleason Posted April 12, 2019 Author Share Posted April 12, 2019 On 4/10/2019 at 12:20 PM, marko_ribar said: I don't believe that (entlast) returns last created entity... It's some kind of bug, but not explained through documentation... It may return last entity, but not always... [EDIT : (entlast) returns always last created object - not entity as function name states...] Look here : http://www.theswamp.org/index.php?topic=53819.0 And also there is this topic with similar symptom : https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-entsel/m-p/8565775#M380396 For first link, you have to be logged to be able to download attachments relevant to the topic... HTH., M.R. Interesting. Thanks for the heads up marko_ribar on the potential issues. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.