Jump to content

Replace Text


viriato79

Recommended Posts

I have several text lines (by command TEXT) and I want to replace a word in all existing text lines. I´m editing one by one and replace that word manually. How can I do that automatically?

 

Thanks

Link to comment
Share on other sites

If you have to replace the same text string in each of the existing dtext entities, do a search for "chgtext.lsp". If it's mtext, you need to use find and replace.

The lsp lets you replace all instances of a text string in selected dtext with the new replacement in all instances selected.

Link to comment
Share on other sites

  • 2 years later...
easy, type FIND at the command line. from there it should be pretty self explanatory. :)

yes you were right it is to find, but i could not replace nor add same letter on each attribute on individual blocks, ex. block one has an attribute of "1", block two has "2", block three has "3" and so on, I want is to add same letter on each attribute like on block one should be "P1", block two should be "P2", block three shoulb be "P3" and so on at the same time like when you are using "find and replace".

Link to comment
Share on other sites

For example:

 

(defun c:frblk (/ ss sel)
 (vl-load-com)
 (if (setq ss (ssget '((0 . "INSERT") (66 . 1))))
   (progn
     (vlax-for Obj (setq sel (vla-get-ActiveSelectionSet
                               (vla-get-ActiveDocument
                                 (vlax-get-acad-object))))
       (foreach att (vlax-invoke Obj 'getAttributes)
         (if (vl-every
               (function
                 (lambda (x)
                   (< 47 x 58)))
               (vl-string->list
                 (vla-get-TextString att)))
           (vla-put-TextString att
             (strcat "P" (vla-get-TextString att))))))
     (vla-delete sel))
   (princ "\n** Nothing Selected **"))
 (princ))

Link to comment
Share on other sites

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