; this autolisp program copy text entity values.
Code:
(defun c:tce()
(prompt "\n Change text of selected object(s) to match entity\n")
(setq
loop
T
)
(while loop
(if
(setq
ent_to_change
(entsel "\nSelect text to change: ")
)
(progn
(setq
ent_to_change
(entget
(car ent_to_change)
)
loop
(not
(OR
(eq
(dxf 0 ent_to_change)
"TEXT"
)
(eq
(dxf 0 ent_to_change)
"MTEXT"
)
);END OR
)
)
(entupd
(dxf -1 ent_to_change)
)
)
)
(if loop
(alert "Object selected was not text")
)
)
(setq
loop
T
)
(while loop
(if
(setq
ent_to_match
(entsel "\nSelect text to match: ")
)
(progn
(setq
ent_to_match
(entget
(car ent_to_match)
)
loop
(not
(OR
(eq
(dxf 0 ent_to_match)
"TEXT"
)
(eq
(dxf 0 ent_to_change)
"MTEXT"
)
);END OR
)
)
)
)
(if loop
(alert "Object selected was not text")
)
)
(setq
text_to_change
(dxf 1 ent_to_change)
text_to_match
(dxf 1 ent_to_match)
old
(assoc 1 ent_to_change)
new
(cons 1 text_to_match)
ent_to_change
(subst new old ent_to_change)
)
(entmod ent_to_change)
(princ)
)
[ Moderator Action = ON ] What are [ CODE ] tags... [ Moderator Action = OFF ]