;;; Export Text ;;; (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: 100015.1632@CompuServe.com ;;; ;;; This program is copyrighted. It may be distributed freely however. ;;; ;;; Benefit: ;;; This file implements an AutoCAD command to export selected text to a ;;; text file. ;;; ;;; Usage: ;;; Load this file with AutoCAD's APPLOAD command. ;;; Enter EXPORT-TEXT. ;;; Select the text entities to export. ;;; Choose the output file. ;;; Done. ;;; ;;; Restrictions: ;;; Select the text to export by clicking. Using crossing or windowing ;;; may result in an unwanted text sequence. ;;; (defun c:export-text (/ dxf ss fname fhandle index ent) (defun dxf (tag obj) (cdr (assoc tag obj))) (cond ((not (setq ss (ssget))) (princ "Nothing selected")) ((not (setq fname (getfiled "Output file" (strcat (getvar "DWGNAME") ".TXT") "TXT" 7 ) ) ) (princ "No file selected") ) ((not (setq fhandle (open fname "w"))) (princ "File open error") ) (T (setq index 0.0) (repeat (sslength ss) (cond ((not (= (dxf 0 (setq ent (entget (ssname ss index)))) "TEXT") ) (princ "Non-text ignored") ) (T (princ (dxf 1 ent) fhandle) (princ "\n" fhandle)) ) (setq index (1+ index)) ) (close fhandle) ) ) (princ) )