rsdonna Posted May 2, 2017 Posted May 2, 2017 Hi everyone. So I need to add text to the end of multiple mtext objects. All the content in the mtext objects are different but I need there to be "p" at the end of everything. I can't do a find and replace because I end up getting the "p" multiple times in the mtext object. I've been selecting all the mtext objects and then going into properties, clicking on content and then it cycles through all the mtext and I edit each one that way but I have a lot of drawings and every drawing has about 70 mtext objects that I to edit. Anyone have any ideas? Thanks in advance Quote
Tharwat Posted May 2, 2017 Posted May 2, 2017 Hi, Something along these codes? (defun c:Test ( / ss in en st) (if (setq ss (ssget "_:L" '((0 . "MTEXT")))) (repeat (setq in (sslength ss)) (setq en (entget (ssname ss (setq in (1- in)))) st (assoc 1 en)) (entmod (subst (cons 1 (strcat (cdr st) "p")) st en)) ) ) (princ) ) 2 Quote
rsdonna Posted May 2, 2017 Author Posted May 2, 2017 Wow, that is great. Exactly what I was looking for. That is going to save me a lot of time. Thanks Tharwat! Quote
Tharwat Posted May 2, 2017 Posted May 2, 2017 Wow, that is great. Exactly what I was looking for. That is going to save me a lot of time. Thanks Tharwat! You are most welcome. Quote
arif_wdtm11 Posted January 11, 2023 Posted January 11, 2023 On 5/2/2017 at 11:19 PM, Tharwat said: Hi, Something along these codes? (defun c:Test ( / ss in en st) (if (setq ss (ssget "_:L" '((0 . "MTEXT")))) (repeat (setq in (sslength ss)) (setq en (entget (ssname ss (setq in (1- in)))) st (assoc 1 en)) (entmod (subst (cons 1 (strcat (cdr st) "p")) st en)) ) ) (princ) ) how do you apply this into autoCAD, is there a step of guidance or tutorials, thanks Quote
Steven P Posted January 11, 2023 Posted January 11, 2023 11 hours ago, arif_wdtm11 said: how do you apply this into autoCAD, is there a step of guidance or tutorials, thanks This is fairly comprehensive: http://www.lee-mac.com/runlisp.html Quote
Tharwat Posted January 11, 2023 Posted January 11, 2023 15 hours ago, arif_wdtm11 said: how do you apply this into autoCAD, is there a step of guidance or tutorials, thanks Copy and paste the codes in any text editor eg: NOTEPAD then save it with the extension .lsp ( eg: Test.lsp ) then from AutoCAD call the command: APPLOAD -> Select the Test.lsp file -> press LOAD -> press CLOSE. 1 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.