which Reactor

Discussion in 'AutoCAD' started by tader1, Mar 26, 2005.

  1. tader1

    tader1 Guest

    Hi, which reactor should I use to run a lisp when an existing dwg is opened and closed. I don't know anything about reactors, but I just need some search criteria so I can start learning.
    TIA, Shawn.
     
    tader1, Mar 26, 2005
    #1
  2. Koistya `Navin \(TechProject\), Mar 27, 2005
    #2
  3. tader1

    tader1 Guest

    ok I read that, but i'm not sure which reactor still that i have to use to catch the opening of an exist. file or the closing of one. Is there a certain defined funtion reactor that's built in to catch this action? What I'm trying to do is update a log file on time spent on drawings. I've already got a lisp that does this but one has to type a command. I'd rather bypass typing that command and have it append the log file automatically.
    Shawn
     
    tader1, Mar 27, 2005
    #3
  4. See example in the article. But insted of reactor's 'save' use another
    reactor's events:

    (setq MyReactor
    (vlr-dwg-reactor
    nil
    '(:)vlr-dwgFileOpened . DoAfterOpen)
    :)vlr-beginClose . DoAfterClose)
    )
    )
    )
     
    Koistya `Navin \(TechProject\), Mar 28, 2005
    #4
  5. Shawn,

    That article is wrong.... do not follow what the author is providing.

    I will post some small code sample on this, tomorrow Monday.

    LE.
     
    Luis Esquivel, Mar 28, 2005
    #5
  6. tader1

    Adesu Guest

    Thanks Luis,I always wait info from autolisp expert.
     
    Adesu, Mar 28, 2005
    #6
  7. tader1

    Walt Engle Guest

    I went to that site and found their simple suggestions would not work.
     
    Walt Engle, Mar 28, 2005
    #7
  8. tader1

    Walt Engle Guest

    Luis gave me some help when I showed him what the article said which didn't
    work. His suggestions did work.
     
    Walt Engle, Mar 28, 2005
    #8
  9. Ok, try this simple example. It writes Author name in dwg properties before
    save.

    (vl-load-com)

    (defun DoThisBeforeSave (Caller CmdSet / si)
    (setq si (vla-get-SummaryInfo
    (vla-get-Database
    (vla-get-ActiveDocument (vlax-get-Acad-Object))
    )
    )
    )
    (vla-put-author si "Koistya Navin")
    (if (and MyReactor (vlr-added-p MyReactor))

    (vlr-remove MyReactor)

    )
    (princ)
    )


    (setq MyReactor
    (vlr-dwg-reactor
    nil
    '(:)vlr-BeginSave . DoThisBeforeSave))
    )
    )
     
    Koistya `Navin \(TechProject\), Mar 28, 2005
    #9
  10. Also...

    (vlax-release-object si)

    should be placed after

    (vla-put-author si "Koistya Navin")
     
    Koistya `Navin \(TechProject\), Mar 28, 2005
    #10
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.