Results 1 to 2 of 2

Thread: why does reactor still work after I have delete the reactor object?

  1. #1
    Member
    Join Date
    2009-08
    Posts
    3
    Login to Give a bone
    0

    Default why does reactor still work after I have delete the reactor object?

    Hi,another problem.
    I'am trying to bind to "insert" together, I mean move together: where i move one of them, the other one moves at the same step.
    Here's my code.
    Code:
    (vl-load-com)
    (defun c:demo ( / ena1 goon ena2 rec_obj_list p1 p2 bindInsertReactor)
        (while 
            (setq ena1 (car (entsel "\n请选择一个块:"))
                  goon (or (= ena1 nil) (/= "INSERT" (cdr (assoc 0 (entget ena1)))))
            )
        )
        (while
            (setq ena2 (car (entsel "\n请选择第二个块:"))
                  goon (or (= ena2 nil) (/= "INSERT" (cdr (assoc 0 (entget ena2)))))
            )
        )
        (setq rec_obj_list (list (vlax-ename->vla-object ena1) (vlax-ename->vla-object ena2))
              p1 (cdr (assoc 10 (entget ena1)))
              p2 (cdr (assoc 10 (entget ena2)))
              bindInsertReactor (vlr-object-reactor rec_obj_list (list (list ena1 p1) (list ena2 p2) ) 
                                                    '((:vlr-modified . movetogether))
                                )
        )
    	(princ "\n两个块已绑定.")
        (princ)
    )
    (defun pointfunc (pt1 pt2 f)
        (list (f (car pt1) (car pt2))
              (f (cadr pt1) (cadr pt2))
              (f (caddr pt1) (caddr pt2))
        )
    )
    (defun movetogether (notifier-object reactor-object callback-data
                         /
                         objs data ena1 p1 ena2 p2 ent1 np1 ent2 np2 rp1 rp2 )
        (setq objs (vlr-owners reactor-object)
    		  data (vlr-data reactor-object)
    		  ena1 (car (car data))
              p1   (cadr (car data))
              ena2 (car (cadr data))
              p2   (cadr (cadr data))
              ent1 (entget ena1)
              np1  (cdr (assoc 10 ent1))
              ent2 (entget ena2)
              np2  (cdr (assoc 10 ent2))
              rp1  (pointfunc np1 p1 -)
              rp2  (pointfunc np2 p2 -)
              p1   (pointfunc p1 rp2 +)
              p2   (pointfunc p2 rp1 +)
              ent1 (subst (cons 10 p1) (assoc 10 ent1) ent1)
              ent2 (subst (cons 10 p2) (assoc 10 ent2) ent2)
        )
        (vlr-remove reactor-object)
        (entmod ent1)
        (entmod ent2)
        (princ)
    )
    while , after I moved one of them one time , the stentence (vlr-remove reactor-object) was executed, and the reactor-object must be deleted and the reactor-object was disabled.
    Am I right?
    And then , I moved one of the two and the other still move together...
    and (vlr-reactors) returned nil at this time.
    where is the problem? help me ,please.

    thank you ,all.

  2. #2
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: why does reactor still work after I have delete the reactor object?

    It should work that way. Maybe because it's an object reactor you should actually use the vlr-owner-remove instead? Maybe the vlr-remove works like purge, i.e. if there's still an object attached to the reactor it can't be "removed" (or rather disabled).

Similar Threads

  1. Modified Object Reactor
    By bweir in forum AutoLISP
    Replies: 5
    Last Post: 2017-03-25, 03:04 PM
  2. Replies: 4
    Last Post: 2013-08-27, 10:30 PM
  3. Torrent Reactor Routines Will Not Work Together
    By playerdraft in forum AutoLISP
    Replies: 33
    Last Post: 2010-08-06, 05:34 PM
  4. why does vlr-insert-reactor doesn't work?
    By tangchang_21 in forum AutoLISP
    Replies: 2
    Last Post: 2009-08-13, 01:28 PM
  5. Reactor doesn't work in Acad2005
    By Borg in forum AutoLISP
    Replies: 0
    Last Post: 2005-01-18, 08:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •