|
上网不小心看到的可以批量打印pdf的脚本
注意 是打印pdf 如果你没有安装能输出pdf的插件 就会有"No layout pages!"
http://www.bullzip.com/products/pdf/info.php可以下载输出pdf的东东
Option Explicit
'2009.2.15
'Script by Sanghoon Yoon @ +plastic(韩国人?)
'http://www.byRhino3d.com | http://www.rhinos.co.kr | http://sac3.blogspot.com
[email=]'sac3yoon@gmail.com[/email]
'This script let Rhino to print all layout pages as pdf files through Bullzip pdf printer.
'Download Bullzip pdf printer @ http://www.bullzip.com/products/pdf/info.php
call PrintLayoutAsPDF
Sub PrintLayoutAsPDF
Dim strSS
strSS = Rhino.GetString ("File option" , "As_one_Pdf", Array ("As_one_Pdf", "As_each_Pdf") )
If IsNull(strSS) Then Exit Sub
Select Case strSS
Case "As_one_Pdf"
SaveAsOnePdf
Case "As_each_Pdf"
SaveAsEachPdf
End Select
End Sub
Sub SaveAsEachPdf()
Dim strFile,strFolder, arrViews,fileName, strM
strM=""
strFolder = Rhino.BrowseForFolder
arrViews = Rhino.ViewNames (True ,1)
If IsNull(arrViews) Then Rhino.Print "No layout pages!" : Exit Sub
For Each fileName In arrViews
Rhino.CurrentView fileName
strFile=strFolder&fileName&".pdf"
BatchPrint strFile,strM
Rhino.Print strFile&" was created."
Next
End Sub
Sub SaveAsOnePdf()
Dim strFile,strFolder, arrViews,fileName
strFile= Rhino.SaveFileName ("Save as pdf" ,"pdf files (*.pdf)|*.pdf||" , "" , ,"pdf")
arrViews = Rhino.ViewNames (True ,1)
If IsNull(arrViews) Then Rhino.Print "No layout pages!" : Exit Sub
For Each fileName In arrViews
Rhino.CurrentView fileName
BatchPrint strFile,strFile
Next
Rhino.Print strFile&" was created."
End Sub
Function BatchPrint(strFile,strM)
Const PDF_PRINTERNAME = "Bullzip PDF Printer"
Const PRINTER_PROGID = "Bullzip.PDFPrinterSettings"
Dim prtidx, obj
'Configure the PDF print job
Set obj = CreateObject(PRINTER_PROGID)
obj.SetValue "mergefile",strM
obj.SetValue "mergeposition","bottom"
obj.SetValue "Output", strFile
obj.SetValue "ConfirmOverwrite", "no"
obj.SetValue "ShowSaveAS", "never"
obj.SetValue "ShowSettings", "never"
obj.SetValue "ShowPDF", "no"
obj.SetValue "RememberLastFileName", "no"
obj.SetValue "RememberLastFolderName", "no"
obj.WriteSettings True
Rhino.Command "-print go ",False
'Wait for runonce settings file to disappear
Dim runonce, fso
runonce = obj.GetSettingsFileName(True)
Set fso = CreateObject("Scripting.FileSystemObject")
While fso.FileExists(runonce)=True
Sleep 100
Wend
End Function
|
评分
-
查看全部评分
|