Hello
I've this code for more than 15 years now. I think its time for more enhancements.
Can one of the gurus please..
1. Make it work for attributes too.
2. For TxtChg - when a window selection is made the "line by line"
is not in order (random). Let it sort correctly. Select the top or first line
first then go down. Make selection in proper order. from top to bottom,
left to right, etc.
; TxtChg - Replace selected text lines with new text, line by line
;
; TxtChgAll - Replace all selected text lines with one new text line
;
(defun gtext ()
(setq c 0 co 0 ss (ssget) ssl (sslength ss))(print)
)
;
(defun stng ()
(if ss
(progn
(while (setq en (ssname ss c))
(setq el (entget en))
(setq ty (cdr (assoc 0 el)))
(setq el1 (cdr (assoc 1 el)))
(if (= ty "TEXT")
(progn
(if rl
(progn
(redraw en 3)
(princ (strcat" <" el1 "> "))
(setq nt (getstring 1 "\n New text: "))
(if (= nt "") (setq nt el1))
)
)
(setq el (subst (cons 1 nt) (assoc 1 el) el))
(entmod el)
(setq co (1+ co))
(if rl (setq nt ""))
)
)
(setq c (1+ c)) ;else next entity
) ;while
)
)
(princ co) (princ " lines changed ")
(if (null rl)
(princ (strcat "to " (chr 34) nt (chr 34)))
)
)
;
(defun c:TxtChgeAll (/ c co ss nt en ty el)
(gtext)
(setq rl nil nt (getstring 1 "\nNew text: "))
(if (not (= nt "")) (stng))
(princ)
)
;
(defun c:TxtChg (/ rl c co ss nt en ty el)
(setq rl 1) (gtext) (stng) (princ)
)