Disclaimer: I am asking before I even try, so be nice.
I have this code to make sure MLeader, QLeader, and Leader are on the Dimensions layer.
Code:
;;;
;;; Leaders on "Dimensions" layer reactor
;;;
(IF (NOT |leader_reactor|)
(SETQ |leader_reactor|
(VLR-COMMAND-REACTOR
nil
'((:VLR-COMMANDWILLSTART . startleadercommand)
(:VLR-COMMANDENDED . endleadercommand)
(:VLR-COMMANDCANCELLED . cancelleadercommand)
)
) ;_ end of VLR-COMMAND-REACTOR
) ;_ end of SETQ
) ;_ end of IF
(DEFUN startleadercommand
(calling-reactor startcommandinfo / |commandstart|)
(SETQ |leader_clayer| (GETVAR "clayer"))
(SETQ |commandstart| (CAR startcommandinfo))
(IF (OR (= |commandstart| "LEADER")
(= |commandstart| "MLEADER")
(= |commandstart| "QLEADER")
) ;_ end of OR
(SETVAR "clayer" "DIMENSIONS")
) ;_ end of IF
(PRINC)
) ;_ end of DEFUN
(DEFUN endleadercommand (calling-reactor endcommandinfo / |commandend|)
(SETQ |commandend| (CAR endcommandinfo))
(IF (OR (= |commandend| "LEADER")
(= |commandend| "MLEADER")
(= |commandend| "QLEADER")
) ;_ end of OR
(SETVAR "clayer" |leader_clayer|)
) ;_ end of IF
(PRINC)
) ;_ end of DEFUN
(DEFUN cancelleadercommand
(calling-reactor cancelcommandinfo / |commandcancel|)
(SETQ |commandcancel| (CAR cancelcommandinfo))
(IF (OR (= |commandcancel| "LEADER")
(= |commandcancel| "MLEADER")
(= |commandcancel| "QLEADER")
) ;_ end of OR
(SETVAR "clayer" |leader_clayer|)
) ;_ end of IF
(PRINC)
) ;_ end of DEFUN
I would like to make another one for XLines.
1. Can I have multiple reactors defined?
2. Will a reactor still work to force the XLine on a specific layer if the command is called from inside a LISP? I have a LISP that does XLH and XLV. And another one that puts an H and a V at 0,0.
So please, if you would, just drop some help, advice, or insight on reactors and making them play pretty.
Thanks,
MC