So, I've found several codes that are close to what I'm looking for, but not close enough. I don't have the knowledge to edit a LISP to fit my needs, so I need help.
My company has a Predefined Find and Replace command for attributes, which i would like to expand upon to Find and Replace Text, and Mtext within a drawing. also perhaps Text and Mtext within blocks. What my company has so far is this:
(defun c:FAR ()
(vl-load-com)
(defun attreplace (old new / aval)
(vlax-for n
(vla-get-blocks
(vla-get-activedocument
(vlax-get-acad-object)))
(vlax-for m n
(if (and (= "AcDbBlockReference" (vla-get-objectname m))
(= :vlax-true (vla-get-hasattributes m)))
(foreach a
(vlax-invoke m 'getattributes)
(setq aval (vla-get-textstring a))
(while (vl-string-search old aval) ;;<- look for string
(setq aval (vl-string-subst new old aval )) ;;<-replace here
)
(vla-put-textstring a aval)
)
))
))
(attreplace "TECHNOLOGIES" "TECH")
(attreplace "COMMUNICATION COMPONENTS INC." "COMM COMPONENTS")
(attreplace "DUAL BAND" "DB")
(attreplace "Remote Radio Head" "Rem Radio Hd")
(attreplace "Other - With RF" "Other-W/ RF")
(attreplace "Other - Without RF" "Other-W/O RF")
(attreplace "SAMSUNG TELECOMMUNICATIONS" "SAMSUNG TELECOM")
(attreplace "COMMUNICATIONS" "COMM")
(attreplace "COMMUNICATION" "COMM")
(attreplace "TECHNOLOGY" "TECH")
(attreplace "FULL BAND" "FB")
(attreplace "MASTHEAD" "MSTHD")
(attreplace "DUAL DUPLEX" "DD")
(princ)
)
The obvious list of things to change and what to change them to i LOVE. Makes it easy on any of us to add a new thing we find along the way that needs updated text wise. But, as you can see this only works for attributes. Is there a way to edit this to also find mtext and text, within or not within a block? Would i need separate lists for each type of text i was changing? Or can i have one easy to read/change list of things to find and replace that goes for all types of text?
Keep in mind these will not be complete text entities. everything will be stuff found within a larger note
(EX. (134'-0" S.S. TOWER) would need changed to (134'-0" SS TOWER) so id be looking jsut to change S.S. to SS)
Thanks in advance to anyone who is able to help me out.