.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

einvalidinput saveas

2 REPLIES 2
Reply
Message 1 of 3
bherber
679 Views, 2 Replies

einvalidinput saveas

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

                   

                }

Tags (1)
2 REPLIES 2
Message 2 of 3
artc2
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).

Message 3 of 3
Hallex
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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost