9 Replies Latest reply on Jul 26, 2017 8:04 AM by John Stoltzfus

    Saving drawing as PDF and flat pattern as DXF

    Thomas Hotchkin

      Hi all,

       

      Trying to learn how to program PDM Professional to do some custom tasks. I have a bit of experience with programming (primarily in C# and C++) but am having trouble figuring out how to even get started with PDM tasks. Hoping someone here can point me in the right direction for some resources to get me started, or if you have a similar task you might be able to share snippets of. I believe the easiest way is to use a VB script withing the Solidworks Add In tool. Broadly what I want to do is to select a bulk batch of parts, save any drawing as a PDF and any sheet metal part as a DXF of the flat pattern. Assemblies and parts with no sheet metal features don't have to do anything.

       

      I've written basic pseudo code of what I want to do:

      Open File
      
      
      Type = get file type
      Name = get file name
      Revision = get file revision
      Recipient = get recipient
      Date = get date
      VaultPath = get vault path
      
      
      SavePath = VaultPath + "/Document Transmittals/" + Recipient + "/" + Date + "/"
      SaveName = FileName + "-" + FileRevision
      
      
      if Type = drawing
      if SavePath+Savename + ".pdf" does not exist
      save PDF as SavePath + SaveName
      
      
      elseif Type = part
      if SavePath+Savename + ".dxf" does not exist
      if sheetmetal
      save flatpattern DXF as SavePath+SaveName
      
      
      close file
      

       

      Any help would be greatly appreciated.

       

      Thanks,

      Tom.