5 Replies Latest reply on Aug 15, 2018 2:21 AM by Sam Sam

    PDM Task Export Flat Pattern DXF - create new version of existing file

    Tomaz Korosec

      Hi,

       

      I managed to make a modified PDM Convert Task, which exports Sheet metal part to Flat pattern DXF. I would still like to use options of original Convert task "Replace existing files" or "Create new version of existing files". Does anybody know how this works in the background and what code should be used in the task script to take advantage of this SWTaskAddIn functionality?

       

      Best regards,

      Tomaz

        • Re: PDM Task Export Flat Pattern DXF - create new version of existing file
          Michael Martens

          I don't believe I can help you with your problem, but I sure would love to know how you managed to create the DXF output task.

          • Re: PDM Task Export Flat Pattern DXF - create new version of existing file
            Tomaz Korosec

            Hi,

             

            I managed to somehow solve the problem. It turned out that "Replace existing files" or "Create new version of existing files" don't work if task is run by SW 2017 or older ("SOLIDWORKS version to use" option under "Advanced Scripting Options..." under Task properties), but it works fine if run by SW 2018. The output DXF file is neither automatically checked in after conversion if task run by SW 2017 or older, but it gets automatically checked in if run by SW 2018.

             

            I do not know the reason behind this behaviour, but obviously some additional funcitionality was added to SW 2018 API.

             

            I look forward for any additional insight how to achieve automatic Check in of DXF file if Task run in SW 2017 or older, since some of our customers still prefer to use older SW version.

             

            By the way, I did DXF conversion of Flat pattern sheet metal directly on part (not on Flat pattern drawing) by modifying Default PDM Convert Task script using ExportToDWG API method.

            • Re: PDM Task Export Flat Pattern DXF - create new version of existing file
              Christopher Hammel

              Hi Tomaz,

               

              I also can't answer your question, but I've tried just about everything I can come up with to make ExportToDWG work from a Task, to no avail...every time, the function returns False and doesn't save, although no errors are thrown.

               

              Did you ever see this behavior?  Any suggestions for what might be preventing it from running properly as a Task, even though the macro by itself works properly?

               

              Thanks,

              Chris

              • Re: PDM Task Export Flat Pattern DXF - create new version of existing file
                Sam Sam

                Hi,

                 

                The same situation with conversion of files of SolidWorks to TIF and other formats is familiar to me.

                Therefore, I do not think that it is connected to a filename extension.

                 

                In SolidWorks PDM 2018 "Create new version of existing files" works provided that the file which should be replaced before this is CheckOut. It is better to make it automatically, for example through Dispatch.

                But I noted even earlier that if the replaced file is selected in the PDM window - the file will not be replaced.

                There are no warnings - just the system reads that the file - Locked.

                I checked - if to remove a choice (cursor) from the file the PDM window - everything works without problems.

                 

                Also the file can be Locked some other application or Add-Ins.

                It can be checked, for example by means of the program - "Unlocker".

                 

                As I think - a problem that the replaced file is occupied with some process.

                And for its changeover - it shall be before this Unlocked (programmatically or in a different way).

                 

                Perhaps, it has no relation to this situation, then if in the task the code is used - to check the used SolidWorks version - there is it matters.

                Also, a problem in the Workflow settings for example it can be possible to try to ignore permissions in the previous statuses.