Background
Our company places multiple blocks per layout (and even Model Space). These blocks represent drawing formats. It is not uncommon to have 50 sheets per layout.
8 years ago (AutoCAD 2006), I created a utility using .Net that leveraged the plotting engine to create the appropriate PostScript and used GhostScript to obtain a multi-sheet .pdf file. Note that the multi-sheet pdf file contains sheets of different sizes.
It has worked great for 6 years. The pdf files were not "Feature Rich". User complaints related to search functionality and imbedded layer information were present.
We are upgrading to AutoCAD 2013. I have spent the past 4 days upgrading that solution. Here is what I have done.
I have a solution that creates a Page Setup for each page. After these page setups are created, I am able to manually use them to create individual pdf files. I am also able to programically create individual PDF's via the PlottingServices.PlotEngine.
I have created DSD files using two methods (compiling via DsdEntryCollection, etc,and via direct text tile).
When using Application.Publisher.PublishDsd(..) method, I get an error via the publishing log
Job: - Error(s) Did Not Plot
Subsequently, (using the same DSD) I manually (publish on the command line) load the dsd file:
I select 'Replace all sheets in the list"
I then click on "Publish" and I obtain the output that I want.
Here is a segment of the "PublishDSD" code.
Sheet: Size E Sheet 1 - Plotted
Sheet: Size E Sheet 2 - Plotted
Sheet: Size E Sheet 3 - Plotted
Sheet: Size E Sheet 4 - Plotted
Does anyone have a vb example using PublishDSD?
Try WriteDSD() Dim CurrAcadDoc As Document = Application.DocumentManager.MdiActiveDocument Dim CurrAcadDB As Database = CurrAcadDoc.Database Using DSDDataFile As New DsdData Using PPD As PlotProgressDialog = New PlotProgressDialog(False, my_PresentFormats.BaseCollection.Count, True) PPD.PlotMsgString(PlotMessageIndex.DialogTitle) = "PDF Creation Progress" PPD.PlotMsgString(PlotMessageIndex.CancelJobButtonMessage) = "Cancel PDF Creation" PPD.PlotMsgString(PlotMessageIndex.CancelSheetButtonMessage) = "Cancel Sheet PDF Creation" PPD.PlotMsgString(PlotMessageIndex.SheetSetProgressCaption) = "Multi-sheet PDF Create job Progress" PPD.PlotMsgString(PlotMessageIndex.SheetProgressCaption) = "PDF Sheet Creation Progress" Dim oPublisher As Autodesk.AutoCAD.Publishing.Publisher = Autodesk.AutoCAD.ApplicationServices.Application.Publisher DSDDataFile.ReadDsd(DSDFileName) Dim strDWGName As String = CurrAcadDoc.Name Dim obj As Object = Application.GetSystemVariable("DWGTITLED") If System.Convert.ToInt16(obj) = 0 Then strDWGName = "C:\CAD Data\Drawing" & CStr(CInt(Rnd() * 1000)) & ".dwg" End If Dim PDFPlotConfig As PlotConfig = PlotConfigManager.SetCurrentConfig("DWG To PDF.pc3") CurrAcadDoc.Database.SaveAs(strDWGName, True, DwgVersion.Current, CurrAcadDoc.Database.SecurityParameters) Autodesk.AutoCAD.ApplicationServices.Application.Publisher.PublishDsd(DSDFileName, PPD) End Using 'Application.Publisher.PublishExecute(DSDDataFile, PDFPlotConfig) End Using Catch ex As System.Exception End Try
Solved! Go to Solution.
Solved by csludtke. Go to Solution.
Hi,
Here is an example on using the "PublishDsd"
If this does not help with your specific error, can you please provide a buildable sample project and the sample drawings for me to repdroduce the error message ?
I have added a simplified solution as an attachment.
I am still unable to get PublishDSD or PublishExecute to work.
I am also having trouble using the API to create a DSD file.
Please note that this is a very simplified example that depicts the behavior
You will have to create a "C:\Temp" folder for this to work
Hi Chris,
Sorry for the delay.
Following minor changes to your project were needed to get it working in AutoCAD 2013 :
1. Commented the call to "CreatePublishEngine".
'Dim oPlotEngine As Autodesk.AutoCAD.PlottingServices.PlotEngine = Autodesk.AutoCAD.PlottingServices.PlotFactory.CreatePublishEngine Dim DSD As New DrawingSheetDatabase(Me) Try DSD.WriteDSD() DSD.ExecutePublishProcess() DSD.Dispose() Catch ex As System.Exception End Try 'If Not oPlotEngine Is Nothing Then ' oPlotEngine.Destroy() ' oPlotEngine.Dispose() ' oPlotEngine = Nothing 'End If
2. Included a call to "Readdsd" before using "PublishExecute"
Public Sub ExecutePublishProcess() Try Dim CurrAcadDoc As Document = Application.DocumentManager.MdiActiveDocument Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("BACKGROUNDPLOT", 0) Using DSDDataFile As New DsdData Using PPD As PlotProgressDialog = New PlotProgressDialog(False, my_PresentFormats.BaseCollection.Count, True) PPD.PlotMsgString(PlotMessageIndex.DialogTitle) = "PDF Creation Progress" PPD.PlotMsgString(PlotMessageIndex.CancelJobButtonMessage) = "Cancel PDF Creation" PPD.PlotMsgString(PlotMessageIndex.CancelSheetButtonMessage) = "Cancel Sheet PDF Creation" PPD.PlotMsgString(PlotMessageIndex.SheetSetProgressCaption) = "Multi-sheet PDF Create job Progress" PPD.PlotMsgString(PlotMessageIndex.SheetProgressCaption) = "PDF Sheet Creation Progress" PPD.UpperPlotProgressRange = 100 PPD.LowerPlotProgressRange = 0 PPD.UpperSheetProgressRange = 100 PPD.LowerSheetProgressRange = 0 Dim oPublisher As Autodesk.AutoCAD.Publishing.Publisher = Autodesk.AutoCAD.ApplicationServices.Application.Publisher DSDDataFile.ReadDsd(DSDFileName) Dim strDWGName As String = CurrAcadDoc.Name Dim obj As Object = Application.GetSystemVariable("DWGTITLED") If System.Convert.ToInt16(obj) = 0 Then strDWGName = "C:\CAD Data\Drawing" & CStr(CInt(Rnd() * 1000)) & ".dwg" End If Dim PDFPlotConfig As PlotConfig = PlotConfigManager.SetCurrentConfig("DWG To PDF.pc3") CurrAcadDoc.Database.SaveAs(strDWGName, True, DwgVersion.Current, CurrAcadDoc.Database.SecurityParameters) oPublisher.PublishExecute(DSDDataFile, PDFPlotConfig) End Using End Using Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("BACKGROUNDPLOT", 1) Catch ex As System.Exception End Try End Sub
I have attached the modified sample project.