.NET

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

einvalidinput saveas

203 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: 197
Registered: ‎06-08-2010
Message 2 of 3 (194 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 (179 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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community