
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I received this little routine to change a specified text string with a new text string.
However, it is case-sensitive and I have many dwgs where users may have typed differently: some all uppercase, others mixing uppercase and lowercase.
How may I modify this routine so it finds "OLDTEXT", not only in uppercase, but also lowercase, or even a mix of both?
Basically, how do I turn off case-sensitivity as it searches for "OLDTEXT" so it can gather all case forms of that string and then changed them to "NEWTEXT"? Of course, I do not want "NEWTEXT" to follow the case format of the original "OLDTEXT", but rather use whatever is entered in the code of the routine.
Here is the routine as I have it now:
(defun c:chgtext (/ tss tdata)
(setq tss (ssget "X" (list (cons 1 "OLDTEXT"))))
(repeat (sslength tss)
(setq
tdata (entget (ssname tss 0))
tdata (subst (cons 1 "NEWTEXT") (assoc 1 tdata) tdata)
); end setq
(entmod tdata)
(ssdel (ssname tss1 0) tss1)
); end repeat
)
Thanks for your help.
Solved! Go to Solution.