Jay,
This is one that we use for Dtext. I don't know where we got it or who wrote it.
Code:
(defun c:CONTXT (/ uecho fht ent ins alignx alignp)
(setq uecho (getvar "cmdecho"))
(setvar "cmdecho" 0)
(and
(setq ent (entsel "\nLast line of text: "))
(setq ent (entget (car ent)))
(= (*dxf* 0 ent) "TEXT")
(or (/= (*dxf* '72 ent) 3)
(prompt "\nDoesn't work on ALIGNED text.")
)
(or (/= (*dxf* '72 ent) 5)
(prompt "\nDoesn't work on FIT text.")
)
(progn
(setq ins (*dxf* 10 ent)
fht (/= 0.0 (*dxf* 40 (tblsearch "STYLE" (*dxf* 7 ent))))
)
(if (/= (*dxf* 8 ent) (getvar "clayer"))
(command ".layer" "s" (*dxf* 8 ent) "")
)
(if (or (setq alignx (*dxf* (*dxf* 72 ent) '((1 . "c") (2 . "r") (4 . "m"))))
(setq alignp (*dxf* (*dxf* 73 ent) '((1 . "b") (2 . "m") (3 . "t"))))
)
(setq ins (*dxf* 11 ent))
)
(if (not alignx)
(setq alignx "l")
)
(if alignp
(setq alignx (strcat alignp alignx))
)
(command ".text" "s" (*dxf* 7 ent))
(if (/= alignx "l")
(command alignx)
)
(command ins)
(if (not fht)
(command (*dxf* 40 ent))
)
(command (angtos (*dxf* 50 ent)) " ")
(prompt "\nNew text: ")
(command ".dtext" "")
)
)
(setvar "cmdecho" uecho)
(princ)
)
Hope this helps,