ZSBY555 发表于 2004-9-18 13:01:00

[LISP]求救高手,如何导出文本?

我在网上下了一个ExpText.lsp,代码如下:


(setq flnm (getstring “\nFile name:”)) <BR> (setq fn (open flnm “w”)) <BR> (setq s (ssget)) <BR> (setq n (sslength s)) <BR> (setq index ( - n 1)) <BR> (repeat n <BR>  (setq ents (entget (ssname s index))) <BR>  (setq index ( - index 1)) <BR>  (setq ent (assoc 0 ents)) <BR>  (if ( = “TEXT”(cdr ent)) <BR>    (progn <BR>      (setq txt (cdr (assoc 1 ents))) <BR>      (write-line txt fn) <BR>    ) <BR>  ) <BR> ) <BR>(close fn) <BR>) <BR>(princ “\n文本导出:EXT”)


但不能加栽,请问如何解决?还有更好的吗?<BR>

f5612140 发表于 2004-9-18 13:25:00

"               "的问题


(defun c:exptext()<BR>       (setq flnm (getstring "\nFile name:")) <BR> (setq fn (open flnm "w")) <BR> (setq s (ssget)) <BR> (setq n (sslength s)) <BR> (setq index ( - n 1)) <BR> (repeat n <BR>  (setq ents (entget (ssname s index))) <BR>  (setq index ( - index 1)) <BR>  (setq ent (assoc 0 ents)) <BR>  (if ( = "TEXT" (cdr ent)) <BR>    (progn <BR>      (setq txt (cdr (assoc 1 ents))) <BR>      (write-line txt fn) <BR>    ) <BR>  ) <BR> ) <BR>(close fn) <BR>) <BR>(princ "\n文本?出:EXT")
页: [1]
查看完整版本: [LISP]求救高手,如何导出文本?