public void SaveDrawingV2() { //This callback is for a utility to save an un-saved drawing of a part with a BPA part number into the correct Vault directory with the correct file name. DrawingDoc swDraw = iSwApp.ActiveDoc; SolidWorks.Interop.sldworks.View swView = swDraw.IGetFirstView(); swView = swView.GetNextView(); ModelDoc2 swDrawModel = swView.ReferencedDocument; int errors = 0; int warnings = 0; String configName = swView.ReferencedConfiguration; String drawingNumber = swDrawModel.GetCustomInfoValue(configName, "Drawing Number"); //MessageBox.Show("The drawing number is: " + drawingNumber); if (drawingNumber == "" || drawingNumber == " ") { MessageBox.Show("Please fill out the drawing number field on the model's file data card before proceeding.", "Missing Drawing Number", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } String modelPath = swDrawModel.GetPathName().ToString(); MessageBox.Show("The model's path is: " + modelPath); if (modelPath == "" || modelPath == " ") { MessageBox.Show("Please save the model before proceeding", "Save the Model", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } swDrawModel = iSwApp.ActiveDoc; String swDrawPath = swDrawModel.GetPathName().ToString(); //MessageBox.Show("The drawing path is: " + swDrawPath); if (swDrawPath != "") { MessageBox.Show("The drawing has already been saved as '" + swDrawPath + "' in the Vault.", "Drawng Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { string[] pathDir = modelPath.Split('\\'); int pathDirLength = pathDir.Length; string path = pathDir[0] + "\\" + pathDir[1] + "\\" + pathDir[2] + "\\" + pathDir[3] + "\\" + pathDir[4] + "\\"; string dwgPath = path + drawingNumber + ".SLDDRW"; string dialogText = "The drawing path is: \n" + dwgPath + "\nContinue?"; DialogResult result = MessageBox.Show(dialogText, "Save Drawing?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result == DialogResult.OK) { ModelDoc2 Model = SwApp.ActiveDoc; Boolean Save; Save = Model.SaveAs4(dwgPath, 0, 1, errors, warnings); } } //ModelDocExtension swModExt = default(ModelDocExtension); //Return the filepath of the referenced model in the parent view in the active drawing document. //string swModel = swView.GetReferencedModelName(); }