[Home]
[How to Use This Code]
Lisp Code
;;;---------------------------------------------------------------------------- ;;; ;;; TXT2MTXT.LSP Version 1.0 9/30/96 ;;; ;;;---------------------------------------------------------------------------- ;;; DESCRIPTION ;;; Converts single line text to paragraph (mtext) text. ;;; Selected text is converted to paragraph text. The order that the text strings ;;; appear in the text paragraph is the same as the order that they are selected. ;;; The text style and layer of the paragraph text is the same as the FIRST text ;;; string selected. ;;; ;;; By Jay Garnett ;;; E-Mail spotter@lycosmail.com ;;; https://members.tripod.com/spotter10 ;;;---------------------------------------------------------------------------- ;;; Verifies that OBJ is single line text. (defun CHK_TXT( OBJ ) (if (/=(cdr(assoc 0(entget OBJ)))"TEXT") (progn(prompt"\Object Selected was not TEXT!")(setq OBJ nil)) OBJ ) ) ;;; Main routine (defun C:TXT2MTXT( / MT_LAY MT_STY OLD_LAY PARA TXT_OBJ U_CE WID) (setq U_CE(getvar "cmdecho")) (setvar "cmdecho" 0) (while (not TXT_OBJ) (setq TXT_OBJ(car(entsel "\nSelect first TEXT string: "))) (if TXT_OBJ(setq TXT_OBJ(Chk_Txt TXT_OBJ))) ) (setq MT_STY(cdr(assoc 7(entget TXT_OBJ))) MT_LAY(cdr(assoc 8(entget TXT_OBJ))) MT_IPT(cdr(assoc 10(entget TXT_OBJ))) ;This sets the width of the MTEXT box to 75X the text height. ;This value may need to be adjusted to suit your needs. WID(*(cdr(assoc 40(entget TXT_OBJ)))75) PARA(strcat(cdr(assoc 1 (entget TXT_OBJ)))"\\P") ) (while(setq TXT_OBJ(entsel "\nSelect next TEXT string
when finished selecting: ")) (setq TXT_OBJ(car TXT_OBJ)) (if(Chk_Txt TXT_OBJ) (setq PARA(strcat PARA(cdr(assoc 1 (entget TXT_OBJ)))"\\P")) (prompt "\Object selected was not TEXT!") ) ) (setq OLD_LAY(getvar "clayer")) (setvar "clayer" MT_LAY) (command "-MTEXT" "S" MT_STY MT_IPT "W" WID PARA "") (setvar "clayer" OLD_LAY) (prompt "\nSelect insertion point for text paragraph: ") (command ".move" "l" "" MT_IPT pause) (setvar "cmdecho" U_CE) (princ) )