CAD Forums > New to CAD
System Varaible For Dialog Box
cadtag:
On the other hand, it would _not_ be hard to add a snippet of information to the command line file prompt for any file open/save operation, something on the order of "Enter ~ to use a file dialog for this operation, or ! to reset the file dialogs to ON"
the first part already works, but is not well known. the latter function could be added readily
Lee Mac:
You could use a reactor to monitor the System Variables that are being changed, something like:
--- Code: ---(setq *sysvars* '("FILEDIA" "CMDDIA")) ;; Sys Vars to monitor
(defun c:svrON nil
(if (null *sysvarreactor*)
(setq *sysvarreactor*
(vlr-sysvar-reactor nil
'(
(:vlr-sysvarchanged . notify)
(:vlr-sysVarWillChange . getvalue)
)
)
)
(princ "\nSystem Variable Reactor already running.")
)
(princ)
)
(defun c:svrOFF nil
(if *sysvarreactor*
(progn (vlr-remove *sysvarreactor*) (setq *sysvarreactor* nil))
(princ "\nSystem Variable Reactor not running.")
)
(princ)
)
(defun getvalue ( reactor params )
(if (member (strcase (car params)) *sysvars*)
(setq *value* (getvar (car params)))
)
(princ)
)
(defun notify ( reactor params )
(if
(and
(cadr params)
(member (strcase (car params)) *sysvars*)
*value*
)
(progn
(princ
(strcat
"\n" (car params) " changed from "
(vl-princ-to-string *value*) " to "
(vl-princ-to-string (getvar (car params)))
)
)
(setq *value* nil)
)
)
(princ)
)
(vl-load-com) (princ)
--- End code ---
Type 'svrON' to start the reactor, and 'svrOFF' to turn it off.
Now, when a System Variable is changed:
--- Code: ---Command: filedia
Enter new value for FILEDIA <1>: 0
FILEDIA changed from 1 to 0
--- End code ---
:-)
mjfarrell:
--- Quote from: SDETERS on August 23, 2011, 12:40:20 pm ---I crashed Autocad trying to import an IGES file. :realmad: After the crash no more dialog boxes. It is now fixed.
--- End quote ---
This is the issue that I was specifically speaking to in my post. Not the results of BAD coding habits, or even bad code in general. As one would anticipate that someone writing code would turn the dialog boxes on and or off as required by their code, as well as setting the requisite value for expert mode.
The issue is that the software does terminate abnormally, i.e. CRASHES. Autodesk knows this and yet it still allows those two variables (CMDDIA, and FILEDIA) to get switch off when one restarts from said crash. Given that they even wrote a Recovery Manager we know they must know that their applications can and do crash. It would have probably taken less effort to make those variables NON VOLATILE than it took to create the Recovery Manager.
And then this issue that has been around for DECADES would be gone.
Navigation
[0] Message Index
[*] Previous page
Go to full version