8 Replies Latest reply on Nov 23, 2017 12:11 AM by Deepak Gupta

    SW17 saving components when saving to step/3d-pdf

    Christopher Elyassi

      Hi all,

       

      I am building an external program that opens SW in the background, makes changes to an assembly, and saves the result as .stp and .pdf (3D) documents. Once the operations complete, the program closes down SW and all open documents without saving.

       

      I recently upgraded to SW17 and now have a strange problem: when saving to .stp or .PDF all .SLDPRT documents that have been modified are automatically saved.

       

      -     If I take out the code that saves to step and 3D-pdf in my programs this problem goes away.

      -     I do not have this problem if I save to step/3D-pdf manually with SW17.

      -     I have always been able to do this with SW15 and SW16 without any problem.

       

      Anyone know what's going on here? Are there some default settings I need to change? Does my code need to be modified to work well with SW17?

       

      Thanks in advance for any help!

      Chris

       

       

      CODE SNIPPETS BELOW:

              public static void SaveAsStep(string location)

              {

                  ModelDoc2 swModel = (ModelDoc2)swApp.ActiveDoc;

                  ModelDocExtension swModelDocExt = swModel.Extension;

       

                  swApp.SetUserPreferenceIntegerValue((int)swUserPreferenceIntegerValue_e.swStepAP, 214);

                  swModelDocExt.SaveAs(location, 0, 0, null, 0, 0);

              }

       

       

              public static void SaveAs3DPDF(string location, bool view)

              {

                  ModelDoc2 swModel = (ModelDoc2)swApp.ActiveDoc;

                  ModelDocExtension swModelDocExt = swModel.Extension;

                  ExportPdfData swExportData = swApp.GetExportFileData(1);

       

                  swExportData.ExportAs3D = true;

                  swExportData.ViewPdfAfterSaving = view;

                  swModelDocExt.SaveAs(location, 0, 0, swExportData, 0, 0);

              }