改自他人程序,我只是进行再加工而已~~~- ;程序执行:TT
- ;制作图库幻灯片
- ;将目标文件夹下的每个文件执行“清理-缩放-写出幻灯片-保存关闭”;
- (vl-load-com)
- (defun getFolder (str_title str_prompt /)
- (strcat (vl-string-right-trim "\" (strcase (acet-ui-pickdir str_prompt (vl-string-right-trim "\" "") str_title))) "\")
- )
- (defun makeDirectory (dir / )
- (vl-mkdir dir)
- )
- (defun userundo()
- (setq *error* errtmp)
- (setvar "cmdecho" old_cmdecho)
- (setvar "acadlspasdoc" old_acadlspasdoc)
- (princ)
- )
- (defun err (msg)
- (userundo)
- )
- ;主程序开始
- (defun c:TT ( / app doc docs err errtmp file files newpath old_acadlspasdoc old_cmdecho path sset)
- (setq errtmp *error*)
- (setq *error* err)
- (setq old_cmdecho (getvar "cmdecho"))
- (setvar "cmdecho" 0)
- (setq old_acadlspasdoc (getvar "acadlspasdoc"))
- (setvar "acadlspasdoc" 0)
- (setq path (getFolder "请选择目录..." "请选择目录:"))
- (setq files (vl-directory-files path "*.dwg" 1))
- (if files
- (progn
- (setq scrfile (strcat path "batpurge.scr"))
- (setq fn (open scrfile "w"))
- (foreach file files
- (setq str (strcat "open " "path file "" purge all * no Zoom E mslide " "path (vl-string-right-trim ".dwg" file)".sld" "" qsave close"))
- (write-line str fn)
- (princ)
- )
- (close fn)
- )
- (alert "所选目录无 .dwg 文件!请重新选择:")
- )
- (command "script" scrfile)
- (userundo)
- (setq *error* errtmp)
- (princ)
- )
|