Opening A2k from VB - Run-time error '-2145386390 (8020006a)'

Opening A2k from VB - Run-time error '-2145386390 (8020006a)'

Anonymous
Not applicable
250 Views
2 Replies
Message 1 of 3

Opening A2k from VB - Run-time error '-2145386390 (8020006a)'

Anonymous
Not applicable
I have written a program that extracts attribute data from AutoCAD
drawings to populate a database. AutoCAD is not always on when the user
starts my program. I first try to connect to AutoCAD with the following
line:

Set ACAD = GetObject(, "Autocad.Application")

If that returns an error I try:

Set ACAD = CreateObject("AutoCad.Application")

These two statements and the next few statements that set up my object
references for AutoCAD come straight out of the AutoCAD help files:

Set DOC = ACAD.ActiveDocument
Set MS = DOC.ModelSpace
Set BLOCKS = DOC.BLOCKS
Set SSET = DOC.SelectionSets
Set UTIL = DOC.Utility

The problem is that sometimes after I have launched and connected to
AutoCAD and the DOC variable has been set, almost all of the other objects
in the AutoCAD environment have "No Database". I get an error message
saying: "Run-time error '-2145386390 (8020006a)'".

How can I update the AutoCAD environment or my VB environment to reflect
the fact that I have AutoCAD running.

I can't set the MS (ModelSpace) variable. That's the first one that
causes trouble, but I'm sure the others would return the same message
because when I look at the DOC object in the watch window, "No Database" is
the value of almost all of the objects.

Any help is appreciated. Thank you.

Sincerely,

Michael Madrid
0 Likes
251 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Hi Jorge!

Have you tested, if a drawing is open.
If you make a link to AutoCAD and there is no drawing open, your DOC points
to "NIRWANA"!
All the following lines make no sense then!

Ing. B. Miksch
Greetings from AUSTRIA
www.artandaction.at

Jorge Terrazas schrieb in im Newsbeitrag:
F6B6DC1C721B34C115AE58918971984B@in.WebX.maYIadrTaRb...
> I have written a program that extracts attribute data from AutoCAD
> drawings to populate a database. AutoCAD is not always on when the user
> starts my program. I first try to connect to AutoCAD with the following
> line:
>
> Set ACAD = GetObject(, "Autocad.Application")
>
> If that returns an error I try:
>
> Set ACAD = CreateObject("AutoCad.Application")
>
> These two statements and the next few statements that set up my object
> references for AutoCAD come straight out of the AutoCAD help files:
>
> Set DOC = ACAD.ActiveDocument
> Set MS = DOC.ModelSpace
> Set BLOCKS = DOC.BLOCKS
> Set SSET = DOC.SelectionSets
> Set UTIL = DOC.Utility
>
> The problem is that sometimes after I have launched and connected to
> AutoCAD and the DOC variable has been set, almost all of the other objects
> in the AutoCAD environment have "No Database". I get an error message
> saying: "Run-time error '-2145386390 (8020006a)'".
>
> How can I update the AutoCAD environment or my VB environment to
reflect
> the fact that I have AutoCAD running.
>
> I can't set the MS (ModelSpace) variable. That's the first one that
> causes trouble, but I'm sure the others would return the same message
> because when I look at the DOC object in the watch window, "No Database"
is
> the value of almost all of the objects.
>
> Any help is appreciated. Thank you.
>
> Sincerely,
>
> Michael Madrid
>
0 Likes
Message 3 of 3

Anonymous
Not applicable
Hello,

There is no problem with opening drawings. I can connect to the drawing,
open new drawings and close drawings. I can connect to the document object.
The error occurs when I try to set a variable that connects to the
modelspace object. It is like a drawing is opened in name only, as if it is
a shell with no guts. None of the other objects are accessible such as
dictionaries, blocks or layers. I can, however, interact with the AutoCAD
drawing manually.

Any new thoughts?

Thank you,

Michael Madrid

Ing. B. Miksch wrote in message
news:7DBA1C266A7F195B7E7D81D1D702D3B1@in.WebX.maYIadrTaRb...
> Hi Jorge!
>
> Have you tested, if a drawing is open.
> If you make a link to AutoCAD and there is no drawing open, your DOC
points
> to "NIRWANA"!
> All the following lines make no sense then!
>
> Ing. B. Miksch
> Greetings from AUSTRIA
> www.artandaction.at
>
> Jorge Terrazas schrieb in im Newsbeitrag:
> F6B6DC1C721B34C115AE58918971984B@in.WebX.maYIadrTaRb...
> > I have written a program that extracts attribute data from AutoCAD
> > drawings to populate a database. AutoCAD is not always on when the user
> > starts my program. I first try to connect to AutoCAD with the following
> > line:
> >
> > Set ACAD = GetObject(, "Autocad.Application")
> >
> > If that returns an error I try:
> >
> > Set ACAD = CreateObject("AutoCad.Application")
> >
> > These two statements and the next few statements that set up my
object
> > references for AutoCAD come straight out of the AutoCAD help files:
> >
> > Set DOC = ACAD.ActiveDocument
> > Set MS = DOC.ModelSpace
> > Set BLOCKS = DOC.BLOCKS
> > Set SSET = DOC.SelectionSets
> > Set UTIL = DOC.Utility
> >
> > The problem is that sometimes after I have launched and connected to
> > AutoCAD and the DOC variable has been set, almost all of the other
objects
> > in the AutoCAD environment have "No Database". I get an error message
> > saying: "Run-time error '-2145386390 (8020006a)'".
> >
> > How can I update the AutoCAD environment or my VB environment to
> reflect
> > the fact that I have AutoCAD running.
> >
> > I can't set the MS (ModelSpace) variable. That's the first one that
> > causes trouble, but I'm sure the others would return the same message
> > because when I look at the DOC object in the watch window, "No Database"
> is
> > the value of almost all of the objects.
> >
> > Any help is appreciated. Thank you.
> >
> > Sincerely,
> >
> > Michael Madrid
> >
>
0 Likes