Run a lisp from reactor?

Discussion in 'AutoCAD' started by BillZ, Jan 28, 2005.

  1. BillZ

    BillZ Guest

    R2005:

    I'm trying to load and run an Autolisp file when the save button is pressed on a couple of AutoCAD installations.

    Is that possible?

    Here's what I'm trying and can't get it to work.
    Code:
    ;;01/28/05 Bill Zondlo
    ;;Program to have lisp execute on save.
    
    ;-----;
    (load "g:/autolisp/subr/r2d2")
    ;-----;
    (defun ExeSubr ()
    (r2d2)
    )
    ;-----;
    
    (defun SaveDwg2WOL (/ Save2WOL)
    (vl-load-com)
    (if (vlr-reactors :vlr-object-reactor)
    (vlr-remove-all)
    )
    ;;;
    (setq Save2WOL
    (vlr-dwg-reactor nil
    '((:vlr-saveComplete . ExeSubr)
    )
    )
    )
    (princ)
    )
    TIA

    Bill
     
    BillZ, Jan 28, 2005
    #1
  2. BillZ

    BillZ Guest

    Oh,
    By the way, I'm loading and runnig this from my .mnl file.

    Or do I need to load and run this on each drawing opened?

    Bill
     
    BillZ, Jan 28, 2005
    #2
  3. BillZ

    BillZ Guest

    This is the erro I keep gettting:

    Command: _qsave ; error: too many arguments
    ; error: too many arguments
    ; error: too many arguments


    Bill
     
    BillZ, Jan 28, 2005
    #3
  4. Don't callback functions require arguments?
     
    Jason Piercey, Jan 28, 2005
    #4
  5. To widen out on what Jason said:

    (defun ExeSubr (/ reactor info);must accept 2 args
    (r2d2)
    )
     
    Eric Schneider, Jan 28, 2005
    #5
  6. Bill, give this a try:


    (defun ExeSubr (reactor params) (r2d2))

    (defun SaveDwg2WOL ()
    (vl-load-com)

    (if (not Save2WOL)
    (setq
    Save2WOL
    (vlr-dwg-reactor nil '(:)vlr-saveComplete . ExeSubr)))))

    (princ))
     
    Luis Esquivel, Jan 29, 2005
    #6
  7. BillZ

    BillZ Guest

    Thanks All,
    I guess I stripped the example, that I got on another sight, down a little too far. :^)

    Always something new to learn.

    Bill
     
    BillZ, Jan 31, 2005
    #7
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.