geo Posted November 25, 2008 Share Posted November 25, 2008 I found a couple of other LISP toggles on this website but am unsure how to edit them to create a lisp routine for a LWT toggle. Any help will be appreciated. Quote Link to comment Share on other sites More sharing options...
lpseifert Posted November 25, 2008 Share Posted November 25, 2008 (defun c:lwt () (if (= (getvar "lwdisplay") 1) (setvar "lwdisplay" 0) (setvar "lwdisplay" 1) ) ) or you could just click on the LWT button on the status bar Quote Link to comment Share on other sites More sharing options...
BOB'27T Posted November 25, 2008 Share Posted November 25, 2008 Or set the LWDISPLAY to 1. Quote Link to comment Share on other sites More sharing options...
geo Posted November 26, 2008 Author Share Posted November 26, 2008 Thanks lpseifert, i needed this rountine to run as part of another lisp routine. Clicking the LWT button is the easy way to do this but doesnt suit my app. Cheers Quote Link to comment Share on other sites More sharing options...
CarlB Posted November 26, 2008 Share Posted November 26, 2008 And to save a tiny bit of storage space (defun c:lwt () (setvar "lwdisplay" (- 1 (getvar "lwdisplay")) ) Quote Link to comment Share on other sites More sharing options...
lpseifert Posted November 26, 2008 Share Posted November 26, 2008 cool trick Carl, I'd have thunk there should be an (abs in there... you learn something new every day. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 26, 2008 Share Posted November 26, 2008 Good point lpseifert - Obviously Carl's code needs an extra right parenthesis, but this aside, why does it not require an (abs)? If you type: (setvar "lwdisplay" -1) in the command line, ACAD rejects the variable setting. So how can this code work without the (abs)? Quote Link to comment Share on other sites More sharing options...
CarlB Posted November 27, 2008 Share Posted November 27, 2008 There would be no negative result, try it: It's either : 1-1=0 or 1-0=1 Yup, I missed a dang paren Quote Link to comment Share on other sites More sharing options...
lpseifert Posted November 27, 2008 Share Posted November 27, 2008 Upon further review... I mistakenly read (- 1 as 'subtract 1 from' even though I know better. Gotta start to thinking in 'lisp'. Quote Link to comment Share on other sites More sharing options...
wizman Posted November 27, 2008 Share Posted November 27, 2008 And to save a tiny bit of storage space (defun c:lwt () (setvar "lwdisplay" (- 1 (getvar "lwdisplay")) ) a nice one carlb, you need to put your name there, let's call it carlbtoggler.... Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 27, 2008 Share Posted November 27, 2008 Of course.... I read it the same as lpseifert - subtracting 1 from whichever value the variable is set at. But I take my hat off to you (if I had one), a simple and clever bit of coding indeed. Quote Link to comment Share on other sites More sharing options...
CarlB Posted November 27, 2008 Share Posted November 27, 2008 Thanks guys, but I get no credit for coming up with that code, just remembering it Saw it here years ago, here's a discussion of a tilemode toggle, with a few code variations: http://www.cadtutor.net/forum/showthread.php?t=7442 Quote Link to comment Share on other sites More sharing options...
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.