;;输出图面文字到文件
(defun c:SaveTextToFile	(/ d ents file path ss txt)
  (setq ss (ssget '((0 . "*text"))))
  (or ss (fsxm-silenceexit))
  (setq path "c:\\text.txt")
  (setq file (open Path "w"))
  (setq ents (reverse (fsxm-ss->enlist ss)))
  (foreach ent ents
    (setq d (entget ent))
    (setq txt (fsxm-getdxf 1 d))
    (if	(= (fsxm-getdxf 0 d) "MTEXT")
      (setq txt (fsxm-mstr2str txt))
    )
    (write-line txt file)
  )
  (close file)
  (fstl_open path)
)