.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Issues with PublishDSD

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
csludtke
1584 Views, 6 Replies

Issues with PublishDSD

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


Job ID: 1
Sheet set name: SheetSetName Set for DWG No 2219679 : 4 Sheets - Publish via ACAD pdf
Date and time started: 8/13/2013 3:05:58 PM
Date and time completed: 8/13/2013 3:05:59 PM
UserID: csludtke
Profile ID: <<ACADMPP>>
Total sheets: 0
Sheets plotted: 0
Number of errors: 0
Number of warnings: 0

ERROR: Error

 

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


File: C:\temp\test3.dwg
Category name:
Page setup: BATC FS PDF SH 01
Device name: DWG To PDF.pc3 - plotted to file
Plot file path: C:\temp\test3.pdf
Paper size: ANSI E (44.0 x 34.00 Inches)

 

Sheet: Size E Sheet 2 - Plotted


File: C:\temp\test3.dwg
Category name:
Page setup: BATC FS PDF SH 02
Device name: DWG To PDF.pc3 - plotted to file
Plot file path: C:\temp\test3.pdf
Paper size: ANSI E (44.0 x 34.00 Inches)

 

Sheet: Size E Sheet 3 - Plotted


File: C:\temp\test3.dwg
Category name:
Page setup: BATC FS PDF SH 03
Device name: DWG To PDF.pc3 - plotted to file
Plot file path: C:\temp\test3.pdf
Paper size: ANSI E (44.0 x 34.00 Inches)

 

Sheet: Size E Sheet 4 - Plotted


File: C:\temp\test3.dwg
Category name:
Page setup: BATC FS PDF SH 04
Device name: DWG To PDF.pc3 - plotted to file
Plot file path: C:\temp\test3.pdf
Paper size: ANSI E (44.0 x 34.00 Inches)

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

 

 

 

 

6 REPLIES 6
Message 2 of 7
csludtke
in reply to: csludtke

Added DSD File

Tags (1)
Message 3 of 7
csludtke
in reply to: csludtke

 

 

 

After Publish Command

Tags (1)
Message 4 of 7
Balaji_Ram
in reply to: csludtke

Hi,

 

Here is an example on using the "PublishDsd"

 

http://adndevblog.typepad.com/autocad/2012/05/how-to-use-the-autodeskautocadpublishingpublisherpubli...

 

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 ?

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 5 of 7
csludtke
in reply to: Balaji_Ram

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

 

 

 

Message 6 of 7
Balaji_Ram
in reply to: csludtke

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.



Balaji
Developer Technical Services
Autodesk Developer Network

Message 7 of 7
csludtke
in reply to: csludtke

Thanks,  I have all of the changes integrated.

 

Proceeding with cleanup.

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost