5 Replies Latest reply on Jun 21, 2017 6:44 PM by kendall_hiles

    need script for Output/Export PDF-Assembly with a user Display-Scheme


      how can i Export a Assembly-PDF in xpedition PCB with a script

      (i am a newcomer in VBS)

      and we don't have a Automation-licence


      thanks for help

        • 1. Re: need script for Output/Export PDF-Assembly with a user Display-Scheme

          Can you more completely describe the context in which you want to do this?  The reason I ask is that there is already a way to do it if you have a PDF writer such as Adobe Acrobat or some of the other free tools installed as a print driver. Turn on the layers you want in the output, then use the File > Print function and select the PDF writer as the print device. 


          Other than that, as far as I know there is no PDF output function built into Xpedition, so doing it another way will be considerably difficult, and require the use of an intermediate file of some kind (like DXF), then a secondary translation step. 


          There is a PDF output built into the Drawing Editor Extended Print tool, so if you have Drawing Editor you could probably set up a template with all the views and layers you want, and use the Extended print to output PDF files like you want from each design.

          • 3. Re: need script for Output/Export PDF-Assembly with a user Display-Scheme

            If you had an Automation Pro license or if you have a FABlink, you can use ExtendedPrint. https://supportnet.mentor.com/docs/201610040/docs/htmldocs/mgchelp.htm#context=exp_engines_auto&href=topics/Contain_Exte…


            Here is some example of some code I used in the past:

            Option Explicit


            Dim jobName 

            Dim args

            Dim argsCnt

            Dim setupFile

            Dim configFile

            Dim pcbPath, pcbApp, pcbDoc, ProjName, objFile, ProjNumb, ProjRev, LineContent

            Dim outputFile, objFSO, projFile, varOutputFile, varMergeFile1, varMergeFile2

            Dim dirSlash

                 dirSlash = "/"


            'On Error Resume Next


            ' Get the application object

            Set pcbApp = GetObject(,"MGCPCB.ExpeditionPCBApplication")


            ' Get the active document

            Set pcbDoc = pcbApp.ActiveDocument



            ' License the document

            If (ValidateServer(pcbDoc) = 1) Then


                 Call pcbApp.Gui.StatusBarText("Running PDF Export",epcbStatusField1)

                 Call pcbApp.Gui.CursorBusy(True)



                 setupFile = "L:\AATK\vbs\LSI\PDF.pcf"

                 configFile = "L:\AATK\vbs\LSI\PDF.xml"

                 jobName = pcbDoc.Path + pcbDoc


                 'Determine the Part Number and Rev of the project by reading the BorderData

                 pcbPath = Split(jobName, "PCB")

                 projFile = pcbPath(0) + "BorderData.asc"


                 Set objFSO = CreateObject("Scripting.FileSystemObject")

                 If objFSO.FileExists(projFile) Then

                     Set objFile = objFSO.OpenTextFile(projFile, 1, False)


                     Do While objFile.AtEndOfStream <> True

                         LineContent = objFile.ReadLine

                         If InStr(LineContent, "PartNumb") > 0 Then

                             ProjNumb = Mid(LineContent, InStr(LineContent, "PartNumb") + 9, 20)

                         ElseIf InStr(LineContent, "REV") > 0 Then

                             ProjRev = Mid(LineContent, InStr(LineContent, "REV") + 4, 20)

                         End If



                 End If


                     ProjName = Mid(ProjNumb, InStr(ProjNumb, "-")+1, 20)+ProjRev


                 Call RunExtendedPrint


                 Dim WshShell

                 Set WshShell = CreateObject("WScript.Shell")

                 WshShell.Run outputFile


                 Call pcbApp.Gui.CursorBusy(False)




                 Msgbox("Could not validate the server. Exiting program.")

            End If




            '*** Main Function


            Sub RunExtendedPrint()

                 ' Create PDFOutput Engine object

                 Dim oExtendedPrintEngine

                 Set oExtendedPrintEngine = CreateObject("MGCPCBEngines.ExtendedPrint")



                 pcbPath = Split(jobName, "PCB")

                 outputFile = pcbPath(0) + "PCB\Output\" + "FAB" + ProjName + ".pdf"   



                 oExtendedPrintEngine.DesignFileName = jobName


                 If setupFile <> "" Then

                     oExtendedPrintEngine.SetupFileName = setupFile

                 End if

                 oExtendedPrintEngine.BasicConfigurationFile = configFile



                 ' Run the ExtendedPrint Engine



                 Call pcbApp.Gui.StatusBarText("PDF Export Complete!!",epcbStatusField1)


                 ' done

            End Sub



            ' Begin Validate Server Function (Written By Mentor Graphics)


            Private Function ValidateServer(doc)


                 Dim key, licenseServer, licenseToken


                 ' Ask Expedition’s document for the key

                 key = doc.Validate(0)


                 ' Get license server

                 Set licenseServer = CreateObject("MGCPCBAutomationLicensing.Application")


                 ' Ask the license server for the license token

                 licenseToken = licenseServer.GetToken(key)


                 ' Release license server

                 Set licenseServer = nothing


                 ' Turn off error messages.  Validate may fail if the token is incorrect

                 On Error Resume Next



                 ' Ask the document to validate the license token


                 If Err Then

                     ValidateServer = 0   


                     ValidateServer = 1

                 End If


            End Function


            ' End Validate Server Function


            1 of 1 people found this helpful
            • 4. Re: need script for Output/Export PDF-Assembly with a user Display-Scheme

              sorry - i have no Automation Pro license / FABlink   / ExtendedPrint.

              • 5. Re: need script for Output/Export PDF-Assembly with a user Display-Scheme

                To utilize any of the Engines you need the Automation Pro license.