Results 1 to 2 of 2

Thread: need some help with reactors

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2009-04
    Posts
    1
    Login to Give a bone
    0

    Default need some help with reactors

    does any one no good books that explains reactors in more detail.

    I am a autolisp programmer I learned lisp with r11... now trying to learn visual lisp...
    most of it I anderstand but reactors i can get my head around...

    I am trying to create a link than when the title bolck is changed it will creat a new external file with the data of all the titleblock in the drawing...
    thanks

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

    Default Re: need some help with reactors

    Welcome to AUGI & congrats on your 1st post.

    Don't know any books directly concerning reactors. But the idea behind them is very much similar to events in other programming languages. Generally I've learnt to use reactors through a combination of the Developer Help, Trial-and-error and of course AUGI.

    In your case, you need to decide on what you wish your "event" to be triggered on:
    1. If a specific entity is changed
    2. If a specific command is used
    3. If any entity is changed
    For all reactors, you create a defun which will be called if the event happens. This is a normal defun (nothing strange) with 2 arguments ... i.e.
    Code:
    (defun YourEventTrigeredFunctionName (arg1 arg2 / any local vars you wish)
      ... code happening inside the defun
    )
    You create a reactor with one of the vlr-####-reactor functions, or the vlr-reaction-set function. This links one of the events of a reactor to your defun. Something like:
    Code:
    (vlr-object-reactor (cons objref nil) "Any data you want to identify for this reactor" '((:vlr-modified . YourEventTrigeredFunctionName )))
    Every time this event occurs, your defun is called with some data passed to it through arg1 and arg2 (you could have called these whatever you want, the order is important).

    For 1 you'll have to assign an object reactor to the block reference / specific attribute. Here you can check for a modified, subObjectModified and modifyUndone event. It will only fire once the specific entity has been edited. The data sent to your function (callback for modified & modifyUndone) will be a vlax object of the reactor itself. You can use the vlr-owners function to check if one of those objects in the list is the titleblock you want. The 2nd var passed to your function will be nil. Or more probably (subObjectModified) the 1st is still the reactor object, but the 2nd is a vlax of the subentity (e.g. attribute) ... which you can then check its vlr-get-OwnerId to check if it's part of the TB.

    For 2 you'll assign a an editor reactor on the commandEnded event and then check for something like EATTEDIT. Read each title block and update it's data in the file. This will fire for each & every command, so you'll need to check which command is running / has just completed. The 1st var is the reactor object. The 2nd lists what command happened.

    For 3 you use an acdb reactor with a modified event. Here the 1st var is again the reactor object, the 2nd is a vlax object of the entity which has changed. As usual, check if it's a blockreference & if it's the TB you are referring to.

Similar Threads

  1. Can someone help me with reactors?
    By ReachAndre in forum AutoLISP
    Replies: 5
    Last Post: 2014-05-28, 03:02 PM
  2. Reactors???
    By cosmarchy in forum AutoLISP
    Replies: 5
    Last Post: 2012-09-04, 04:28 PM
  3. Reactors????
    By LLAW3224 in forum AutoLISP
    Replies: 2
    Last Post: 2005-03-04, 12:44 PM
  4. Can this be done with reactors?
    By kieren in forum AutoLISP
    Replies: 5
    Last Post: 2004-10-06, 03:43 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
  •