AutoLISP将图形中文字写入外部文件
2011-03-29 16:54 精诚所至 金石为开 阅读(852) 评论(0) 编辑 收藏 举报AutoLISP将图形中文字写入外部文件,代码如下。
(defun c:test()
(setq ffn (getfiled "写出文件" "" "txt" 1))
(princ "\n选取文字……")
(setq ss (ssget))
(setq ff (open ffn "w"))
(setq i 0)
(repeat (sslength ss)
(setq ssn (ssname ss i))
(setq ssdata (entget ssn))
(setq sstyp (car (assoc 0 ssdata)))
(if (= sstyp "TEXT")
(progn
(setq txt (cdr (assoc 1 ssdata)))
(princ txt ff)
(princ "\n" ff)
)
)
(setq i (1+ i))
)
(close ff)
(princ (strcat "\n写出文件:" ffn))
(prin1)
)
代码完。
文件建立了,文字没能写入。
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240826070647288-243310440.jpg)