1 Reply Latest reply on Mar 20, 2017 6:09 AM by fuba

    ProBatchEngines PDF output - Printing User layers?

    jmarsel@curtisswright.com

      I'm trying to use the ProBatchEngines PDFOutput or ExtendedPrint engine and make a PDF of selected user layers in VBscript.

       

      I'm using the following code (I'm not showing all variables being dimensioned here.. for the sake of simplicity).  It seems to run without errors but I get no output file at all. Can anyone tell me what I'm missing?  When I change the content of the sheet to things like ASSEMBLY TOP type elements, I get a PDF output file no sweat.  btw, I'd love to know if there is such a thing as mirrored output on the PDF engine but I don't see it.

       

      Thanks.

       

       

      Set oPDFEngine = CreateObject("MGCPCBEngines.PDFOutput")

      Scripting.AddTypeLibrary("MGCPCBEngines.PDFOutput")

          ' Set the design file name

          oPDFEngine.DesignFileName = jobName

          ' Get design Config directory

          Dim pcbPath

          pcbPath = Split(jobName, "PCB")

          jobConfigPath = pcbPath(0) + "PCB/Config/"

        

          Set oPDFOutputSheets = oPDFEngine.Sheets
        oPDFOutputSheets.Add "FabDrawing_Pg1"
        Set sheetObj = oPDFOutputSheets.Item(0)
        Set oUserlayers = sheetObj.UserLayers
        oUserlayers.ADD "Pcb_Fabdrawing_pg1"
        oUserlayers.ADD "Stackup_dielec"
        oUserlayers.ADD "Stackup_plane"
        oUserlayers.ADD "Stackup_sig"

        sheetObj.UserLayerOrder = True

       

              oPDFEngine.WhiteBackground = True

              oPDFEngine.PageNumbering = True

              oPDFEngine.LaunchReader = True

            oPDFEngine.FitDrawing = False

            oPDFEngine.FillText = True

            oPDFEngine.OutputFileName = pcbPath(0) & "PCB\Output\PDF\FabDwg.pdf"   ' This is the name and location of the output pdf

          'oPDFEngine.SetupFileName = jobConfigPath + "PDFSetup.pcf"

         

          ' Run the PDF Engine

          On Error Resume Next

          oPDFEngine.Go

          On Error Goto 0

        • 1. Re: ProBatchEngines PDF output - Printing User layers?
          fuba

          Hello Joel,

          I have also my problems with PDF file creation. Here is the Macro i am currently using.

          Sorry it is written in .Net, but it is easy to translate back to vba. Give it a try.

          I will check your code, if it works.

           

          Ciao

           

          Stefan

           

          Dim sComVersion As String

                  sComVersion = 9

           

            Dim pdfEngine As MGCPCBEngines.PDFOutput

                  pdfEngine = New MGCPCBEngines.PDFOutput

                  pdfEngine = CreateObject("MGCPCBEngines.PDFOutput." & sComVersion)

           

          If pdfEngine Is Nothing Then

                      MsgBox("Cannot obtain an Object Automation Object")

                      Exit Sub

          End If

           

          Dim outPath As String

                  outPath = IO.Path.Combine(pcbDoc.Path, outputBaseFolderName, "PDF")

           

          Dim fn As String

                  fn = IO.Path.GetFileNameWithoutExtension(pcbDoc.Name) & ".pdf"

           

          Dim ffn As String

                  ffn = IO.Path.Combine(outPath, fn)

           

                  '#

                  '# Some basic Settings for the PDF engine

                  With pdfEngine

                      .DesignFileName = pcbDoc.FullName

                      '# Does not work

                      '.WhiteBackground = True

                      '.PageNumbering = True

                      '.LaunchReader = True

                      .OutputFileName = ffn

                  End With

           

                  '#

                  '# Now we add the Sheets

                  With pdfEngine

                      'Add all the copper layers

                      For numsh = 1 To pcbDoc.LayerCount

                          '# This need to made better

                          .Sheets.Add("SIGNAL_" & numsh)

                      Next

                      .Sheets.Add("DrillTable")

                  End With

           

          Dim i As Integer

                  i = 1

           

                  Dim sh As MGCPCBEngines.PDFOutputSheet

                  '#

                  '# Now we configure the sheets and their content

                  For Each sh In pdfEngine.Sheets

                      Dim oBoardItems As MGCPCBEngines.BoardItems

                      oBoardItems = sh.BoardItems

           

                      Debug.Print("SheetName: " & sh.Name)

           

                      If sh.Name.Contains("SIGNAL") Then

           

                          oBoardItems.Add(MGCPCBEngines.EEnginesBoardItem.eengBoardItemBoardOrigin)

                          oBoardItems.Add(MGCPCBEngines.EEnginesBoardItem.eengBoardItemBoardOutline)

           

                          'oBoardItems.Add(MGCPCBEngines.EEnginesBoardItem.eengBoardItemAll)

           

                          sh.CellTypes.Add(MGCPCBEngines.EEnginesCellType.eengCellTypeAll)

                          sh.CellItems.Add(MGCPCBEngines.EEnginesCellItem.eengCellItemAll)

           

                          'sh.CellItems.Add(MGCPCBEngines.EEnginesCellItem.eengCellItemAssemblyReferenceDesignator)

                          'sh.CellItems.Add(MGCPCBEngines.EEnginesCellItem.eengCellItemAssemblyPartNumber)

           

                          Dim oCondLayer As MGCPCBEngines.PDFConductiveLayer

                          oCondLayer = sh.ConductiveLayers.Add(i)

                          oCondLayer.ConductiveItems.Add(MGCPCBEngines.EEnginesConductiveItem.eengCondItemAll)

           

                          sh.HeaderText = "Header " & i

                          sh.TrailerText = "Footer " & i

           

                          '# Sheet Name / already defined when adding a sheet

                          'sh.Name = "Klaus " & i

           

                      ElseIf sh.Name.Contains("DrillTable") Then

                          '# Drill Table

                          oBoardItems.Add(MGCPCBEngines.EEnginesBoardItem.eengBoardItemBoardOrigin)

                          oBoardItems.Add(MGCPCBEngines.EEnginesBoardItem.eengBoardItemBoardOutline)

                          oBoardItems.Add(MGCPCBEngines.EEnginesBoardItem.eengBoardItemDrillDrawingThru)

           

                      Else

           

                      End If

           

                      sh.PageSize = MGCPCBEngines.EEnginesPDFSheetPageSize.ePDFA4

                      sh.ScaleFactor = 0.5

                      'sh.Orientation = MGCPCBEngines.EEnginesPDFSheetOrientation.ePDFBestFit

           

                      i = i + 1

           

                  Next

           

                  Try

                      pdfEngine.Go()

                  Catch ex As Exception

                      'MsgBox("An Automation Pro License was not found. Just try again.", vbOKOnly)

                      MsgBox(ex.ToString)

                      'Exit Sub

                  End Try

           

                  Call clsExport_utils.ListErrors(pdfEngine.Errors)

           

                  pdfEngine = Nothing