.NET

Reply
Distinguished Contributor
405 Posts
4 Kudos
Registered: ‎08-15-2003
Post 1 of 1

Programmatically Open a Drawing

165 Views, 0 Replies
06-03-2014 11:33 PM

Hi,

My program reads dwg files into a side database to read information, like so:

db.ReadDwgFile(fName, FileShare.ReadWrite, false, "");

 Based on that information, the program has to open a dwg file in the Editor:

DocumentCollection dm = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager;
try
{
	dm.Open(fName, false);
}

 The problem I'm encountering is this:

If I use a modal dialog in the document context, I get "Invalid execution context" error when trying to open the file in the editor.

On the other hand, if I use a modeless dialog in the Application context, trying to read a dwg into the side database gives "eNoInputFiler" error.

I suppose this is related to the execution context, but I haven't been able to make it work.

(the xref dialog in AutoCAD succeeds though)

Any help will be much appreciated.

 

alex

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post