多少年前编的,非常粗糙,因为几乎不用,也就没兴趣修改。
(defun c:wtext (/ fln f a n index e1 e txt) (setq fln (getstring "\n输出的文本文件名 :")) (setq f (open fln "w")) (setq a (ssget)) (setq n (sslength a)) (setq index (- n 1)) (repeat n (setq e1 (entget (ssname a index))) (setq index (- index 1)) (setq e (assoc 0 e1)) (if (= "TEXT" (cdr e)) (progn (setq txt (cdr (assoc 1 e1))) (write-line txt f) ) ) ) (close f) )