View Full Version : Making a button help
Gigliano70
2008-04-21, 06:23 PM
I would like to make a button that switches a sysvar. such as
SPACESWITCH = 1 to SPACESWITCH = 0 and back again. I don't care if it's two buttons as i don't use buttons much anyways. So I have some real estate to fill. i would prefer (1) smart button though that does both. is there anybody out there smarter than me in this area that knows a macro that would do the trick.
ccowgill
2008-04-21, 06:34 PM
I would like to make a button that switches a sysvar. such as
SPACESWITCH = 1 to SPACESWITCH = 0 and back again. I don't care if it's two buttons as i don't use buttons much anyways. So I have some real estate to fill. i would prefer (1) smart button though that does both. is there anybody out there smarter than me in this area that knows a macro that would do the trick.
I wouldnt say I am smarter than you, but you could try this:
(defun c:VL ()
(if (= (getvar "SpaceSwitch") 0)
(progn
(setvar "SpaceSwitch" 1)
(princ "\nSpaceSwitch set to 1.")
);end progn
(progn
(setvar "SpaceSwitch" 0)
(princ "\nSpaceSwitch set to 0.")
);end progn
); end if
(princ)
);end defun
Gigliano70
2008-04-21, 07:18 PM
Thanks Christopher, it's perfect.
jun3lynwes250702
2009-11-05, 06:03 PM
I wouldnt say I am smarter than you, but you could try this:
(defun c:VL ()
(if (= (getvar "SpaceSwitch") 0)
(progn
(setvar "SpaceSwitch" 1)
(princ "\nSpaceSwitch set to 1.")
);end progn
(progn
(setvar "SpaceSwitch" 0)
(princ "\nSpaceSwitch set to 0.")
);end progn
); end if
(princ)
);end defun
The program was a big help for my purpose.
What do I need to do if I want this program automatically set the Sysvar to "0" and hit any button to reset it to "1"?
Thanks,
rkmcswain
2009-11-05, 06:37 PM
Here is another way...
(princ (strcat "\nSpaceSwitch is now set to " (itoa (setvar "spaceswitch" (abs (1- (getvar "spaceswitch")))))))
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.