Thought I would share some simple tools that I use in dealing with AutoCAD's set variables, especially the boolean ones that take 0 or 1 as values. The first two simply set the value to 0 or 1:
(defun setvar0 (setv)(setvar setv 0))
(defun setvar1 (setv)(setvar setv 1))
Now we have a function that toggles the given setvar to its opposite value:
(defun setvar-not (setv)(setvar setv (if (zerop (getvar setv)) 1 0)))
And now we make a handy new if-then conditional that works with set variables:
(defun setvar-if (setv a b)(eval (if (zerop (getvar setv)) a b)))
So if the setvar is 0 then expression A is evaluated else B is. These might seem trivial but are actually quite handy. Have fun!!