tags:

views:

25

answers:

1

I have a program that does batch processing on some drawings. One of the drawings throws an exception "Error Decrypting Data" when I try to open it. This drawing in particular was generated by a third-party tool other than AutoCAD. In addition, this problem only occurs in AutoCAD 2011. In AutoCAD 2010 it prompts the user that the file was generated outside of AutoCAD but they can click and the batch will continue. I've tried opening it using both the managed .NET API and the COM Interop API but both give the same error.

Here is a post from the AutoCAD formus though it didn't provide me with a solution:

http://forums.autodesk.com/t5/NET/Error-Decrypting-Data-Acad-2011/td-p/2661762/highlight/true

Managed API

string drawingFilePath = @"C:\Drawings\MyDrawing.dwg";
Application.DocumentManager.Open(drawingFilePath, false);

COM Interop

string drawingFilePath = @"C:\Drawings\MyDrawing.dwg";
Object comAutoCAD = Application.AcadApplication;
Object comDocuments = comAutoCAD.GetType().InvokeMember("Documents", BindingFlags.GetProperty, null, comAutoCAD, new object[] { });

Object comDocument = comDocuments.GetType().InvokeMember("Open", BindingFlags.InvokeMethod, null, comDocuments,
    new object[] { drawingFilePath, false, Type.Missing });
Document.FromAcadDocument(comDocument);