Distinguished Contributor
Posts: 405
Registered: ‎08-15-2003
Message 1 of 1 (157 Views)

Programmatically Open a Drawing

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


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



Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.