2 Replies Latest reply on Jun 16, 2015 5:24 AM by Patrick Curry

    In pdm work groups when you export a pdf can you make it and the revision to the file name?

    Stevan Karanovich

      Is it possible to do this. The next part of this is when it is saving a new revision can it move the old pdf to a archive?

        • Re: In pdm work groups when you export a pdf can you make it and the revision to the file name?
          Jeff Holliday

          Sorry - I don't quite understand your first question. The answer to the second is "no" but it may be possible to write a routine using API to do it.

          • Re: In pdm work groups when you export a pdf can you make it and the revision to the file name?
            Patrick Curry

            There is a macro listed in this thread that will accomplish this.

            https://forum.solidworks.com/message/151028#151028

             

            Also one that we use listed below.  Can't remember where it came from so I can't attribute it properly. 

            It will drop a pdf and dxf into a folder named after the first 3 digits of the file with the revision (of the slddrw) stuck on the end of the filename.   So you should be able to customise it to your filename settings by adjusting that ODrivePath line below and filename line too if you use a different string length for your part numbers.

             

            Sub main()

             

            Set swApp = Application.SldWorks

            Set swModel = swApp.ActiveDoc

             

            ' Check to see if a document is loaded.

             

            If swModel Is Nothing Then

            swApp.SendMsgToUser ("Open a drawing first")

             

            ' If no model currently loaded, then exit

            Exit Sub

            End If

            ' Determine the document type. If the document is not a drawing then send a message to the user.

            If (swModel.GetType <> swDocDRAWING) Then

            swApp.SendMsgToUser ("To be used used for drawings only")

            ' If document is not a drawing, then exit

            Exit Sub

            End If

            Fileprop = swModel.CustomInfo("Revision") 'Change the custom property name here

            'Filepath = Left(swModel.GetPathName, InStrRev(swModel.GetPathName, "\"))

            FileName = Left(swModel.GetTitle, 8)

            ODrivePath = "O:\issued\" + Left(swModel.GetTitle, 3) + "\"

            swModel.SaveAs (ODrivePath + FileName + "-" + Fileprop + ".PDF")

            swModel.SaveAs (ODrivePath + FileName + "-" + Fileprop + ".DXF")

            End Sub