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

eNoInputFiler Error executing Document.ReadDwg()

1 REPLY 1
Reply
Message 1 of 2
Anonymous
616 Views, 1 Reply

eNoInputFiler Error executing Document.ReadDwg()

Hi,

I am getting a eNoInputFiler error executing Document.ReadDwg() when I am not executing the method as an AutoCAD command (i.e. not called from a method marked with a CommandMethod annotation). If I execute the code called from a method called as an AutoCAD command, it works fine.

I have tracked down what appears to be the cause: The command executes in document context (and Document.ReadDwg works) and the other call comes from application context (Application.DocumentManager.IsApplicationContext = True) and the function fails.

Any suggestions?

- Scott
1 REPLY 1
Message 2 of 2
phliberato
in reply to: Anonymous

You need to lock the document.

 

Document doc = Application.DocumentManager.MdiActiveDocument;

            using (doc.LockDocument())

            {

                using (Database db = new Database(false, false))

                {

                        db.ReadDwgFile(filePath, FileOpenMode.OpenForReadAndWriteNoShare, true, null);

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