我在做dwg批量转tiff程序。请教下,怎样批量读取文件呢? 我的程序为什么在当运行到第二个文件就打印取消呢?但是第一个文件是可以打印的。请斑竹帮帮我吧。 .... (if (and (setq DWG_DIR (CJW-FILE-GET "选择DWG文件夹")) ;;返回文件目录列表 (setq DWG_LST (vl-directory-files DWG_DIR "*.dwg")) ;;列出目录中所有文件 );;if 条件 (progn (foreach DWG DWG_LST (if (setq ss(ssget "X")) (command "._ERASE" ss "")) ;;炸开图块 (setq DWG (strcat DWG_DIR "\\" DWG)) (command ".-INSERT" DWG "0,0" "1" "1" "") (command "._ZOOM" "_E") (setq dwdmlist (ssget "X" '((0 . "INSERT")))) (command "_explode" dwdmlist ) (setq plotFileName(vl-filename-base DWG));;获得原图名 (DWT_TO_TIFF plotFileName);;处理打印函数 );foreach );progn );if (defun DWT_TO_TIFF(dplotfilename / AcadObject AcadDocument mSpace layers) (vl-load-com) (ssget "x") (setq AcadObject (vlax-get-acad-object) AcadDocument (vla-get-ActiveDocument Acadobject) mSpace (vla-get-ModelSpace Acaddocument) layers (vla-get-layers AcadDocument) ) (setq ActiveLayout(vla-get-ActiveLayout ACadDocument);;取得配置对象 ) ;;; 从文件对象取得布局集合 (setq layoutSel(vla-get-Layouts ACadDocument)) (setq clayout(vla-item layoutSel "Layout1")) (vla-put-standardscale ActiveLayout acscaletofit) (vla-put-centerplot ActiveLayout :vlax-true) (setq bcextmin(getvar "extmin"));;存储图形范围左下角点的值 (setq px1(car bcextmin)) (setq py1(cadr bcextmin)) (setq bcextmin(getvar "extmax")) (setq px2(car bcextmax)) (setq py2(cadr bcextmax)) (setq point1(vlax-make-safearray vlax-vbDouble '(0 . 1))) (vlax-safearray-fill point1 (list px1 py1)) (setq point2(vlax-make-safearray vlax-vbDouble '(0 . 1))) (vlax-safearray-fill point2 (list px2 py2) ) (vla-SetWindowToPlot ActiveLayout point1 point2) (vla-put-plottype ActiveLayout acWindow) (vla-Regen ACadDocument :vlax-true);;重新生成 (vla-put-plotrotation ActiveLayout ac0degrees) (vla-put-StyleSheet ActiveLayout "monochrome.ctb") (setq fileSel (vla-get-Files preferenceSel)) (vla-put-ConfigName clayout "TIFF Version 6(不压缩).pc3") (setq result (vla-PlotToFile (vla-get-Plot ACadDocument) dplotfilename)) ) |