Plotting multiple sheets (layouts) with C#

Plotting multiple sheets (layouts) with C#

Anonymous
Not applicable
1,143 Views
1 Reply
Message 1 of 2

Plotting multiple sheets (layouts) with C#

Anonymous
Not applicable
Hello, I was hoping someone could help me out with a bug in my little macro. I created a little custom plot dialog that allows the user to select any or all layouts in a drawing, specify the number of copies, a color table, whether or not to collate them and what size paper to print them on. I had this same macro in VBA and it worked fine but since we upgraded to 2010 I decided to re-write it in C#.

Anyway, it all works great except one little hiccup. If I print a single layout tab, and I'm watching the selected printers queue, I see the print job spool up in the queue and it shoots through to the printer just fine. If I print 2 or more layouts and watch the print queue of the selected printer all the print jobs show up in the queue but the status of each print job just hangs at "Spooling". They just sit there forever until I exit AutoCAD then WHAM, they all print. I'm calling the exact same code, I'm just looping through it passing a different layout each time if there are multiple layouts selected to print.

Now I've tested this on multiple computers with multiple OS's and multiple printers all with the same result, when printing multiple layouts they hang at 'Spooling' until I exit out of AutoCAD. I'm sure it's some silly novice mistake that I'm making but I've been staring at the code so long I can't see it. I'd be happy to post the code if anyone is willing to take a look at it but I'm afraid that it's too long to post inline in the forum. Is there a recommended attachment type? I'm using VS 2008 and can post a zip of the project but maybe that's more trouble than it's worth?

Thanks in advance.
0 Likes
1,144 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
I found the problem and it was a noob issue. The sample code I used calls:

PlotEngine.BeginPage(PlotPageInfo, PlotInfo, (sheetNumber == Array.count), 1, false, "")

Which works great when plotting to a DWF or some other device that can handle multiple sheets. My plotter does not so I just needed to swap that out with:

PlotEngine.BeginPage(PlotPageInfo, PlotInfo, true, 1, false, "")

Works like a charm.
0 Likes