Jump to content

Recommended Posts

Posted

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)
)

Posted

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

Posted

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)
)

Posted
Move your IF statements below the CmdCol function definition, since otherwise the function is not defined when you call it.

 

^^ Re-read.

Posted

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)
)

Posted
^^ Re-read.

 

missed that the first time. did that and removed the subfunction def.

now works

thanks

Posted
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.

Posted
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

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...