(defun c:txt2att (/ ss i en ed)
(while (not ss)
(princ "\nSelect TEXT to Convert to ATTDEF: ")
(setq ss (ssget (list (cons 0 "TEXT")
(if (getvar "CTAB")
(cons 410 (getvar "CTAB"))
(cons 67 (- 1 (getvar "TILEMODE"))))))))

(setq i (sslength ss))
(while (not (minusp (setq i (1- i))))
(setq en (ssname ss i)
ed (entget en))
(if (wcmatch (cdr (assoc 1 ed)) "* *")
(alert "\nString Contains Spaces - Try Again...")
(progn
(entmake (list (cons 0 "ATTDEF")
(assoc 8 ed)
(assoc 10 ed)
(assoc 11 ed)
(assoc 7 ed)
(assoc 40 ed)
(assoc 41 ed)
(assoc 50 ed)
(assoc 51 ed)
(cons 70 0)
(assoc 71 ed)
(assoc 72 ed)
(cons 74 (cdr (assoc 73 ed)))
(assoc 210 ed)
(cons 1 "")
(cons 2 (cdr (assoc 1 ed)))
(cons 3 (cdr (assoc 1 ed)))
(if (assoc 6 ed) (assoc 6 ed)'(6 . "BYLAYER"))
(if (assoc 39 ed) (assoc 39 ed)'(39 . 0))
(if (assoc 62 ed) (assoc 62 ed)'(62 . 256))))
(entdel en))))
(redraw)
(prin1))
(c:txt2att)

Advertisements