Converting code to .dll file. Problems with 2009.

Converting code to .dll file. Problems with 2009.

sgrya1
Advocate Advocate
373 Views
2 Replies
Message 1 of 3

Converting code to .dll file. Problems with 2009.

sgrya1
Advocate
Advocate
I don't understand the problem here but hopefully someone will make sense of it.

I've have some code that I converted using VB6.0 for use from a .dll file.

It used to work ok using a reference to AutoCAD/ObjectDBX common 17.0 Type Library but maybe it's because I now have 2009 that I can't successfully convert it to a .dll file.

Now I get the error "Automation error Classfactory, cannot supply requested class" when trying to open a document using the following.

Dim DbxDoc As New AxDbDocument
DbxDoc.Open "C:\Profile.dwg"

Most of my variable types are set to As Object (late binding apparently) but I can't Dim DbxDoc As New Object

Any suggestions very welcome.
0 Likes
374 Views
2 Replies
Replies (2)
Message 2 of 3

sgrya1
Advocate
Advocate
I'm trying to stumble onto a solution.

I've changed it to this:

Dim DbxDoc As Object 'New AxDbDocument
Set DbxDoc = GetInterfaceObject("ObjectDBX.AxDbDocument.17")
DbxDoc.Open "C:\Program Files\Profile\Profile.dwg"

and added the Autocad 2008 Type Library. Seems to work now however....

Now I'm getting a problem on this line:
sAngle = ThisDrawing.Utility.AngleFromXAxis(sp, ep)
With an error saying "Automation error Element not found"
0 Likes
Message 3 of 3

sgrya1
Advocate
Advocate
To answer my second problem..I found someone else who experienced the same problem.

I needed to repair my AutoCAD installation

To reinstall or repair AutoCAD
• Start > Control Panel, double-click Add or Remove Programs.
• In Add or Remove Programs, select AutoCAD 2009, then click Change/Remove.

There was nothing wrong with:

Dim DbxDoc As New AxDbDocument
DbxDoc.Open "C:\Profile.dwg"

either. Must have been the Type Library I was trying to use.
0 Likes