.NET

Reply
Active Member
bherber
Posts: 8
Registered: ‎01-29-2008
Message 1 of 3 (226 Views)

einvalidinput saveas

226 Views, 2 Replies
06-26-2013 07:59 AM

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");

                   

                }

Employee
artc2
Posts: 226
Registered: ‎06-08-2010
Message 2 of 3 (217 Views)

Re: einvalidinput saveas

06-26-2013 09:04 AM in reply to: bherber

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).

*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 3 of 3 (202 Views)

Re: einvalidinput saveas

06-26-2013 02:18 PM in reply to: bherber
You can check allowed versions from list of enums like this:
Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
Database db = HostApplicationServices.WorkingDatabase;
DwgVersion[] dws = db.GetSupportedSaveVersions();
foreach (DwgVersion dw in dws)
ed.WriteMessage("\n{0}",dw);
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!