8 Replies Latest reply on Oct 14, 2014 3:18 AM by Hupla Que

    Generating .PDF and .DWG with macros

    Rasmus Hansen

      Hi everybody

       

      I work at a company in a transition between two programs. At the moment we are generating every .PDF and .DWG manually. To make this easier i started making a macro to make the process faster and automated. Problem is that i am stuck.

       

      Dim swApp As Object

       

       

      Dim Part As Object

      Dim boolstatus As Boolean

      Dim longstatus As Long, longwarnings As Long

       

       

      Sub main()

       

       

      Set swApp = _

      Application.SldWorks

       

       

      Set Part = swApp.ActiveDoc

      Part.ClearSelection2 True

      longstatus = Part.SaveAs3("O:\Solidworks Dokument Arkiv\Filer 2013\PDF\1099815734.PDF", 0, 0)

      Part.ViewZoomtofit2

      Part.ViewZoomtofit2

      Part.ViewZoomtofit2

      End Sub

       

      This is as far i can get on my own. This macro generates a pdf from my drawing. Trouble is that it allways names the pdf the same as the part i recorded the macro from.

       

      longstatus = Part.SaveAs3("O:\Solidworks Dokument Arkiv\Filer 2013\PDF\1099815734.PDF", 0, 0)

       

      In my head the above line is the only thing that needs changing. I need it to get the filename from the part on the sheet instead of the recorded number.

       

      I really hope there is someone out there who can offer me a hand.

       

      Regards

       

      Rasmus Hansen

      Carsoe A/S

      Mechanical Engineer