CAD PANACEA HAS MOVED TO http://cadpanacea.com
06 March 2007
System Variables changing on their own?          

Have you ever set a system variable and then you are working along and that sysvar is changed to a different value? Many people will ask how or why it "changed itself", which obviously it can't do. Of course what is really going on is a program, whether it be an internally defined command, or a lisp/VBA/ARX routine, has changed it.

So you what if you never typed in SETVAR and changed a variable? What if you made a change to something in the OPTIONS dialog and then it changed "on it's own"?  Many of the settings in the OPTIONS dialog are actually system variables. Look on the Open and Save tab of the Options dialog. If you turn Automatic Save off or change the "Minutes between saves" time, you are actually changing the system variable SAVETIME. On the Drafting tab, changing the AutoSnap Settings changes the AUTOSNAP system variable. There are many more.

So let's rephrase the theme here. You make a change to some setting in AutoCAD, and it doesn't stick. So why is it changing? Let's go back to the Autosave time. You turn it on and set it to 5 minutes, but you check it later and it is turned off. Wouldn't it be nice to be alerted when this setting is changed? Then you would have a pretty good clue as to what is changing it.

Here is some lisp code that will "monitor" a given system variable for changes. In the example below, the sysvar we are going to monitor is SAVETIME. Replace that with the name of the sysvar that you want to monitor, load the code and run the command ALERTME, then get back to work. If and when the sysvar is changed, you will be alerted.

If you want to see this in action, load the code exactly as printed below, run the ALERTME command, and then run the ._PUBLISH command (which changes SAVETIME).

 

Credit Peter Jamtgaard with this code
;--------------------------------------
(defun C:ALERTME ()
(vl-load-com)
(setq VTFRXN (vlr-editor-reactor nil '((:VLR-sysVarChanged . VTF))))
)

(defun VTF (CALL CALLBACK)
(if (= (strcase (car CALLBACK)) (setq str "SAVETIME"))
(alert (strcat str " has been changed "))
)
)
;---------------------------------------


Labels:


PermaLink       Posted 3/06/2007 07:24:00 AM     
4 COMMENTS!


Comment from: Blogger Unknown
Date: March 6, 2007 at 1:28:00 PM CST  

DOES THIS WORK WITH THE PROFILE CHANGING, IF SO WHAT IS THE SYSTEM VARIABLE THAT WOULD CHANGE A CURRENT PROFILE TO ANOTHER? THIS HAS HAPPENED SEVERAL TIMES TO ME BEFORE AND I HAVE NOT BEEN ABLE TO FIGURE IT OUT. PLEASE LET ME KNOW. THIS IS AN AWESOME TOOL THOUGH. THANK YOU


Comment from: Blogger R.K. McSwain
Date: March 6, 2007 at 2:12:00 PM CST  

CPROFILE is the variable you are looking for, but I have not tried it.


Comment from: Blogger Unknown
Date: March 7, 2007 at 1:14:00 PM CST  

YEAH I LOCATED THE VARIABLE CPROFILE, BUT I AM NOT EXACTLY SURE WHAT WOULD CAUSE THAT TO CHANGE. BUT THANKS FOR THE INFO.


Comment from: Anonymous Anonymous
Date: June 10, 2008 at 10:38:00 AM CDT  

Okay, this works well, but how do I turn it back off. i can't unload it via "Appload" and typing the command in again doesn't do it either. I'm a total lisp newbie so maybe I just missed something?

Post a comment