Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch Print ..

Status
Not open for further replies.

dciadmin

Mechanical
Jul 17, 2002
11
Hi,

I am looking to batch print files from Solidworks 6. I have seen the solutions for using Task Scheduler and have seen a couple of the freeware programs available but they don't seem to do what I am looking to do ...

I went to solidworks site and got their vb6 batch print example. It appeared to allow you to change the printer depending on papersize but it doesn't seem to work.

Basically, all I need it to do is be able to specify the printer (which I can now do) and to print to 11x17 paper no matter what the size is set at in solidworks sheet ..

Here is the code that is in the example. I have changed it to print to a specific printer for all sizes. Now I just need the code to force it to print on 11x17 paper on that printer. Does this make sense, or am I missing something?

Private Sub PrintListDraw(lstFileList As ListBox)
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc
Dim swDrwDoc As SldWorks.DrawingDoc
Dim swSheet As SldWorks.Sheet
Dim NumSheet As Long
Dim vSheetProp As Variant
Dim sModelPrinter As String
Dim nErrors As Long
Dim nWarnings As Long
Dim i As Long
Dim j As Long

' effectively disables VB's implicit QI
On Error Resume Next

Set swApp = CreateObject("SldWorks.Application")

For j = 0 To lstFileList.ListCount - 1
' filter out non-drawing files
If IsDrawingFile(lstFileList.List(j)) Then
Set swModel = swApp.OpenDoc6(lstFileList.List(j), swDocDRAWING, _
swOpenDocOptions_Silent, "", nErrors, nWarnings)
Set swDrwDoc = swModel

Debug.Print "File = " + swModel.GetPathName

' blindly go to first sheet in file
NumSheet = swDrwDoc.GetSheetCount
For i = 0 To NumSheet - 1
swDrwDoc.SheetPrevious
Next i

For i = 0 To NumSheet - 1
swDrwDoc.ForceRebuild

Set swSheet = swDrwDoc.GetCurrentSheet

vSheetProp = swSheet.GetProperties

' FIX ME! remove dependence on other form
sModelPrinter = \\server1\Xerox Document Centre 440
Debug.Print " Sheet = " + swSheet.GetName
Debug.Print " PaperSize = " + Str(vSheetProp(0))
Debug.Print " Printer = " + sModelPrinter

swModel.PrintOut2 i + 1, i + 1, 1, False, sModelPrinter, 0#, False, ""

swDrwDoc.SheetNext
Next i

swApp.QuitDoc swModel.GetPathName
End If
Next j
End Sub




 
Replies continue below

Recommended for you

Hi, dciadmin:

Set up your SW using system setting for printing. Then your SW will always print to the same size and same printer no matter what document settings are.

Alex

 
Thanks for the replies guys ...

We are just starting to use the solidworks that we purchased a few years ago. We haven't quite figured out how we want to do things yet but this is the basic idea:

-We are likely to have the files located in different directories so the batch program needs to be able to pick certain files from several locations. The grand scheme would be to be able to put the assembly file into the list and have the program automatically get all of the reference files and drawings and print them. But in the short term, I am trying to just be able to load a list of drawings into the batch print

-We want to print to 11x17 thru the batch program but would likely need to be able to change that when necessary. The code above works good (it doesn't even visibly open solidworks when it prints) but need to be able to override or set the pagesize thru the program so we don't need to set everyone's version of solidworks up the same.

I saw a program .. I think it was called swbatchprint that offers to override solidworks settings and use whatever you want, but there was no 11x17 option.

 
Hi, Dciadmin:

When you batchprint SW drawing documents, you have three choices:

1. Print all documents in a fixed size on a fixed printer;

or

2. Print all documents according to size setting saved with the documents;

or

3. You need to predetermine what size and which printer you are planning to use for each document, and code your logic (hard code or parameter) into your VB program.

If you want to control printer and paper size, you need to use ModelDoc2.PrintOut2 and PageSetup properties in SW. You can also control printer and paper size via Windows printer object. But you have to study on these two objects to how to use them.

Good Luck!

Alex

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor