Link to home
Start Free TrialLog in
Avatar of aio419
aio419

asked on

An unhandled exception of type 'System.Runtime.InteropServices.COMException'

I am trying to get some block info from an Autocad drawing using vb.net.
It was working fine with autocad 2005.When we upgraded to autocad 2006, it is crashing.
The first one is having problem is in the line
Dim CurrentSpace As String
CurrentSpace = AppObj.ActiveDocument.ActiveLayout.Block.Name '  
          This is returning >> "*Paper_Space"

For I = 0 To AppObj.ActiveDocument.Blocks.Count – 1    ‘ERROR IS HERE ’
Where Friend WithEvents AppObj As Autodesk.AutoCAD.Interop.AcadApplication
The error is
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in DrawingIndexer.exe

Additional information: No database

If I look in the quick watch window for AppObj.ActiveDocument.Blocks this is the error
Blocks      <error: an exception of type: {System.Runtime.InteropServices.COMException} occurred>
Type:      Autodesk.AutoCAD.Interop.Common.AcadBlocks
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Did you readd the reference to the Autocad, or are you using the same wrapper class?

Bob
Avatar of aio419
aio419

ASKER

Yes,I readded the references. (named Autocad 2006 Type Library and AxdbLib.(16.0) type library)
from the COM tab

Ok, so the developers have changed the interface for the type library, and you need to figure out how.  I don't know what that would be exactly.

Bob
Avatar of aio419

ASKER

Thanks for the reply.
I trying to find out why it is not working for acad 2006  with
AppObj.ActiveDocument.Blocks.Count  giving no database error.

Do i need to add any other references or is there any change for Acad 2006 for this.
The type libraries for 2006 have been renamed, so did you add a reference to the new name?  Do you still have 2005 installed?

Bob
The Autocad 2006 CD has documentation and samples that might help explain your problems.

Bob
Avatar of aio419

ASKER

i do not have 2005 installed. I removed the reference for 2005 and added 2006 references.
I am out of ideas.

Bob
Avatar of aio419

ASKER

After a struggle I figured out that it is a bug in Autocad and got a hot fix them to patch it.
It is working now.
Thanks for your replay though.
ASKER CERTIFIED SOLUTION
Avatar of GranMod
GranMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial