Load this and type SYSVAR at the command prompt. It will echo any sysvar
change to the command line.
(defun sysvarChanged (reactor info)
(princ (strcat "\n" (car info) " "))
(princ (getvar (car info)))
(princ ", ")
(princ)
)
(defun c:sysvar (/ ans)
(initget 0 "on off")
(setq ans (getkword "\nTurn sysvar echo [on/]: "))
(cond
((not ans)(setq ans 5))
((= (strcase ans) "ON")(setq ans 3))
(T (setq ans 5))
)
(reac:state '(vlr-sysvar-reactor nil '((:vlr-sysvarChanged .
sysvarChanged))) ans)
(princ)
)
;;;tests for constructed "reactor"
;;;syntax: (REAC:STATE 'reactor mode)
;;;arguments: reactor - quoted typical reactor construction syntax, mode -
intiger 0-7
;;;usage: (REAC:STATE '(VLR-Command-Reactor nil '((:VLR-commandWillStart .
TEST))) 1)
;;;"mode" 0 constructs "reactor" once even if already constructed
;;;"mode" 1 constructs "reactor" once if "reactor" has not already been
constructed
;;;"mode" 2 removes first constructed "reactor" with matching "event" and
"call", then constructs once
;;;"mode" 3 removes *all* constructed "reactor"s with matching "event" and
"call", then constructs once
;;;"mode" 4 removes first constructed "reactor" with matching "event" and
"call"
;;;"mode" 5 removes *all* constructed "reactor"s with matching "event" and
"call"
;;;"mode" 6 removes *all* constructed "reactor"s with matching "event"
regardless of "call"
;;;"mode" 7 removes *all* constructed "reactor"s regardless of "call" or
"event"
;;;returns last VLR object acted upon, else nil
(defun reac:state (reactor mode / call reaction rname vlrobj)
(setq call (eval (caddr reactor))
event (caar call)
rname (read (strcat ":" (vl-symbol-name (car reactor))))
)
(if (> mode 0)
(foreach itm (cdar (vlr-reactors rname))
(setq reaction (vlr-reactions itm))
(cond
(
(and (= mode 1)(equal call reaction))
(setq reactor nil)
)
(
(or
(and (= mode 2)(not vlrobj)(equal call reaction))
(and (= mode 3)(equal call reaction))
(and (= mode 4)(not vlrobj)(equal call reaction))
(and (= mode 5)(equal call reaction))
(and (= mode 6)(equal event (caar reaction)))
(= mode 7)
)
(setq vlrobj (vlr-remove itm))
)
)
)
)
(if (and (< mode 4) reactor)(setq vlrobj (eval reactor)))
vlrobj
)
--
Regards,
Eric S.
eschneider@jensenprecast.com