Community
Civil 3D Forum
Welcome to Autodesk’s Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Find & Replace text in labels

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
524 Views, 2 Replies

Find & Replace text in labels

Is there a way to do a find/replace on labels with text overrides? I have some surface labels that I have added text to, TBC, FC, etc. What I would like to do is be able to replace text with functionality similar to the Find/Replace command.



Thanks in advance
2 REPLIES 2
Message 2 of 3
Sinc
in reply to: Anonymous

There's the old "human find/replace"... aka go through all your labels one by one and change them all one at a time...

This is the reason (well, one of them, anyway) why we stopped using General Labels for many things and went back to MTEXT and MLEADERs.

-- Sinc
http://www.ejsurveying.com
http://www.quuxsoft.com
Sinc
Message 3 of 3
JanardFugro
in reply to: Anonymous

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;                                       Modifed code of Justo Aguiar                                           ;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 

(defun c:FG ()
(setq WORD (GETVAR "USERS1"))
(setq OldTxt (getstring T (strcat "\nEnter the existing Text to Find:<" WORD ">"))
NewTxt (getstring T "\nEnter new Text to Replace: "))
(setq count 0)
;;(setq ss (ssget "x" '((0 . "TEXT,MTEXT"))))
(setq ss (ssget "x" (list (cons 0 "AECC_GENERAL_NOTE_LABEL"))))

(setq i (sslength ss))

(while (not (minusp (setq i (1- i))))
(setq oText (vlax-ename->vla-object (ssname ss i)))
(setq Txt (vlax-get-property oText 'LabelTextContent))

(if (vl-string-search OldTxt txt)
(progn
(setq newChg (vl-string-subst NewTxt OldTxt txt))
(vlax-put-property oText 'LabelTextContent newchg)
(vlax-invoke-method oText 'Update)
(setq count (+ count 1))
)
)
)
(prompt (strcat "(" (itoa count) ") Label(s) text Replaced"))
(princ)
)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report