Object Reactor Step by Step Please...

Discussion in 'AutoCAD' started by Rudy Tovar, Dec 2, 2004.

  1. Rudy Tovar

    Rudy Tovar Guest

    Breaking it down, having played around with only editor reactors, I'd like
    to start understanding and using Object Reactors.

    Your input is welcome.


    Event (modify, move, copy, edit, erase)
    Reactor (Do, Do Not, Remove Reactor, Disable Reactor, etc)

    I've been able to trigger the reactor without a hitch, but when processing
    multiple objects in the ERASE command, I'm only able to erase one object at
    a time. So clarification in further understanding is more than welcome.

    Here's the scoop...Block with attribute being updated...no problem...reactor
    fires...and does it's thing...but when I try and erase it or others I need
    it fire the reactor, but at the same time, be able to erase all the blocks
    I've select the first time. I understand I must have more to the code,

    I will not mention any names, but invite all to comment on the structure
    that the reactor must face in detail. I feel it will be beneficial for

    "Getting older and still learning..."
    "It's not the years, it's the mileage..."
    Rudy Tovar, Dec 2, 2004
  2. Rudy Tovar

    Rudy Tovar Guest

    I'm using Autocad 2005...
    Rudy Tovar, Dec 2, 2004
  3. Rudy Tovar

    Rudy Tovar Guest

    About the same...unless I go one on one with them...but I'm still part of
    this group...so I'd like to open this discussion with everyone...
    Rudy Tovar, Dec 2, 2004
  4. Rudy Tovar

    Rudy Tovar Guest

    Thank you Luis...I understand that there are countless methods to cover...I
    actually downloaded your sample, for pers reactors, but the I need to cover
    all bases...Let me explain...

    In part my condition must be able to deactivate the object, but maintain
    record of it's association to an event, and I must also be able to just fire
    the reactor only once in case the block is erased, and only fire once if the
    selection contains multiple blocks with the same reactor.

    It's no problem if I erase one object at a time, but the multiple objects
    condition requires that I setup some sort of variable that is only watched
    and triggers the reactor only one at the end of the :vlr-erased
    callback_function. There is no purpose that the reactor update the same
    object (not the reactor object) for each reactor object, it wouldn't be
    Rudy Tovar, Dec 2, 2004
  5. Rudy Tovar

    Rudy Tovar Guest

    That's for sure...

    A name means nothing, if they don't cover the topics that need to be

    I was on the live c++ .net presentation, but they didn't cover any c++, just
    visual basic...mean less to say many started leaving the presentation...I
    was very disappointed...

    I know that if I put my mind to it, I can figure it out, but was hoping that
    you or others could contribute to just this one condition, and comment on
    your approaches...

    Should I encounter any solutions I'll post my findings. But just so others
    know, more specifically TT(you know who), creative comments are welcome, but
    the criticisms is not.
    Rudy Tovar, Dec 2, 2004
  6. I hope, too.... more become interested on this.

    And would like to view code from the masters.
    Luis Esquivel, Dec 2, 2004
  7. Rudy Tovar

    Rudy Tovar Guest

    I found the mistake I made...it was obvious...

    I was using SSGET in a collection...

    So I changed everything to vla functions and it all works...90% and getting
    better...much faster too...

    This was the condition... but I'll need to make it pers reactor...

    (defun MASi-key-object (/ name bk)
    (vlax-for for-item (vla-get-modelspace
    (vla-get-activedocument (vlax-get-acad-object))
    (setq name (vla-get-objectname for-item))
    (if (= name "AcDbBlockReference")
    (setq bk (vla-get-name for-item)
    (if (= (strcase bk "01BLOCK"))
    (setq block-watch-condition
    (list for-item)
    Rudy Tovar, Dec 3, 2004
  8. Rudy Tovar

    T.Willey Guest

    This happened twice in the code posted.
    (= (strcase bk "01BLOCK"))
    I think you meant
    (= (strcase bk) "01BLOCK")

    ps Thanks for post your question here so we all can learn.
    T.Willey, Dec 3, 2004
  9. Rudy Tovar

    Rudy Tovar Guest

    If I didn't explain the last part it's because I was assigning a variable to
    carry the condition

    The command 'val' could be any command or the one I needed, so I simply used
    (if masiupdatetrue (progn ...))(setq masiupdatetrue nil)) The masiupdatetrue
    variable was assigned when the object was either modified or erased.

    Gripping objects or editing it's contents, in my case properties made the
    reactor to respond sooner, actually before autocad had closed the object and
    ended the command, so chose to fire the reactor after the command had
    finished. If I'd known of a different method, I would have used it, but it's
    still a learning curve for me, and it works. Anyone else approach is
    welcomed. But remember that the web of functions must be simply and clean.
    By clean I mean not too complex that you end up with links everywhere.
    Rudy Tovar, Dec 3, 2004
  10. Rudy Tovar

    Rudy Tovar Guest

    Good catch...my typo...
    Rudy Tovar, Dec 3, 2004
  11. Rudy Tovar

    Rudy Tovar Guest

    As you can see, not many know how to use reactors and or the

    Linking object so that they clean up after themselves, or maintain control
    over how they inneract...

    Isn't that what using autocad is all about, as a tool rather than a drafting
    board......a drawing that draws itself....sorts itself....calculates it's
    own properties....

    A drawing that inspects code issues...then corrects itself...and perhaps
    even creates new sheets for itself...rather than having someone do the

    I new a guy that drew parking garages...he would design the layout and enter
    the perameters...go home...and when he'd come back in the office, the next
    day, have the entire set of drawing already composed...down to the

    Now that's kicking it up a notch....

    Now... I've written utilities that check drawings for consistencies...that
    note themselves, and dimension themselves...that even check code issues...

    The funny thing about it is...it's not that hard to do...

    I'm currently creating one that details itself....
    Rudy Tovar, Dec 6, 2004
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.