1 Reply Latest reply on Jun 9, 2014 7:19 PM by Artem Taturevych

    Save As Copy Check Box

    Nic Brunsting

      Hi all,


      I am trying to activate the standard Save As window (swApp.RunCommand swCommands_SaveAs, "") but with the "Save As Copy" box checked.  I believe I need to use Enumerations with the SaveAs4 command (Copy = swModel.SaveAs4(SavePath, swSaveAsCurrentVersion, swSaveAsOptions_Copy, nErrors, nWarnings) where I have Copy as a bool, SavePath includes the part number and extension, and I have swSaveAsOptions_e, swFileSaveError_e, and swFileSaveWarning_e enumerations defined. I also have  swSaveAsCurrentVersion as an integer, and both nErrors and nWarnings as Longs.


      I can get my bool to change from false to true, but nothing happens after that - it doesn't actually save the file, nor does it prompt with the Save As dialog.  I also tried just the code from this thread https://forum.solidworks.com/message/249307 , which acted the same way - nothing happened.


      Any suggestions?  I've uploaded my code for reference, but since we use an archaeic file structure, it may be hard to troubleshoot unless you create a mock folder structure.


      *Note*  I'm stepping through the code, not just clicking run and sitting back.


      SW 2013 SP5, Windows 7 x64 SP1




        • Re: Save As Copy Check Box
          Artem Taturevych

          SaveAs4 should not prompt the save dialog, it should just save instead. What the values of nErrors, nWarnings after the method is invoked? Make sure that you do not have any invalid characters in your path. I would also suggest to switch to ModelDocExtension::SaveAs method instead of IModelDoc2::SaveAs4 unless you are using SolidWorks older than 2007.


          Regards, Artem Taturevych | Snr. Developer | IC3D ANZ


          IC3DSteel – New Steel Solution for SolidWorks

          LinkedIn - SolidWorks API Group