bradb Posted June 9, 2009 Posted June 9, 2009 I am trying to use this in a lot of routines so I don't have to retype it all the time. But when the getin functions is call it is not setting the values. What am I doing wrong? (defun getin (/ OSM LAY) (setvar "CMDECHO" 0) (setq OSM (getvar "OSMODE") LAY (getvar "CLAYER") );end setq (setvar "OSMODE" 0) );end defun (defun getout () (setvar "CMDECHO" 1) (setvar "OSMODE" OSM) (setvar "CLAYER" LAY) (princ) );end defun Thanks for any help!! Quote
Freerefill Posted June 9, 2009 Posted June 9, 2009 Getin works, but you're setting the variables OSM and LAY to local, which means when the function is done, those values are set to nil. Thus, when you try to call getout, it's trying to set the system variables "OSMODE" and "CLAYER" to nil. Quote
JohnM Posted June 9, 2009 Posted June 9, 2009 when you kill your variables (/ osm lay) in the getin function it makes them nil when the function ends so when the getout function is called the variables osm and lay are nil. so kill the variables in the main lisp function look into error trapping and develop a global error trap to use. Quote
bradb Posted June 9, 2009 Author Posted June 9, 2009 Getin works, but you're setting the variables OSM and LAY to local, which means when the function is done, those values are set to nil. Thus, when you try to call getout, it's trying to set the system variables "OSMODE" and "CLAYER" to nil. Thanks I think I was thinking backwards on the local and global thing. Thanks again works fine. 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.