pateksan Posted March 16, 2018 Share Posted March 16, 2018 Hello, I've had a great response to my first post here so I hope I will find some understanding this time too. My drawing has 66 layouts created from an incorrect template, and each has lots of Text objects I need to delete. As before, I have very limited time for troubleshooting, so I'm hoping someone can help out. Based on several other threads, which all had some aspect similar to what I need, I came to this one-liner: (entdel (car (sssetfirst nil (ssget "_X" '((1 . "TQ00E")))))) which produces error : bad argument type <NIL> ; expected ENTITYNAME at [entdel] I am hoping this is because sssetfirst returns multiple entities and entdel needs one at a time - if that is the case, I know what's wrong, and just don't have the time to learn how to make a loop. If it helps, the Text objects contain specific, known strings like TQ00E above - there is nothing else in an individual Text entity. I am resigned to replacing all these texts with spaces using Find and replace, but that's bad practice so I'm hoping someone can correct my code. Naturally I don't mind if I get dirty, non-optimal multi-line code. Thanks in advance! Quote Link to comment Share on other sites More sharing options...
rlx Posted March 16, 2018 Share Posted March 16, 2018 probably something like (if (setq ss (ssget "x" '((1 . "TQ00E"))))(command "erase" ss "")) Quote Link to comment Share on other sites More sharing options...
pateksan Posted March 16, 2018 Author Share Posted March 16, 2018 probably something like (if (setq ss (ssget "x" '((1 . "TQ00E"))))(command "erase" ss "")) What a beauty. Have a good weekend! Quote Link to comment Share on other sites More sharing options...
rlx Posted March 16, 2018 Share Posted March 16, 2018 What a beauty. Have a good weekend! Your welcome. If you change "TQ00E" to "TQ00E," (with the comma) you delete empty texts at the same time. Have a good weekend too. gr. Rlx Quote Link to comment Share on other sites More sharing options...
pateksan Posted March 16, 2018 Author Share Posted March 16, 2018 What a beauty. Have a good weekend!Ok, I got a bit carried away, this code only works on the current layout, and I was hoping I could remove all copies of the particular Text object on all layouts. Is this easily doable? Quote Link to comment Share on other sites More sharing options...
rlx Posted March 16, 2018 Share Posted March 16, 2018 Ok, I got a bit carried away, this code only works on the current layout, and I was hoping I could remove all copies of the particular Text object on all layouts. Is this easily doable? (vl-load-com) (defun del-txt () (if (ssget "_x" '((0 . "text")(1 . "TQ00E"))) (vlax-for n (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object))) (vla-delete n)))(princ)) gr. Rlx Quote Link to comment Share on other sites More sharing options...
pateksan Posted March 18, 2018 Author Share Posted March 18, 2018 Hi, I needed to pass the drawing on so I Replaced All the relevant strings with a space. I know it's not pretty but it's not my fault I inherited a drawing with a questionable template. It's just a shame Bricscad Quick Select only works for one layout at a time. I will definitely look into this VL business though as it keeps coming up when I google my LISP problems. Thank you once again. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted March 19, 2018 Share Posted March 19, 2018 pateksan here is an example of stepping through layout tabs, normally I check for /= "model" also (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vlax-for lay (vla-get-Layouts doc) (setvar 'ctab (vla-get-name lay) ) (alert (strcat "Tab has changed to " (vla-get-name lay))) ) Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted March 19, 2018 Share Posted March 19, 2018 @pateksan: Quick Select is indeed restricted to the current space. This perfectly logical as the same applies to editing commands. 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.