TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: baitang36 on February 06, 2023, 08:26:17 PM

Title: A bug in acad2008
Post by: baitang36 on February 06, 2023, 08:26:17 PM
(princ '(150 . 1))     ; There will be error
(princ '(149 . 1))     ;No error
Title: Re: A bug in acad2008
Post by: kdub_nz on February 06, 2023, 08:37:02 PM
What is the error ?

Load something like this before running your code.

Code - Auto/Visual Lisp: [Select]
  1. (defun *error* (msg)
  2.     ;;----- Cancel any Active Commands --
  3.     (while (< 0 (getvar 'cmdactive)) (command-s nil))
  4.     (setvar 'menuecho 1)
  5.     ;;----- Display error message if applicable
  6.     (cond ((not msg))
  7.           ((member (strcase msg t)
  8.                    '("console break"
  9.                      "function cancelled"
  10.                      "quit / exit abort"
  11.                     )
  12.            )
  13.            (princ "\nFunction Cancelled.")
  14.           )
  15.           ((princ (strcat "\nApplication Error: "
  16.                           (itoa (getvar 'errno))
  17.                           " :- "
  18.                           msg
  19.                   )
  20.            )
  21.            ;;----- Display backtrace ------------------------------------------
  22.            (vl-bt)
  23.           )
  24.     )
  25.     (setvar 'errno 0)
  26.     )
  27.     (princ)
  28.   )
  29.  
  30.  
Title: Re: A bug in acad2008
Post by: baitang36 on February 06, 2023, 08:46:17 PM
What is the error ?

Load something like this before running your code.

Code - Auto/Visual Lisp: [Select]
  1. (defun *error* (msg)
  2.     ;;----- Cancel any Active Commands --
  3.     (while (< 0 (getvar 'cmdactive)) (command-s nil))
  4.     (setvar 'menuecho 1)
  5.     ;;----- Display error message if applicable
  6.     (cond ((not msg))
  7.           ((member (strcase msg t)
  8.                    '("console break"
  9.                      "function cancelled"
  10.                      "quit / exit abort"
  11.                     )
  12.            )
  13.            (princ "\nFunction Cancelled.")
  14.           )
  15.           ((princ (strcat "\nApplication Error: "
  16.                           (itoa (getvar 'errno))
  17.                           " :- "
  18.                           msg
  19.                   )
  20.            )
  21.            ;;----- Display backtrace ------------------------------------------
  22.            (vl-bt)
  23.           )
  24.     )
  25.     (setvar 'errno 0)
  26.     )
  27.     (princ)
  28.   )
  29.  
  30.  



command: (LOAD "D:/ttt1.lsp") *ERROR*
command: (princ '(150 . 1))
(150 . 1)(150 . 1)
Application error: Wrong parameter type

command: (princ '(149 . 1))
(149 . 1)(149 . 1)
Title: Re: A bug in acad2008
Post by: kdub_nz on February 06, 2023, 09:17:52 PM
It's a few years since I've used ac2008.
Nothing comes to mind that would cause the issue.

Both statements work as I'd expect in ac2023.
Title: Re: A bug in acad2008
Post by: Marc'Antonio Alessi on February 07, 2023, 02:37:49 AM
Code: [Select]
Magic numbers (AutoCAD 2013 - no error in 2023)
Command: (list '(218 127 252))
((218 127 252))


Command: (list '(219 127 252))
((219 127 252))


Command: (list '(220 127 252))
((220 127 252))
Errore dell'applicazione: Bad argument type


Command: (list '(221 127 252))
((221 127 252))
Errore dell'applicazione: Bad argument type


Command: (list '(222 127 252))
((222 127 252))
Errore dell'applicazione: Bad argument type


Command: (list '(223 127 252))
((223 127 252))
Errore dell'applicazione: Bad argument type


Command: (list '(224 127 252))
((224 127 252))
Errore dell'applicazione: Bad argument type


Command: (list '(225 127 252))
((225 127 252))
Errore dell'applicazione: Bad argument type


Command: (list '(226 127 252))
((226 127 252))
Errore dell'applicazione: Bad argument type


Command: (list '(227 127 252))
((227 127 252))
Errore dell'applicazione: Bad argument type


Command: (list '(228 127 252))
((228 127 252))
Errore dell'applicazione: Bad argument type


Command: (list '(229 127 252))
((229 127 252))
Errore dell'applicazione: Bad argument type


Command: (list '(230 127 252))
((230 127 252))
Errore dell'applicazione: Bad argument type


Command: (list '(231 127 252))
((231 127 252))
Errore dell'applicazione: Bad argument type


Command: (list '(232 127 252))
((232 127 252))
Errore dell'applicazione: Bad argument type


Command: (list '(233 127 252))
((233 127 252))
Errore dell'applicazione: Bad argument type


Command: (list '(234 127 252))
((234 127 252))
Errore dell'applicazione: Bad argument type


Command: (list '(235 127 252))
((235 127 252))
Errore dell'applicazione: Bad argument type


Command: (list '(236 127 252))
((236 127 252))
Errore dell'applicazione: Bad argument type


Command: (list '(237 127 252))
((237 127 252))
Errore dell'applicazione: Bad argument type


Command: (list '(238 127 252))
((238 127 252))
Errore dell'applicazione: Bad argument type


Command: (list '(239 127 252))
((239 127 252))
Errore dell'applicazione: Bad argument type


Command: (list '(240 127 252))
((240 127 252))


Command: (list '(241 127 252))
((241 127 252))