If we gave out a dictionary of terms, than everyone would understand what the geeks are saying, and we wouldn't seem so wizard-like anymore!
That function is separate (I assume you understand that far!) and would be used in your code like this:
(defun C:Test (/ SavedVars)
(princ (strcat "\nHighlight is at: " (itoa (getvar "Highlight")))) (princ (strcat "\nCmdEcho is at: " (itoa (getvar "CmdEcho")))) (princ (strcat "\nOSMode is at: " (itoa (getvar "OSMode")))) (setq SavedVars (changevars '(("highlight" . 0) ("cmdecho" . 1) ("osmode" .
512))))
(princ (strcat "\nHighlight is now at: " (itoa (getvar "Highlight")))) (princ (strcat "\nCmdEcho is now at: " (itoa (getvar "CmdEcho")))) (princ (strcat "\nOSMode is now at: " (itoa (getvar "OSMode")))) (terpri) (command "._line" pause pause "") (changevars SavedVars) (princ (strcat "\nHighlight is back to: " (itoa (getvar "Highlight")))) (princ (strcat "\nCmdEcho is back to: " (itoa (getvar "CmdEcho")))) (princ (strcat "\nOSMode is back to: " (itoa (getvar "OSMode")))) (princ)
)
--
R. Robert Bell, MCSE
www.AcadX.com
| Robert,
|
| I followed the link but don't understand half of it. Does the (list var) | portion gather all the variables into a list? And just for my own info, is | this all lisp or is some of it vba? Where do I find a dictionary of lisp | terms/commands? Personally, I think that would be one of the most helpful | resources to have. | | Deb | | | Debi, not to hijack Jamie (ok, I *am* hijacking Jamie!) but try this:
|
http://code.acadx.com/autolisp/006.htm
|
|
| --
| R. Robert Bell, MCSE
|
www.AcadX.com
|
|
| | | Of course I'm interested. I like to think I'm no fool. If someone has | | something that works and is willing to share it, why should I beat my | head | | against the wall? Thank you. How do I get my hands on it? | | | | | | Hey there Deb | | | | go to afralisp - they really do have some nice stuff. | | And I have a lovely routine for saving and restoring sysvars - interested? | | | | Jamie | | | | | | | | > Thank you. I'm still trying to learn this stuff and there are days when | I | | > despair that it will ever make sense. I think I have the very basic of | | > basics down until something like this comes along. | | > | | > Deb | | > | | > | | > That's becuase you never set the ocmd variable to the existing setting | of | | > cmdecho

| | > | | > Change the code at the beginning of your routine to do that:
| | >
| | > (setq ocmd (getvar "cmdecho"))
| | > (setvar "cmdecho" 0)
| | >
| | > Then change the end of your routine to do this:
| | >
| | > (setvar "cmdecho" ocmd)
| | >
| | > Not the cleanest mark-up of code below, but you should get the idea

| | > | | > HTH | | > -- | | > Kevin Nehls | | > | | > | | > | | > > Sure, first the error. Then the code. | | > > | | > > ; error: An error has occurred inside the *error* functionAutoCAD | | variable | | > > setting rejected: "cmdecho" nil | | > > | | > > (defun myerror (s) ; If an error (such as escape) | | > occurs | | > [SNIP] | | > > (setvar "cmdecho" ocmd) ; Restore saved modes | | > > (setvar "osmode" osmd) | | > [SNIP] | | > > (defun c:TJI ;(/ olderr uv1 ocmd osmd pt1 pt2 pt3 pt4 pt5 pt6 pt7 l | w | | > ro1 | | > > mc mb) | | > > (setq uv1 (getvar "clayer")) | | > > (setq sv1 (getvar "plinewid") | | > > osmd (getvar "osmode")) | | > [SNIP] | | > ;;ADDED THIS | | > (setq OSMD (getvar "cmdecho")) | | > > (setvar "cmdecho" 0) ;;<<<<<OCMD is never set | | > > (setvar "plinewid" 0) | | > [SNIP] | | > > (setvar "plinewid" sv1) | | > > (setvar "cmdecho" 1) ;;<<<<<should set back to OCMD | | > [SNIP] | | > ;; ADDED THIS | | > (setvar "cmdecho" OCMD) ;; LIKE THIS | | > > (setvar "clayer" uv1) | | > > (setvar "osmode" osmd) | | > | | > | | > | | > | | | | | | | | | | | |