Jump to content

Recommended Posts

Posted (edited)

Bellow lisp is find & replacing multiple words with wildcard match in autocad. I need same or similar lisp searching whole word match. Anybody please help me.

 

(defun C:RT (/ adoc List$)
 (vl-load-com)
 (setq $List '(("D.F." "DF") ("MOI" "JOI")))  ; (Old$ New$)
 (setq adoc (vla-get-activedocument (vlax-get-acad-object)))
 (vlax-for lt (vla-get-layouts adoc)
   (vlax-for obj (vla-get-block lt)
     (if (eq "AcDbText" (vla-get-objectname obj))
      (mapcar '(lambda(x)
       (while (vl-string-search (car x) (vla-get-textstring obj))
         (vla-put-textstring obj
           (vl-string-subst (cadr x) (car x) (vla-get-textstring obj)))
       )
       ) $List)
     )
   )
 )
 (princ)
)

 

 

Edited by SLW210
Added Code Tags!
Posted

Please use Code Tags for your Code in the future. (<> in the editor toolbar)

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