Dim objDoc As AutoCAD.AcadDocument
Set objDoc = Documents.Open("sample\colorwh.dwg")
Set objPlot = objDoc.Plot
Dim blnRet As Boolean
'用ACAD.EXE文件所在的路径来替换d:\Tahoe
'或者你可以使用findfile()函数来找到文件的位置
blnRet = objPlot.PlotToFile("c:\temp\temp.dwf", "d:\tahoe\plotters\DWF ePlot.pc3")
'如果打印成功则blnRet为True
objDoc.Close False
End Sub
这是一个类似的程序,略加修改应该能达到目的,好像是以前从Autodesk的网站上下载的。。。。。[br]; $Header: /web/R3/Documents/ReadMe/saveall3.lsp 61 8/04/98 12:02p Scottsh $
;
; You will be prompted for two inputs:
; 1st Prompt asks for the directory name to use
; 2nd Prompt asks for the file name (do not specify extension)
;
; This script saves the DWG first, DWF second, and then
; creates the HTML necessary for
; Viewing the DWF in a Browser (MSIE or Netscape)
;
; At times you will see an error about "Y" being an unknown command.
(defun c:SAVEALL3 ()
(setq DIR (getstring "Directory to save to: "))
(if (= DIR "")
(setq DIR "")
(setq DIR (strcat DIR "/"))
);endif
(setq FILENAME (getstring "Save DWG, DWT and HTM as: "))
(setq FILENAME_DWG (strcat DIR FILENAME ".dwg"))
(setq FILENAME_DWF (strcat DIR FILENAME ".dwf"))
(setq FILENAME_HTM (strcat DIR FILENAME ".htm"))
(setq FILED (getvar "filedia"))
(setq ECHO (getvar "cmdecho"))
(setvar "filedia" 0)
(setvar "cmdecho" 0)
(if (/= (findfile FILENAME_DWG) nil)
(progn
(if (/= (getvar "dwgname") FILENAME)
(command "_.saveas" "_r14" FILENAME_DWG "_y")
(command "_.saveas" "_r14" FILENAME_DWG)
);endif
);endprogn
(command "_.saveas" "_r14" FILENAME_DWG)
);endif
(if (/= (findfile FILENAME_DWF) nil)
(command "_dwfout" FILENAME_DWF "_y" "_b" "_m" "_y" "_y")
(command "_dwfout" FILENAME_DWF "_b" "_m" "_y" "_y")
);endif
(setq FILENAME_TEXT (getvar "dwgname"))
(setq FILE (open FILENAME_HTM "w"))
(write-line "" FILE)
(write-line "" FILE)
(write-line "AutoCAD Generated Web Page" FILE)
(write-line "" FILE)
(write-line "
" FILE)
(write-line "
DWF file referenced in HTML file
" FILE)
(write-line "
" FILE)
(write-line "This web page was generated by saveall3.lsp." FILE)
(write-line "
" FILE)
(write-line "" FILE)
(write-line "
" FILE)
(write-line "Copy and paste the HTML tags into your own web pages." FILE)
(write-line "