13 Replies Latest reply on Feb 25, 2011 2:41 PM by Josh Tiffin

    How to Export and Rename Files with Dispatch?

    Josh Tiffin

      I'm not sure if this is possible, but here's what I'd like to do.

       

      Our organization uses step files and pdf's for our drawings and 3D models when sending out to a vendor. What I would like to do is when the user transitions the SW files to a released state, EPDM automatically generates a pdf of the drawing and a step file of the model and naming those files <part_number>_Rev<revision#>.

       

      Is this possible with Dispatch or is this something that would need to be done with an EPDM addin?

       

      Thanks

       

      Josh

        • Re: How to Export and Rename Files with Dispatch?
          Lee CS Young

          It can be done with a task which is available with EPDM 2010 and above. (Convert Task.) See the administration guide.

          • Re: How to Export and Rename Files with Dispatch?
            Joy Garon

            Hi Josh,

             

            You didn't mention what your current filename was. If it's that same as the part number,

            you can name the resulting file (PDF, step, etc) within the Task framework. (see attached image)

             

            If not, you can use a dispatch script to rename the file using information from the datacard.

             

            Regards,

            Joy

             

            p.s. I also found another method in the knowledge base - see solution S-052490

              • Re: How to Export and Rename Files with Dispatch?
                Josh Tiffin

                Joy

                 

                The current file name of the part is just a generic number (MXXXXXX.sldprt). The part number that is stored in the part is in the format of XXX-XXXXXX-XX. The part numbers are completely different.

                 

                Do you have an example of how to rename a file using Dispatch? I've tried to figure it out but my knowledge of Dispatch is lacking. Thanks.

                 

                Josh

                • Re: How to Export and Rename Files with Dispatch?
                  Josh Tiffin

                  I should clarify exactly what i'm trying to do.

                   

                  I have a SW part named MXXXXXX.sldprt.

                  During a state transition to released I would like to export this file to a step file in the format of XXX-XXXXXX-XX.step. Where XXX-XXXXXX-XX is pulled from the part.

                   

                  I would also like to do this for drawings as well.

                   

                  MXXXXXX.slddrw is exported to XXX-XXXXXX-XX.pdf during the released transition.

                   

                  Even better would be when i release the drawing it exports both the part file and drawing to the respective formats. I hope this helps.

                   

                  Josh

                    • Re: How to Export and Rename Files with Dispatch?
                      Joy Garon

                      Hi Josh -

                       

                      Another question Where is the  XXX-XXXXXX-XX.step coming from? Are they properties on the file data card?

                       

                      Joy

                        • Re: How to Export and Rename Files with Dispatch?
                          Josh Tiffin

                          Joy

                           

                          The XXX-XXXXXX-XX.step is generated by a task right now. But we can't control how it's named from the part properties. We're looking at advanced scripting in the task as well to see if that is the way to go. I thought I would try Dispatch because it was mentioned by someone at SW that this should do what we want.

                           

                          Ultimately what we want is the files to be automatically generated when the drawing is transitioned to a released state.

                           

                          Josh

                            • Re: How to Export and Rename Files with Dispatch?
                              Ross Bulkley

                              If you follow the dispatch guide that Joy attached you can create a  rename action using data card variables for anything passing through a  specific transition.

                               

                              Then all you need to do to get  the part and drawing in their respective formats is to have multiple  transition actions that runs the specific task for only the specific  file type that should use that task.

                               

                              So, you would need at least two tasks, one to convert  to pdf and run that task only for .slddrw files, and the other task to  convert to step and allow that only for .sldprt files, and then the dispatch script that would rename any files passing through that transition.

                              • Re: How to Export and Rename Files with Dispatch?
                                Ross Bulkley

                                Also, if you are getting the XXX-XXXXXX-XX from multiple part properties, you would first need to map those properties to the data card, then have dispatch use those data card variables to rename it.

                            • Re: How to Export and Rename Files with Dispatch?
                              Josh Tiffin

                              So I figured it out. It needed to be done in the 'Advanced Scripting Options' in the 'Output File Details' in the task to generate the files. Here's what I added:

                               

                                  Dim numberVal As String
                                  Dim revVal As String
                                  Dim swCustPropMgr As SldWorks.CustomPropertyManager
                                  Set swCustPropMgr = swModel.Extension.CustomPropertyManager("")
                                  numberVal = swCustPropMgr.Get("Number")
                                  revVal = swCustPropMgr.Get("Current_Issue")
                                  convFileName = Replace(convFileName, "<Filename>", numberVal) 'the last parameter on this line was originally modelFileName
                                  convFileName = convFileName & revVal

                              This was added somewhere around line 80 of the script.

                               

                              Thanks for everyone who gave suggestions.

                               

                              Josh