Jump to content

Recommended Posts

Posted

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

Posted

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)
 )

  • Like 2
Posted

Wow, that is great.

 

Exactly what I was looking for. That is going to save me a lot of time.

 

Thanks Tharwat!

Posted
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.

  • 5 years later...
Posted
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

Posted
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.

  • Like 1

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...