Jump to content

Recommended Posts

Posted

Back in the day (Autocad 14 or so) the autolisp interpreter would spit out the variable names in the line of code that bombed instead of the values (example below), making it much easier find the problem. This may be a newbie question from an old-timer. I never took the pains to learn the VLIDE. Is there something there that solves the problem?

 

Error: bad argument type: numberp: nil
Backtrace:
[0.57] (VL-BT)
[1.53] (#<SUBR @0000018680e21a98 -lambda-> "bad argument type: numberp: nil")
[2.49] (ill-fun-hk "bad argument type: numberp: nil")
[3.44] (((MSG) (IF (NOT (MEMBER MSG (QUOTE ("console break" "Function cancelled" "quit / exit abort" "")))) (PROGN (PRINC (STRCAT "\nError: " MSG)) (IF *DEBUG* (VL-BT))))) "bad argument type: numberp: nil")
[4.39] (_call-err-hook ((MSG) (IF (NOT (MEMBER MSG (QUOTE ("console break" "Function cancelled" "quit / exit abort" "")))) (PROGN (PRINC (STRCAT "\nError: " MSG)) (IF *DEBUG* (VL-BT))))) "bad argument type: numberp: nil")
[5.33] (sys-error "bad argument type: numberp: nil")
:ERROR-BREAK.28 nil
[6.25] (- nil 8.48089)
[7.19] (C:GT)
[8.15] (#<SUBR @0000018680872c50 -rts_top->)
[9.12] (#<SUBR @00000186807c8700 veval-str-body> "(C:GT)" T #<FILE internal>)
:CALLBACK-ENTRY.6 (:CALLBACK-ENTRY)
:ARQ-SUBR-CALLBACK.3 (nil 0)
 

Posted

Hi
If you need to locate where the error occurred during execution, once it has happened, press CTRL-F9 and VLIDE will show you the expression where the error occurred, highlighted.
I hope this answers your question correctly

Posted

Thank you for the reply, but sad to say I do not even know how to execute a program from the vlide.

Posted (edited)

FWIW, the output you are describing comes from the undocumented (vl-bt) function, e.g.:

(defun c:test ( / *error* )
    (defun *error* ( m ) (vl-bt) (princ))
    (/ 1 0)
)

 

Command: TEST Backtrace:
[0.50] (VL-BT)
[1.46] (*ERROR* "divide by zero") LAP+7
[2.40] (_call-err-hook #<USUBR @0000021d551441b0 *ERROR*> "divide by zero")
[3.34] (sys-error "divide by zero")
:ERROR-BREAK.29 "divide by zero"
[4.26] (/ 1 0)
[5.20] (C:TEST) LAP+33
[6.15] (#<SUBR @0000021d55144278 -rts_top->)
[7.12] (#<SUBR @0000021d532d8700 veval-str-body> "(C:TEST)" T #<FILE internal>)
:CALLBACK-ENTRY.6 (:CALLBACK-ENTRY)
:ARQ-SUBR-CALLBACK.3 (nil 0)
Edited by Lee Mac
Posted

Thanks for responding. That is correct. I put (vl-bt) in my *error* functions, otherwise I have zero idea where the error occurred. However, I don't know the name of the variable in the errant line of code, only the values. That isn't always easy to spot.

 

I was able to load and run code thru the vlide, but using CNTL-F9 did not show the line where the error occurred, just this dialog.

image.png.4b5db5da2145a0d7ec85e5514a9620c3.png

 

And setting "Break on Error" didn't do what AI told me it would...When it crashes, VLIDE will freeze the execution and highlight the problematic line in your source code.

Posted
9 minutes ago, Lee Mac said:

Perhaps my tutorial on debugging with the VLIDE will help?

 

https://lee-mac.com/debugvlide.html

 

Thanks again. I just need to remember that CNTL F9 only works when I do not mouse-click on vlisp console first.

Posted

You might want to look into using Visual Studio Code, it is replacing the VLIDE in newer AutoCAD versions.

 

I have some links to more information in this thread...

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...