FWIW -
Command reactor(s) are great, but I really think you need to look into an AcDb Reactor instead, given that you want to test the Object(s) being added for a specific component... It's far easier to do this with an AcDb Reactor (at the time the Object is added to the Database), than to iterate a selection set of all like Objects post-CommandCancelled/Ended/Failed Event. Just a thought.
Separately, when using Reactors, I always make a habit of incorporating a check of some kind in order to prevent duplicate Reactors, as they can cause many problems. I also prefer to send feedback to the command line, rather than to an alert dialog, and include a 'stop' command (personal preference):
Code:
(vl-load-com)
(defun c:StartReactor ()
(or *Reactor_Command* ; If already defined, skip
(setq *Reactor_Command* ; Define new reactor
(vlr-command-reactor
"My command reactor "
'((:vlr-commandWillStart . Callback:CommandWillStart))
)
)
)
(prompt "\n >> Command reactor loaded ")
(princ)
)
(defun Callback:CommandWillStart (rea cmd)
(princ "\n Callback:CommandWillStart >> ")
(princ (car cmd))
(terpri)
)
(defun c:StopReactor ()
(if *Reactor_Command*
(progn
(vlr-remove *Reactor_Command*)
(setq *Reactor_Command* nil)
)
)
(prompt "\n >> Command reactor stopped ")
(princ)
)