Results 1 to 5 of 5

Thread: Deepclone Reactor Problem

  1. #1
    Member
    Join Date
    2004-01
    Posts
    22

    Default Deepclone Reactor Problem

    I'm fairly new to the world of reactors and could do with a little guidance. I have a deepclone reactor set to carry out an action whenever a block is copied within a drawing but I have discovered that this same reactor is being triggered when I insert a block too and this is not what I want. I haven't found too much info about deeplcone reactors but I was given to believe they were not triggered by the insert process but it looks like I may have been fed a wrong 'un there. As the deepclone reactor does not pass a callback I can't filter for the action that triggered it so is there any other way I can stop the reactor being triggered by the insert? I need to stick with the deepclone method because using a command reactor doesn't work when using multiple copies, it only effects the last copy of the command.

    If anybody can shed some light on this or point me in the direction of a better method I'd be most appreciative.

    Thanks in advance.

  2. #2
    Moderator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    2,398

    Default Re: Deepclone Reactor Problem

    First, for someone who's new to reactors, you've sure started with a doozy!

    Perhaps in the code behind the insert command, a deep clone is being performed to 'insert' the objects contained within the source block into the ActiveDocument Object's database? Not really sure.

    While I use reactors daily, admittedly I've not worked with deep clone events before. Could you post your code, so others might be able to test?
    "Potential has a shelf life." - Margaret Atwood

  3. #3
    Member
    Join Date
    2004-01
    Posts
    22

    Default Re: Deepclone Reactor Problem

    Just for the purpose of testing, I have this basic bit of code which just pops up an alert on a deepclone event.

    Code:
    (defun np:rdc (reactor callback / )
      (alert "DeepClone")
    )
    (if (not DeepClone_Reactor)
      (setq DeepClone_Reactor (vlr-deepclone-reactor nil '((:vlr-enddeepclone . np:rdc))))
    )

  4. #4
    Active Member
    Join Date
    2005-12
    Posts
    58

    Default Re: Deepclone Reactor Problem

    you can try to isolate the condition in your reaction function with the following statement:
    Code:
    (not (= (getvar "cmdnames") "INSERT"))

  5. #5
    Certifiable AUGI Addict irneb's Avatar
    Join Date
    2007-07
    Location
    Jo'burg SA
    Posts
    4,344

    Default Re: Deepclone Reactor Problem

    That might catch most "inserts" - though not if the insert was done through command-less programming. You might try using a vlr-insert-reactor (:vlr-beginInsert) to set a state variable, I think it's called before the deepclone stuff. Then of course you need to clear the state variable using :vlr-endInsert / :vlr-abortInsert.

    One thing you will find a lot in reactors, is you need to test for unusual cases. It's a bit difficult to understand at first - a reactor fires regardless of what's happened before, so you need to test inside the callback using an if / cond. You might even have to add an extra reactor to test if something's already happened and set a state variable (global variable) as i'm suggesting. Then your callback needs to check this variable before doing anything.

    For an example of deepclone reactors, you could try to "understand" my code in this thread: http://forums.augi.com/showthread.ph...en-Copy-Rotate
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

Similar Threads

  1. Replies: 1
    Last Post: 2009-08-14, 01:05 PM
  2. Help Please...Problem With Reactor
    By CADdancer in forum AutoLISP
    Replies: 3
    Last Post: 2009-04-16, 10:47 PM
  3. Problem in Reactor
    By rajat_bapi_mallick in forum AutoLISP
    Replies: 8
    Last Post: 2006-01-12, 10:33 PM
  4. Possible reactor problem?
    By Coolmo in forum AutoCAD General
    Replies: 2
    Last Post: 2004-10-25, 01:41 PM
  5. Reactor help?
    By kieren in forum AutoLISP
    Replies: 1
    Last Post: 2004-09-08, 11:37 AM

Posting Permissions

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