Linking and maintaining Reactors

Discussion in 'AutoCAD' started by mloreto, Aug 11, 2004.

  1. mloreto

    mloreto Guest

    I am new to reactors. I want to write a routine that will keep track of object once they are created and when they are modified. I have looked at examples, and somewhat understand how it is done. What I don't know how to do is have AutoCAD still recognize those objects (entities) once I exit AutoCAD and re-enter AutoCAD. How can I have it remember which objects in the drawing are linked to my reactors and continue tracking them? Can anyone help? even if it is pointing me to a good book on the subject.

    Thank you
     
    mloreto, Aug 11, 2004
    #1
  2. mloreto

    Jürg Menzi Guest

    Hi mloreto
    Transient Reactors (the default mode) are lost when a drawing closes.
    Persistent reactors are saved with the drawing.
    Note:
    If you open a drawing containing persistent reactors and the associated
    functions are not available, AutoCAD shows an error message.
    In case of transient reactors, write the notification data in a Xdata or
    Xrecord (dictionary) structure and add the reactor to the associated object
    when a drawing opens.
    - AutoCAD's help
    - The Garden Path tutorial
    - This ng
    - Dave Stein's Visual LISP Developers Bible (see customer-files ng)
    - ???

    Cheers
     
    Jürg Menzi, Aug 11, 2004
    #2
  3. You can use (vlr-pers robj) to make it persistant.
    You'll need to load all your reactor functions each time you open the drawing though.
    Also to remove the persistance, use (vlr-pers-release robj).
    You'll also need to set the reactor data to nil (vlr-data-set robj nil) in order to remove the error
    message that occurs when you reopen the the drawing again.
    This is the routine I use to destroy the reactor when the object is erased.

    ;; -----------------------------------------------------------------------------------------------

    (defun reactor_obj_erased (nobj robj plist)

    (vlr-owner-remove robj nobj)
    (vlr-remove robj) ; disable the reactor
    (vlr-pers-release robj) ; remove persistance so that the reactor
    ; won't be here next time
    (vlr-data-set robj nil) ; eliminates the "; warning:erased VLA-object
    ; restored to NIL" message when reopening...
    (prompt "\nReactor removed...\n")
    )
    ;; -----------------------------------------------------------------------------------------------


    Several people here think the AutoCAD reactors are more hassle than they're worth, and reccommend
    using a custom dictionary to "roll their own", but I haven't had any problems with them (esp since
    Luis E. helped me figure out what was going on with them. Thanks Luis!)
     
    Allen Johnson, Aug 11, 2004
    #3
  4. mloreto

    mloreto Guest

    Thank you Jurg.

    I will look into these Persistent reactors.

    Thanks,

    Miguel
     
    mloreto, Aug 11, 2004
    #4
  5. mloreto

    mloreto Guest

    Thank you Allen,

    I will look into this. All of this is very helpful


    Thanks,

    Miguel
     
    mloreto, Aug 11, 2004
    #5
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.