broncos15 Posted April 21, 2016 Posted April 21, 2016 I had a question in regards to how to properly format ssget (I am using Lee's special LM:ssget function just so that I can add in text) when I use list and cons. I have looked at afralisp's tutorial, and I tried to apply it, but it isn't working properly. My code is (setq ss (LM:ssget "\nSelect destination object(s): " '(((list (cons 0 ent0)))) ) ) Where ent0 is: (setq ent0 (assoc 0 (entget (car ent)))) Quote
broncos15 Posted April 21, 2016 Author Posted April 21, 2016 Lee's function can be found here: http://www.cadtutor.net/forum/showthread.php?94586-A-wrapper-for-ssget-function. Quote
ymg3 Posted April 21, 2016 Posted April 21, 2016 broncos, What is the value of ent ? If it is an ENAME you should use: (setq ent0 (assoc 0 (entget ent))) With the above the value of ent0 will be: (0 . "typeofentity") means you don't need to do a cons So using the wrapper: (setq ss (LM:ssget "\nSelect destination object(s): " (list (list ent0)))) Quote
broncos15 Posted April 21, 2016 Author Posted April 21, 2016 broncos, What is the value of ent ? If it is an ENAME you should use: (setq ent0 (assoc 0 (entget ent))) With the above the value of ent0 will be: (0 . "typeofentity") means you don't need to do a cons So using the wrapper: (setq ss (LM:ssget "\nSelect destination object(s): " (list (list ent0)))) Ah, that makes sense. Thanks, I am now able to select things, now it's just debugging the rest of the code haha. Quote
ymg3 Posted April 22, 2016 Posted April 22, 2016 Broncos15, You are Welcome!! May I suggest that you keep variable name like ent0 or ent to represent ENAME. In your case maybe filter or flt would probably be a better choice of name. ymg Quote
broncos15 Posted April 22, 2016 Author Posted April 22, 2016 Broncos15, You are Welcome!! May I suggest that you keep variable name like ent0 or ent to represent ENAME. In your case maybe filter or flt would probably be a better choice of name. ymg Thanks ymg3, I'll start incorporating that coding practice into my LISPs. I had a quick question on why I have to use 2 different list functions. I understand why I need to use the first one, but I can't figure out why I need the second one. Quote
ymg3 Posted April 22, 2016 Posted April 22, 2016 (edited) broncos, For your question, you need it because nothing gets evaluated inside the quote list for example: '((list ent0)) will return ((LIST ENT0)) So replacing the quote with list you get : (list (list ent0)) ---> (((0 . "ELLIPSE"))) The wrapper function is expecting a list of list as an argument. First item in that list can be scope of search for example "_X" followed by the filter clause. But filter must be list of list. So you end up with something like this: (lm:ssget "\n Your message: " (list "_X" (list ent0))) ymg Edited April 22, 2016 by ymg3 Quote
broncos15 Posted April 22, 2016 Author Posted April 22, 2016 broncos, For your question, you need it because nothing gets evaluated inside the quote list for example: '((list ent0)) will return ((LIST ENT0)) So replacing the quote with list you get : (list (list ent0)) ---> (((0 . "ELLIPSE"))) The wrapper function is expecting a list of list as an argument. ymg Thanks ymg! That was very useful. I'm always trying to learn more about LISP programming so I really appreciate the explanation. Quote
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.