10 Replies Latest reply on May 20, 2011 7:47 PM by Yann Le Dirach

    EPDM Dispatch SLDRW to PDF

    earl navarro

      Hi,

       

      I've been looking at Dispatch  to convert SLDRW to PDF once it entered the approved state  . I know EPDM has the TASK function to do this, but it is limited in a sense that it doesn't let me choose the file data card variable to direct the location where i want to save it too.

       

      first question is ..how do you convert pdf using dispatch?

       

       

      second questions is

       

      i want to be able to save the PDF in a location, depending on the value of a file data card variable  called modelNumber...for example

       

      if modelNumber is 311DBS , the converted pdf should go in a folder named 311DBS.

       

      The actual folder names are already created.

       

      any help will be appreciated.

       

      thank you

        • Re: EPDM Dispatch SLDRW to PDF
          Joy Garon

          Hi Earl,

           

          Actually, this would be easier if you modified the script in the task.

          Reference:

          Solution S-052490

           

          Best Regards,

          Joy

            • Re: EPDM Dispatch SLDRW to PDF
              earl navarro

              hi Joy,

               

              how do i access the Solution S-052490, sorry i tried looking but can't find it.

              also does this involve api programming?

               

              thanks

                • Re: EPDM Dispatch SLDRW to PDF
                  Joy Garon

                  Hello,

                   

                  No API programming is required. Solutions can be found by searching the Knowledge Base.

                  I have included this solution as a PDF attachment.

                   

                  Regards,

                  Joy

                    • Re: EPDM Dispatch SLDRW to PDF
                      earl navarro

                      hi Joy,

                       

                      first i really appreciate all the help you've given me...

                      when i try the convert task without even touching the advance scripting options, i'm getting this error

                       

                      "Method call ModelDocExtension::SaveAs for document '\\mvpsrv1\redirected\enavarro\Desktop\MVP_TestVault\CAD Files\12 \CAD Files\700-12-00123.pdf' failed. Error code 4097 returned."

                       

                       

                       

                      convert task.PNG

                      also in the advance scripting can i use file data card variables to direct the output path?

                       

                      thank you

                        • Re: EPDM Dispatch SLDRW to PDF
                          Tim Read

                          Hi Earl,

                           

                          I am not changing the path using data card variables but maybe I can point you in the right direction. I am using Solidworks Properties values (set in the data card) for naming the output file.

                           

                          Two parts are required in the script... added into the script where the script currently removes illegal characters from the filename.

                           

                          '###############################################################
                          Function GetFileVariable(sVarName As String)
                              sVarVal = swModel.CustomInfo2("", sVarName)
                              GetFileVariable = sVarVal
                          End Function
                          '###############################################################

                           

                          '###############################################################
                              '# This changes the name of the PDF, not the path.
                              finalFileName = Replace(finalFileName, "%PartNumber%", GetFileVariable("PartNo"))
                              finalFileName = Replace(finalFileName, "%Revision%", GetFileVariable("Revision"))
                              finalFileName = Replace(finalFileName, "%Description%", GetFileVariable("Description"))
                          '###############################################################

                           

                          You also have to set the Default path using the same format as what you are "replacing", eg.

                          <VaultPath>\Released Drawings\%PartNumber% - REV%Revision% - %Description%

                           

                          Hope this helps,

                          Tim

                          • Re: EPDM Dispatch SLDRW to PDF
                            Jeff Sweeney

                            Is that output path what you expected? The "\CAD Files\" listed twice and the space after the "12" looks a little suspicious. It certainly is not what you would expect your example path to produce.

                             

                            Does "\\mvpsrv1\redirected\enavarro\Desktop\MVP_TestVault\CAD Files\12 \CAD Files\" exist?

                              • Re: EPDM Dispatch SLDRW to PDF
                                earl navarro

                                hi Jeff,

                                 

                                yes the output path exists, and thanks for catching up that extra space after "12", I've fixed it..

                                i was able to create the pdf and redirect the output to pdf to the right folder, using Joy suggestion editing the advance script in TASK to produce the PDF ...with a combination of DISPATCH  to redirect it to the right folder.

                                 

                                thanks for you help..i appreciate it.

                      • Re: EPDM Dispatch SLDRW to PDF
                        Yann Le Dirach

                        hello earl,

                         

                        I had the same need.

                         

                        My files are organized this way:

                         

                        [VaultOrigine]\NPIXXXX\CAD\DRW (where we put all the slddrw files)

                         

                        NPIXXXXX is a incremetnal number !

                         

                        we wanted to create a SW task to generated pdf from slddrw files and then put the pdf into :

                         

                        [VaultOrigine]\NPIXXXX\MEP (where we put all the slddrw files)

                         

                        I just change the script :


                            ' Build destination filenames
                            convFileName = "[OutputPath]"

                         

                        to :

                         


                            ' Build destination filenames
                            'convFileName = "[OutputPath]"
                            convFileName=Left(modelPath,31)  & "\MEP\" & modelFileName

                         

                        The 31 number is for  [VaultOrigine]\NPIXXXX\CAD which is a fix length path

                         

                        Easy to implement.