5 Replies Latest reply on Oct 16, 2013 9:23 AM by Jason Hill

    Save drawing as PDF with revision from model

    Jason Hill

      I know this has been answered before (probably many times) but I'm not a programmer and can't seem to make this work.  Basically all I need is a macro that will save a drawing as a PDF using the file name from the drawing and the revision from the referenced model (custom property called "Revision").  What I have used is shown below and it works fine but isn't setup to pull the revision from the referenced model.  I have tried a number of different ways to pull that custom property but just can't get it done.  Any help would be greatly appreciated!

       

      Dim swApp As Object

      Dim Part As Object

      Dim longstatus As Long, longwarnings As Long

      Sub main()

                

      Set swApp = Application.SldWorks

      Set Part = swApp.ActiveDoc

      Part.ViewZoomtofit2

       

      sPathName = Mid(Part.GetPathName, InStrRev(Part.GetPathName, "\") + 1)

      FilePath = Left(sPathName, InStrRev(sPathName, ".") - 1)

       

      FilePath = "C:\Test" & FilePath

      Rev = Part.CustomInfo2("", "Revision")

      Part.SaveAs3 FilePath & " RV " & Rev & ".PDF", 0, 0

       

      End Sub