Message 1 of 7
plotting problem
Not applicable
10-10-2007
08:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
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