protected override void DoAction() { string myFileName = Path.GetFullPath(ParseStringForVariable(FileName)); Message("Saving file: \"" + SolidWorksDoc.GetTitle() + "\" as \"" + myFileName + "\""); //tidy appearance SolidWorksDoc.ViewDisplayShaded(); SolidWorksDoc.ShowNamedView2("*Isometric", -1); SolidWorksDoc.ViewZoomtofit2(); var options = (int)swSaveAsOptions_e.swSaveAsOptions_Silent + (SaveAsCopy ? (int)swSaveAsOptions_e.swSaveAsOptions_Copy : 0); string path = Path.GetDirectoryName(myFileName); if (path != null && !Directory.Exists(path)) { Directory.CreateDirectory(path); } int errs = 0, warns = 0; bool success = SolidWorksDoc.SaveAs4(myFileName, (int)swSaveAsVersion_e.swSaveAsCurrentVersion, options, ref errs, ref warns); if (!success) { throw new SolidWorksActionException(this); } }
protected override void DoAction() { Message("Closing file: \"" + SolidWorksDoc.GetTitle() + "\""); if (SaveChanges) { const int options = (int)swSaveAsOptions_e.swSaveAsOptions_Silent | (int)swSaveAsOptions_e.swSaveAsOptions_SaveReferenced; int errs = 0, warnings = 0; bool saved = SolidWorksDoc.Save3(options, ref errs, ref warnings); if (!saved || errs != 0) { throw new SolidWorksActionException(this); } } if (SolidWorksDoc.GetSaveFlag()) { AskEventEnums.DialogResult result = Ask(string.Format("Closing {0} without saving changes.", SolidWorksDoc.GetPathName()), "Closing document", AskEventEnums.AskType.OKCancel); if (result == AskEventEnums.DialogResult.Cancel) { return; } } SolidWorksDoc.Quit(); SolidWorksDoc = null; }
protected override void DoAction() { Message("Saving file: \"" + SolidWorksDoc.GetTitle() + "\""); const int options = (int)swSaveAsOptions_e.swSaveAsOptions_Silent | (int)swSaveAsOptions_e.swSaveAsOptions_SaveReferenced; int errs = 0, warnings = 0; bool saved = SolidWorksDoc.Save3(options, ref errs, ref warnings); if (!saved || errs != 0) { throw new SolidWorksActionException(this); } }