MikeP Posted October 19, 2011 Posted October 19, 2011 when I created this, it worked fine. changed the command line color and had no errors. now its telling me Program ERROR Resetting environment ; error: An error has occurred inside the *error* functionbad argument type: consp nil (defun c:PST (/ pickstyle) (if (= (getvar "pickstyle") 1) (setvar "pickstyle" 0) (setvar "pickstyle" 1)) (if (= (getvar "pickstyle") 1) (CmdCol 255 0 0) (CmdCol 255 255 255)) (defun CmdCol (r g b) (vl-load-com) (vla-put-TextWinBackgrndColor (vla-get-Display (vla-get-Preferences (vlax-get-acad-object))) (+ r (* 256 g) (* 65536 b)))) (princ (getvar "pickstyle")) (princ) ) Quote
Lee Mac Posted October 19, 2011 Posted October 19, 2011 Since your code does not define a local *error* function, it appears that you are running other LISP routines which are overriding the default *error* function and not resetting it (see here for more info). This won't solve your problems, but will give more information about the error; type at the command-line: (setq *error* nil) Then re-run your above code. Move your IF statements below the CmdCol function definition, since otherwise the function is not defined when you call it. Lee Quote
MikeP Posted October 19, 2011 Author Posted October 19, 2011 thanks. it now says this Command: pst ; error: no function definition: CMDCOL to I added "cmdcol" to the definitions but still get the same error (defun c:PST (/ pickstyle CmdCol) (if (= (getvar "pickstyle") 1) (setvar "pickstyle" 0) (setvar "pickstyle" 1)) (if (= (getvar "pickstyle") 1) (CmdCol 255 0 0) (CmdCol 255 255 255)) (defun CmdCol (r g b CmdCol) (vl-load-com) (vla-put-TextWinBackgrndColor (vla-get-Display (vla-get-Preferences (vlax-get-acad-object))) (+ r (* 256 g) (* 65536 b)))) (princ (getvar "pickstyle")) (princ) ) Quote
Tharwat Posted October 19, 2011 Posted October 19, 2011 Remove the variable CmdCol from the sub-function and try again Quote
Lee Mac Posted October 19, 2011 Posted October 19, 2011 Move your IF statements below the CmdCol function definition, since otherwise the function is not defined when you call it. ^^ Re-read. Quote
MikeP Posted October 19, 2011 Author Posted October 19, 2011 ok this one works now (defun c:PST (/ pickstyle CmdCol) (defun CmdCol (r g b ) (vl-load-com) (vla-put-TextWinBackgrndColor (vla-get-Display (vla-get-Preferences (vlax-get-acad-object))) (+ r (* 256 g) (* 65536 b)))) (if (= (getvar "pickstyle") 1) (setvar "pickstyle" 0) (setvar "pickstyle" 1)) (if (= (getvar "pickstyle") 1) (CmdCol 255 0 0) (CmdCol 255 255 255)) (princ (getvar "pickstyle")) (princ) ) Quote
MikeP Posted October 19, 2011 Author Posted October 19, 2011 ^^ Re-read. missed that the first time. did that and removed the subfunction def. now works thanks Quote
Lee Mac Posted October 19, 2011 Posted October 19, 2011 missed that the first time. did that and removed the subfunction def.now works thanks Good stuff. But you might want to still investigate the issue with the *error* function not being reset in another LISP program you are running. Quote
MikeP Posted October 19, 2011 Author Posted October 19, 2011 Good stuff. But you might want to still investigate the issue with the *error* function not being reset in another LISP program you are running. i read through that link you send. Im still not sure to find a error in another program. I understand it might not be resetting be cause i may have hit esc while a command was half completed. but im not sure how to track it down Quote
Recommended Posts
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.