(defun c:textjoin ()
(setq a (ssget))
(setq b (sslength a ))
(setq d 1)
(setq a1 (ssname a 0))
(setq a2 (entget a1))
(setq a3 (cdr (assoc 1 a2)))
(setq x4 a3)
(repeat (- b 1)
(setq x1 (ssname a d))
(setq x2 (entget x1))
(entdel x1)
(setq x3 (cdr (assoc 1 x2)))
(setq k (cdr (assoc 0 x2)))
(if (= k "TEXT")
(setq x4 (strcat x4 x3))
)
(setq d (+ d 1))
)
(setq f (subst (cons 1 x4 ) (cons 1 a3) a2 ))
(entmod f)
(princ)
)