7 Replies Latest reply on Feb 17, 2017 7:35 AM by Stavros Pantelakis

    clone datacard to pdf file

    Joel Seerey

      hello, I was wondering if anybody had a simple method for cloning Datacard info from one file to another?

      when I create a 3d pdf of a SolidWorks file the Datacard information does not carry over. I would like to be able to create that pdf have it pasted as reference to the model and fill in the Datacard automagically.

       

      thanks

        • Re: clone datacard to pdf file
          Mati Link

          Have you mapped also variables to pdf files? Can you save data to pdf data card?

          • Re: clone datacard to pdf file
            Andries Koorzen

            Hi Joel.

             

            Using the SW Task addin you have the ability to copy / paste variable values from one file to another. This is especially useful if you are automatically converting models to PDF using the approval process, as it automates the entire process:

             

             

            If you are not using the tasks to convert the files, you can also copy the variable values to the file using Dispatch with the following setup:

            Get the selected file datacard variable values

            Look for a file with a similar name (replace *.sldasm / *.sldprt with *.pdf) > The caveat here is that the PDF name needs to have a predictable name format

            'Paste' / copy the variable values to this file.

             

            I have successfully done this in the past, so I know it is possible, however there are some assumptions I'm making here with regards to the Dispatch script:

            1. You're not using descriptive AND different file names (e.g. mypart123.sldprt with a PDF called mypdf456.pdf) AND

            2. The file names are the same (i.e. part123.sldprt and part123.pdf.)

            3. They are not significantly different i.e. they have some text unique to them, with the only difference being the file extension)

            4. The files are in predictable locations from each other (e.g. having the model in a predictable parent folder or in the same level folder)

             

            Using this reasoning we can use the following to set variables:

             

             

            you can extend this to even check the PDF in afterwards.

              • Re: clone datacard to pdf file
                Joel Seerey

                I keep getting an error when I try to run this script

                I've tried subtracting the length of the sldasm from the filename so that filename no ext would work properly but I still receive the same message

                  • Re: clone datacard to pdf file
                    Stavros Pantelakis

                    If you plan on using this on documents with names of different lengths/different extensions, use the find string function.

                     

                    r_fullstopLocn = find(%nameofselectedfile%, . )

                    r_FilenameNoExt = left(%nameofselectedfile%, %r_fullstoplocn%)

                     

                    The reason you are getting the message is that you've not included the path anywhere.  Depending on how you've setup your vault, you will need to find a way of using the string functions and datacard variables to generate the target location.

                     

                    i.e.

                    Selected file -- c:\VaultName\Jobs\64xx\6410\CAD\xxxx.slddrw

                    Target File -- c:\VaultName\Jobs\64xx\6410\PDF\xxxx.pdf

                     

                    For something like this you could create a variable

                    r_pathjobfld=left(%pathtoselectedfile%,27)

                    r_pdfpath= %r_pathjobfold%\PDF\

                     

                    select file with path:

                    %r_pdfpath%%DestFile%

                    • Re: clone datacard to pdf file
                      Joel Seerey

                      I have realized after I did this I had the names slightly different I think it was capslock

                       

                      I have since tried again and the dispatch ran correctly but did not enter any information as it was pulling variables from the @ tab which we have cleared out to put focus on the configuration specific datacard tabs.

                        • Re: clone datacard to pdf file
                          Stavros Pantelakis

                          Hello Joel,

                           

                          That is more complicated than I thought.  Since the number of configurations and their names will differ from part to part, you will need to somehow get the same datacard (including tabs) and assign it to the associated pdf file.  At the moment I cannot think of any way of doing this, it may be a case of an API program.