This routine I got off this group last year, for all the wonderful things it does do, the one thing I need it too it seems to burp at. When using it on a Table It will copy (replace text) from one filed to another, but the limitation is that it will only work on the "Standard" in an unmodified "Standard" field. In other words when you use any other Text style Arial, Times New romen, etc it will simply ignore the text and do nothing, if I change all the text in the Table "Standard" it works fine, but of course this is not convienent becasue changing the Text Style will also change the formating and size of the Table and or Fields. How or what needs to be changed to get it be more "flexable". It works fine when Copying text from Dtext, Mtext and Dims. It just doesn't really like Tables that much. TIA
; ReplaceText.lsp by J.J.Damstra - Copyright ©2005.
; Replaces a selected string for another
; 21-06-05 first release
(defun c:rt (/ ch_txt ENTITY ENTITYLIST TXT_STR OBJECT pickpnt E-TYPE n)
(defun ch_txt (TXT_STR ENTITY / ENTITYLIST OLD NEW ENT)
(setq ENT (car ENTITY)
ENTITYLIST (entget ENT)
OLD (assoc 1 ENTITYLIST)
NEW (cons 1 TXT_STR)
ENTITYLIST (subst NEW OLD ENTITYLIST))
(entmod ENTITYLIST)
(entupd ENT)
)
(command ".undo" "begin")
(setq ENTITY (nentsel "\nSelect source text: ")
ENTITYLIST (entget (car ENTITY))
TXT_STR (cdr (assoc 1 ENTITYLIST)))
(while (setq ENTITY (nentsel "\nSelect text to change: ")) ; NIL > WEND
(if (> (length ENTITY) 3) ; insert/dimension/table
(progn
(setq OBJECT (car (last ENTITY))
ENTITYLIST (entget OBJECT)
pickpnt (cadr ENTITY)
E-TYPE (cdr (assoc 0 ENTITYLIST)))
(cond
((= E-TYPE "INSERT")
(ch_txt TXT_STR ENTITY)
)
((= E-TYPE "DIMENSION")
(command ".dim1" "newtext" TXT_STR OBJECT "")
)
((= E-TYPE "ACAD_TABLE")
(command ".tabledit" pickpnt "@#@")
(setq ENTITYLIST (entget OBJECT))
(foreach n ENTITYLIST
(if (eq (car n) 1)
(if (eq (substr (cdr n) 1 3) "@#@")
(entmod (subst (cons 1 TXT_STR) n ENTITYLIST))
)
)
)
)
)
(entupd OBJECT)
)
; else
(ch_txt TXT_STR ENTITY) ; text/mtext/attribute
)
)
(command ".undo" "end")
(princ)
)
<code tags added>