Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted

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.

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

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