Printing drawing sheets in 1 document

Printing drawing sheets in 1 document

FeelGoodGirl
Advocate Advocate
728 Views
6 Replies
Message 1 of 7

Printing drawing sheets in 1 document

FeelGoodGirl
Advocate
Advocate

Hey,

 

I am busy trying to print a documt with Ilogic. To keep it clear, I have split my goal into several steps. I am still quite new to the Ilogic world.

 

step 1: print active sheet to pdf with Ilogic
step 2: print all sheets to pdf in 1 document
Goal: to make options. That is for example:
option A printing page 1/3 and 2/3
option printing B page 1/3, 3/3 and 2/3
option printing C page 2/3 and 3/3

 

step 1: print active sheet to pdf with Ilogic

oPrintMgr = ThisApplication.ActiveDocument.PrintManager
pdfname = ThisDoc.FileName(False)
filePath = ThisDoc.Path

'printer settings
oPrintMgr.Printer = "Microsoft Print to PDF"
oPrintMgr.ColorMode = kPrintGrayScale
oPrintMgr.PrintRange=kPrintAllSheets
oPrintMgr.Orientation = kLandscapeOrientation
oPrintMgr.Scalemode = kCustomScale
oPrintMgr.ScaleMode = PrintScaleModeEnum.kPrintBestFitScale
oPrintMgr.PaperSize = kPaperSizeA3

'location pdf print
oPrintMgr.PrintToFile(filePath+"\"+pdfname+".pdf")

step 2: print all sheets to pdf in 1 document

There is where i get stuck. I only found code the let you print sings pages. So instead of having 1 document you will get 3......

 

Does anyone have maby experiece with this? I look forward to your response.

0 Likes
Accepted solutions (2)
729 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
Accepted solution

I have done this in visual studio with vb.net, but it should copy over easily to iLogic. What I do is keep track of my total sheet count (GlobalSheetCount") and use that as the upper bound for printing pages 1-x. 

 

If ThisApplication.ActiveDocument.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
Dim oDrgDoc As DrawingDocument
oDrgDoc = ThisApplication.ActiveDocument
Dim oDrgPrintMgr As DrawingPrintManager
oDrgPrintMgr = oDrgDoc.PrintManager

'Printer name
oDrgPrintMgr.Printer = "CutePDF Writer"
oDrgPrintMgr.SetSheetRange(1, GlobalSheetCount)

'Paper size, scale and orientation
oDrgPrintMgr.ScaleMode = PrintScaleModeEnum.kPrintBestFitScale
oDrgPrintMgr.PaperSize = PaperSizeEnum.kPaperSize11x17
oDrgPrintMgr.PrintRange = PrintRangeEnum.kPrintSheetRange
oDrgPrintMgr.Orientation = PrintOrientationEnum.kLandscapeOrientation
oDrgPrintMgr.SubmitPrint()
End If

 

I referenced this from the API help inside of Inventor. Hope this helps!

-Chancellor

Message 3 of 7

FeelGoodGirl
Advocate
Advocate

Thank you for your comment.

 

Unfortunately it doesn't make me any wiser. I tried to use your code, but then I no longer saw anything on my print. I also tried to adjust it. I made this of it:

 

If ThisApplication.ActiveDocument.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
Dim oDrgDoc As DrawingDocument
oDrgDoc = ThisApplication.ActiveDocument
Dim oDrgPrintMgr As DrawingPrintManager
oDrgPrintMgr = oDrgDoc.PrintManager

'Printer name
oDrgPrintMgr.Printer = "Microsoft Print to PDF"
oDrgPrintMgr.SetSheetRange(2, GlobalSheetCount)

'Paper size, scale and orientation
oDrgPrintMgr.ColorMode = kPrintGrayScale
oDrgPrintMgr.PrintRange = kPrintAllSheets
oDrgPrintMgr.Orientation = kLandscapeOrientation
oDrgPrintMgr.Scalemode = kCustomScale
oDrgPrintMgr.ScaleMode = PrintScaleModeEnum.kPrintBestFitScale
oDrgPrintMgr.PaperSize = kPaperSizeA3
oDrgPrintMgr.SubmitPrint()
End If

But now I only get 1 white page. 😞

0 Likes
Message 4 of 7

Anonymous
Not applicable

You will have to change "GlobalSheetCount" to the last number of pages you want to print(if you want 1-3 it would be 3). You could also add this:

GlobalSheetCount=ThisDrawing.Document.Sheets.Count

and put this above where it says "'Printer name" in the code. This gets the total number of sheets in the drawing document. Hopefully that gets you going.

-Chancellor

0 Likes
Message 5 of 7

FeelGoodGirl
Advocate
Advocate

Yes, that was my problem. Thank you now i can print all sheets!😀

 

Maybe you have also a idea for my step 3. If you have for example 4 sheets. But i want to print page 1, 3 and 4 in one document. To be honest I don't know where to look for it.

0 Likes
Message 6 of 7

Anonymous
Not applicable
Accepted solution

Would this work for you?

ThisDoc.Document.Sheets.Item("Sheet:2").ExcludeFromPrinting = True

To do this I think you would have to either prompt which sheet you want excluded or  have it hard coded in. Either way remember to add this back at the end so next time you print all it will catch the previously excluded page.

ThisDoc.Document.Sheets.Item("Sheet:2").ExcludeFromPrinting = False

-Chancellor 

Message 7 of 7

FeelGoodGirl
Advocate
Advocate

You are my saving angel. This works perfectly. 😀

0 Likes