Hello: i have been having issue with saving drawings in Mechanical 2013, when i debug the code below i am getting a einvalidinput on the Database.SaveAs() method. i currently run the same code on mechanical 2012 and it works fine. please note i need to save the files in Mechanical 2012 format. If i use DwgVersion.Current it works without erroring out but i need it to save in the Mechanical 2012 format.
using
ACE = Autodesk.AutoCAD.EditorInput;
using
ACAS = Autodesk.AutoCAD.ApplicationServices;
using
ACR = Autodesk.AutoCAD.Runtime;
using
ACDS = Autodesk.AutoCAD.DatabaseServices;
ACAS.
Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
if (File.Exists(FileLocation))
{
if (FasMain.InputBox("Drawing File Exists", "This Drawing File Exists, do you want to overwrite?", ref value) == DialogResult.OK)
{
acDoc.Database.SaveAs(FileLocation,
true, ACDS.DwgVersion.AC2To21, null);
ed.WriteMessage(
"\nFile is Saved");
}
else
{
Close();
}
}
else
{
acDoc.Database.SaveAs(FileLocation,
true, ACDS.DwgVersion.AC2To21, null);
ed.WriteMessage(
"\nFile is Saved");
}
AC2To21 is not a valid format to save to in base AutoCAD. It is a valid enum value, but it is not a format that base AutoCAD will save to. Mechanical must be using that enum value to indicate something special for its own data because it still has to save to a valid dwg format which for Mechanical 2012, I think should be the same as base AutoCAD 2012 (enum value AC1024).
Can't find what you're looking for? Ask the community or share your knowledge.