plotting problem

plotting problem

Anonymous
Not applicable
1,221 Views
6 Replies
Message 1 of 7

plotting problem

Anonymous
Not applicable
I need to plot several viewport that are on the same layout.

I created my code from exemple I found here (where people wanted to print several drawing contained in different files).

I can get the first page/viewport to print but when the second one starts, I always get the following error message:

eBackgroundPlotInProgress

what can I do to wait until the plotting is done before starting the second sheet. Can I bring the print process foreground?

I also noticed that I take a lot more time to print a sheet then I usually do when I print it manually, is this normal?

thank for your help

Louis

here is the code I have so far
Private Function plot1Parcellaire(ByVal window As Autodesk.AutoCAD.DatabaseServices.Extents2d) As Integer

Dim errStatus As Integer = 0

Dim Acad As Autodesk.AutoCAD.Interop.AcadApplication = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication
'Change over to MDI mode to plot, then return to existing setting
Dim origSDI As Boolean = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication.Preferences.System.SingleDocumentMode
Dim plotInfo As PlotInfo = New PlotInfo()
Dim plotEngine As PlotEngine = PlotFactory.CreatePublishEngine()
Dim plotDialog As PlotProgressDialog = New PlotProgressDialog(False, 1, False)
Dim plotSet As PlotSettings = New PlotSettings(True)
Dim piValidator As PlotInfoValidator = New PlotInfoValidator()

Try

Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication.Preferences.System.SingleDocumentMode = False

Dim curDoc As Autodesk.AutoCAD.ApplicationServices.Document

curDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument

plotInfo.Layout = LayoutManager.Current.GetLayoutId("Parcellaire")
piValidator.Validate(plotInfo)
plotSet = plotInfo.ValidatedSettings

Dim psValidator As PlotSettingsValidator = PlotSettingsValidator.Current()
psValidator.SetPlotWindowArea(plotSet, window)
psValidator = Nothing

plotInfo.OverrideSettings = plotSet

piValidator.Validate(plotInfo)

If plotEngine IsNot Nothing Then
plotDialog.IsVisible = True
plotDialog.OnBeginPlot()


plotEngine.BeginPlot(plotDialog, Nothing)
plotEngine.BeginDocument(plotInfo, curDoc.Name, Nothing, 1, False, Nothing)

curDoc.LockDocument()

Dim pageInfo As PlotPageInfo = New PlotPageInfo()

plotDialog.OnBeginSheet()

plotEngine.BeginPage(pageInfo, plotInfo, True, Nothing)

plotEngine.BeginGenerateGraphics(Nothing)
plotEngine.EndGenerateGraphics(Nothing)
plotEngine.EndPage(Nothing)
plotDialog.OnEndSheet()

plotEngine.EndDocument(Nothing)
plotEngine.EndPlot(Nothing)

plotDialog.OnEndPlot()
End If

errStatus = 0

Catch ex As Autodesk.AutoCAD.Runtime.Exception
MsgBox("Message d'erreur: " & ex.Message & vbNewLine & ex.ToString)
errStatus = 1
Finally
Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication.Preferences.System.SingleDocumentMode = origSDI
Acad = Nothing
plotSet.Dispose()
plotInfo.Dispose()
plotDialog.Dispose()
plotEngine.Dispose()

piValidator.Dispose()

End Try

Return errStatus

End Function
0 Likes
1,222 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
I found a solution. I added this in the loop of the function who called the printing function

While (PlotFactory.ProcessPlotState = ProcessPlotState.BackgroundPlotting) Or (PlotFactory.ProcessPlotState = ProcessPlotState.ForegroundPlotting)
Thread.Sleep(1)
End While


I still have a problem. the printing process is very very slow. It take about twice the time to print a single sheet compared to printing it manually.
0 Likes
Message 3 of 7

Anonymous
Not applicable
Maybe try it with turning background plotting off. This is how I did it in
my batch plotting routine, and it seems to be about the same speed as
plotting is normally.

AcadApp.SetSystemVariable("BackGroundPlot", 0);

--

Tim
"A blind man lets nothing block his vision."


wrote in message news:[email protected]...
I found a solution. I added this in the loop of the function who called the
printing function

While (PlotFactory.ProcessPlotState =
ProcessPlotState.BackgroundPlotting) Or (PlotFactory.ProcessPlotState =
ProcessPlotState.ForegroundPlotting)
Thread.Sleep(1)
End While


I still have a problem. the printing process is very very slow. It take
about twice the time to print a single sheet compared to printing it
manually.
0 Likes
Message 4 of 7

Anonymous
Not applicable
thank you

it solved my problem

I didn't knew how to change the setting

Louis
0 Likes
Message 5 of 7

Anonymous
Not applicable
You're welcome Louis.

--

Tim
"A blind man lets nothing block his vision."


wrote in message news:[email protected]...
thank you

it solved my problem

I didn't knew how to change the setting

Louis
0 Likes
Message 6 of 7

Anonymous
Not applicable
Can you post the entire working code. I have also been trying to do this.

Regards,
sudarshan
0 Likes
Message 7 of 7

Anonymous
Not applicable
just add

Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("BackGroundPlot", 0)


at the beginning of the code and it will work
0 Likes