2 Replies Latest reply on Sep 18, 2015 8:37 AM by Tapani Sjoman

    SaveAs3 Modifying Layer States During Execution

    Steven Pybus

      I've got a macro that we've been using for years that will create a DXF and a PDF out on a server drive.  I'm sure it started with code from this forum but has grown over the years to be very custom for our company.


      I've trimmed out a bunch of other stuff but the important lines are these.


      Dim swApp As SldWorks.SldWorks

      Dim Part As ModelDoc2

      Dim boolstatus As Boolean

      Dim longstatus As Long, longwarnings As Long


      Set swApp = Application.SldWorks

      Set Part = swApp.ActiveDoc


      Sub main()

          longstatus = Part.SaveAs3("I:\DXF\filename.DXF", 0, 0)

          longstatus = Part.SaveAs3("I:\PDF\filename.PDF", 0, 0)

      End Sub


      For some reason the SaveAs3 to a PDF is messing with the active layers. I'm debugging the macro line by line and the layer modification happens exactly when it hits the line above in bold.  Here are before and after of the layer settings on a sample drawing....








      We upgraded our EPDM yesterday.  I'm not sure if that could have caused an issue.


      I'm wondering if anyone has seen this and/or has a solution.  The DXF and PDF saveas macros are crucial to our business.  Any help would be appreciated.