批量清洗。
嗨,我有一些代码,我想批量清除图形,使用doslib函数。它不起作用,中途停了下来。我想可能还有更多
不止一个错误。有人能修一下吗?
ps我想保留doslib函数谢谢
(defun c:BatchPurge
(/ UserFile UserCatDirPath FileList File#1 DwgName FileName)
(vl-load-com)
(setq DirPathdefault (getvar "dwgprefix"));Current folder
(setq DirPath (dos_getdir "Browse for a Drawing folder"
DirPathdefault "Select a folder to clean drawing files")
)
(if (= DirPath nil)
(exit)
(setq DwgLst (vl-directory-files DirPath "*.dwg" 1));list of drawings in folder
);if
;Create list of all *.dwg files in selected Directory
(setq DwgtoCleanLst(dos_multilist "Select Files" "Select which Drawings to purge." DwgLst));list of drawings selected
(setq File#1 (open "c:/Documents and Settings//rxbeeto0//BatchClean.scr" "w"))
;; open/make a scriptfile to write to
(foreach DwgName DwgtoCleanLst
(setq FileName (strcat "\"" DirPathdefault "\\" DwgName "\""))
(princ "open\n" FileName)
(princ (strcat FileName "\n") FileName)
(princ "purge\n" File#1)
(princ "all\n\n" File#1)
(princ "_.qsave\n" FileName)
(princ "_.close\n" FileName)
)
(close FileName)
(command "script" "C:\\Documents and Settings\\rxbeeto0\\BatchClean.scr")
(princ)
);defun 谢谢-但它仍然不起作用。 我知道你想坚持doslib,但我没有。。这是我第一次开始编写代码时收集的东西(我对“丑陋”的免责声明)。它很适合我很多年。
(defun c:批(/$value choice dir dwglist file fn fno id sel w x)(if(and(setq dir(getfield“Select A Drawing file”(getvar“dwgprefix)”dwg))(setq dir(vl filename dir))(setq dwglist(mapcar)(lambda(x)(strcase(strcat dir’\\”x)t))(vl directory files dir“*.dwg”)(setq dwglist(vl sort dwglist) 嘿,谢谢Ronjonp分享那段有趣的代码。它工作得很好。
然而,我仍然希望使我的代码与doslib函数一起工作。
有什么想法吗?
页:
[1]