马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- ;;; Text2MText
- ;;; (c) 1995 CR/LF GmbH, Essen/Germany
- ;;; Custom AutoCAD Programming since 1986
- ;;;
- ;;; CR/LF GmbH -----------
- ;;; Obere Fuhr 27 | CR / | |
- ;;; D-45136 Essen || / LF | |
- ;;; Tel.: ++49 201 254566 || <-------+ |
- ;;; Fax: ++49 201 256669 | -----------
- ;;; CIS: 100015,1632 -----------
- ;;; Internet: [email]100015.1632@CompuServe.com[/email]
- ;;;
- ;;; This program is copyrighted. It may be distributed freely however.
- ;;;
- ;;; Benefit:
- ;;; This file implements an AutoCAD command to combine selected text lines
- ;;; to a single mtext object.
- ;;;
- ;;; Usage:
- ;;; Load this file with AutoCAD's APPLOAD command.
- ;;; Enter TEXT2MTEXT.
- ;;; Pick the reference text. The mtext object will use this entity's
- ;;; properties including style, text height, layer a.s.o.
- ;;; Select the other text entities to append to the reference text.
- ;;; Done.
- ;;;
- ;;; Restrictions:
- ;;; Select the text to combine by clicking. Using crossing or windowing
- ;;; may result in an unwanted text sequence.
- ;;;
- (defun c:text2mtext (/ dxf ss index ent mtext)
- (defun dxf (tag obj) (cdr (assoc tag obj)))
- (cond
- ((not (setq reftext (car (entsel "Pick reference text"))))
- (princ "Nothing selected"))
- ((not (= (dxf 0 (setq reftext (entget reftext))) "TEXT"))
- (princ "Not a text"))
- ((not (setq ss (ssget)))
- (princ "Nothing selected"))
- (T
- (setq index 0.0
- mtext '((0 . "MTEXT") (100 . "AcDbEntity") (100 . "AcDbMText"))
- mtext (append mtext
- (list (assoc 8 reftext) (assoc 10 reftext)
- (assoc 7 reftext) (assoc 40 reftext)
- (cons 41 (abs (- (caar (textbox reftext))
- (caadr (textbox reftext)))))
- (cons 3 (strcat (dxf 1 reftext) "\\P"))))
- )
- (entdel (dxf -1 reftext))
- (repeat (sslength ss)
- (cond ((not
- (= (dxf 0 (setq ent (entget (ssname ss index)))) "TEXT")
- )
- (princ "Non-text ignored")
- )
- (T (setq mtext (append mtext
- (list (cons 3 (strcat (dxf 1 ent) "\\P")))))
- (entdel (dxf -1 ent))
- )
- )
- (setq index (1+ index))
- )
- (entmake (append mtext '((1 . " "))))
- )
- )
- (princ)
- )
|