It helps to see what you are doing.... or post the part of your code, you
think is causing the problems.
Anyway, here is little sample about Visual Lisp object reactors, to always
change a block with two attributes the value of the fist attribute with the
second one.
In this case, notice if you delete/erase any of the blocks and when undo is
issue, the reactor are kept or restore.
Make a block made with two attributes, and then test the routine....
;; code
(vl-load-com)
(defun commandended
(reactor params / atts att1 att2 text_att1 text_att2)
(if modified_list
(foreach blk modified_list
(setq atts
(reverse (vlax-safearray->list
(vlax-variant-value (vla-getattributes blk))))
att1 (car atts)
att2 (cadr atts)
text_att1 (vla-get-textstring att1)
text_att2 (vla-get-textstring att2))
(if (/= text_att2 text_att1)
(vla-put-textstring att1 (vla-get-textstring att2)))))
(setq modified_list nil))
(defun subobjmodified (owner reactor params)
(if (and (not (wcmatch (getvar "cmdnames") "UNDO,U,REDO,OOPS"))
(not (vl-position owner modified_list)))
(setq modified_list (cons owner modified_list))))
(defun C:TEST (/ obj obj_reactor)
(setq obj (vlax-ename->vla-object
(car (entsel "\nSelect block with two attributes: "))))
(if (not editor_reactor)
(setq editor_reactor
(vlr-editor-reactor
"editor"
'((:vlr-commandended . commandended)))))
(setq obj_reactor
(vlr-object-reactor
(list obj)
"obj"
'((:vlr-subobjmodified . subobjmodified))))
(princ))
(princ)
;; code
HTH
LE.
"archie999" wrote in message
news:22601160.1112176006185.JavaMail.jive@jiveforum2.autodesk.com...
> Hi,
>
> I have written a program which sets reactors to certain objects which
causes run a LISP program when they are modified - This bit works fine.
>
> I have now added a bit to remove the reactor when the object is deleted by
the user so that an error doesn't occur.
>
> But I've noticed that if the user accidently deletes the object which has
the modify reactor set on it, and then types UNDO to restore it - it comes
back but the reactor is not restored.
>
> AutoCAD users expect the UNDO command to restore everything back to its
original state - this seems not to be the case with an object that has a
reactor on it - The user wont realise that the restored objects will now not
run the LISP program when modified?
>
> (BTW I am using UNDO GROUP and UNDO END in the lisp program)
>
> Is this the case - Or am I missing something??