如果所有的文本对象都在模型空间中,你想使用李的技巧,从所有打开的DWG中获取所有对象,你可以这样做
- (defun c:txt2xl (/ fPath fName ofile doc ss)
- (vl-load-com)
- (setq fPath "C:\")
- (setq fName "test.csv")
- (if (vl-file-directory-p fPath)
- (progn
- (setq ofile (open (strcat fPath fName) "a"))
- (vlax-for doc (vla-get-Documents
- (vlax-get-Acad-Object))
- (if (setq ss (ssget "_X" '((0 . "MTEXT,TEXT"))))
- (mapcar
- (function
- (lambda (x)
- (write-line x ofile)))
- (mapcar
- (function
- (lambda (x)
- (cdr (assoc 1 (entget x)))))
- (mapcar 'cadr (ssnamex ss)))))
- (setq ss nil))
- (close ofile))
- (princ "\n<!> Filename Does not Refer to Valid Directory <!>"))
- (princ))
-
编辑:第100篇文章。。。。含糖的 |