VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

retrieving error

10 REPLIES 10
Reply
Message 1 of 11
Anonymous
192 Views, 10 Replies

retrieving error

Is it possible to retrieve the last error from CAD, and how do I do this? I
was thinking that an err number or description would be saved in a system
variable or somewhere. Any ideas?

Jade
10 REPLIES 10
Message 2 of 11
Ed.Jobe
in reply to: Anonymous

Use the Err object. It returns all errors, system etc. Look in the help for more info.

Msgbox Err.Number & ", " & Err.Description

Ed

EESignature

Message 3 of 11
Anonymous
in reply to: Anonymous

Im using VB opening AutoCAD and running an update
on a list of drawings.  If the drawing has an error autoCAD generates the
error message not VB.  VB just sees it as the drawing is doing something,
and it just waits.


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Use
the Err object. It returns all errors, system etc. Look in the help for more
info.

Msgbox Err.Number & ", " &
Err.Description

Message 4 of 11
Anonymous
in reply to: Anonymous

LastError = ThisDrawing.GetVariable("ERRNO")

Jade Jacobsen wrote:

> Im using VB opening AutoCAD and running an update on a list of
> drawings. If the drawing has an error autoCAD generates the error
> message not VB. VB just sees it as the drawing is doing something, and
> it just waits.
>
> "Ed_Jobe" wrote in message news:f0e96bb.0@WebX.maYIadrTaRb...
>
> Use the Err object. It returns all errors, system etc. Look in the
> help for more info.
>
> Msgbox Err.Number & ", " & Err.Description
>
Message 5 of 11
Anonymous
in reply to: Anonymous

By the way, what error message are you refering to? Ed's right, it
should throw a flag unless your running a script, using sendcommand, ect.
-Josh
Message 6 of 11
Anonymous
in reply to: Anonymous

I have a exe that reloads the labels on a drawing, and I just built a new
program that opens a list of drawings and runs the label update exe. Im
sending (startapp "labels.exe reloadall") to the command line when the
drawing is opened. The problem is if the drawing being opened has an error,
my program sits, waiting for the user to answer the AutoCAD dialog.
I need a way to trap that error so i can skip that drawing, log the error
and move to the next drawing.

Hope that helps.

Thanks for the replies,
Jade
"Minkwitz Design" wrote in message
news:3D07B567.4040905@ameritech.net...
> By the way, what error message are you refering to? Ed's right, it
> should throw a flag unless your running a script, using sendcommand, ect.
> -Josh
>
>
Message 7 of 11
Ed.Jobe
in reply to: Anonymous

In your sub that opens the dwgs, add some error handling.

On Error GoTo ErrHandler
'rest of sub here
Exit Sub
ErrHandler:
Msgbox Err.Number & vbCrLf & Err.Description
End Sub

Now run the sub on a bad dwg and note the error number. Change the previous error handler's Msgbox line with an if statement to trap the error.

ErrHandler:
If Err.Number = 1 Then 'sub the number you noted before.
'Do your logging
'Exit Sub
End If
End Sub

Ed

EESignature

Message 8 of 11
Anonymous
in reply to: Anonymous

Do you mean drawings with errors or drawings that are read only?
Message 9 of 11
Anonymous
in reply to: Anonymous

The problem I see is even if you were able to retireve a drawing releated
error (I'm assuming we're talking drwaings that need to be recovered etc..),
it would be too late to do anything about it. You need to peek into the
database to discover this before opening the drawing... maybe ODX supports
this (?) ...anyone?

Regards,
Jacob Dinardi


"Jade Jacobsen" wrote in message
news:BDAF344268606E9665B0BE46BAC5D774@in.WebX.maYIadrTaRb...
> I have a exe that reloads the labels on a drawing, and I just built a new
> program that opens a list of drawings and runs the label update exe. Im
> sending (startapp "labels.exe reloadall") to the command line when the
> drawing is opened. The problem is if the drawing being opened has an
error,
> my program sits, waiting for the user to answer the AutoCAD dialog.
> I need a way to trap that error so i can skip that drawing, log the error
> and move to the next drawing.
>
> Hope that helps.
>
> Thanks for the replies,
> Jade
> "Minkwitz Design" wrote in message
> news:3D07B567.4040905@ameritech.net...
> > By the way, what error message are you refering to? Ed's right, it
> > should throw a flag unless your running a script, using sendcommand,
ect.
> > -Josh
> >
> >
>
>
Message 10 of 11
Anonymous
in reply to: Anonymous

It doesnt matter if the drawing is corrupt or
needing to be recovered or is just read only.  If I could get something
back, then I could just force the drawing closed, and move to the next
one. 

I think I may have need to trap the modal form for
the err with an api call...



style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Im using VB opening AutoCAD and running an update
on a list of drawings.  If the drawing has an error autoCAD generates the
error message not VB.  VB just sees it asthe drawing is doing something,
and it just waits.


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Use
the Err object. It returns all errors, system etc. Look in the help for more
info.

Msgbox Err.Number & ", " &
Err.Description

Message 11 of 11
antoney
in reply to: Anonymous

Hi Jade,
could you able to fix this issue? Which api call help you to handle this?I am also having the same problem need to fix it somehow...please help me
Thanks
Anjana

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost