- ;;;;;;;分解法取多行文字
- (defun c:text()
- (setq f (open "C:/aaa.txt" "w"))
- (setq e (ssget "X" '((0 . "MTEXT"))))
- (setq n (sslength e) m 0 strb '())
- (repeat n
- (setq e1 (ssname e m) m (1+ m) d1 nil d2 nil)
- (setq e2 (entget e1))
- (setq p (cdr(assoc 10 e2)));;;左上角坐标
- (setq d1 (cdr(assoc 42 e2)));;;宽度
- (setq d2 (cdr(assoc 43 e2)));;;高度
- (setq p1 (polar p 4.71238898 d2))
- (setq p2 (polar p 0.0 d1))
- (command "_.explode" e1)
- (setq s (ssget "c" p1 p2 '((0 . "TEXT"))))
- (setq nn (sslength s) mm 0 hh '())
- (repeat nn
- (setq s1 (entget(ssname s mm)) mm (1+ mm))
- (setq h1 (cdr(assoc 1 s1)))
- (setq hh (cons (list h1) hh))
- )
- (setq str "")
- (foreach z hh
- (setq str (strcat str (car z)))
- )
- (setq strb (cons (list str) strb))
- (command "_.undo" 1)
- );;;;;;end n
- (foreach z strb
- (setq pp (car z))
- (write-line pp f)
- )
- (close f)
- )
|