zoom extend with reactor problem

Discussion in 'AutoCAD' started by stijn vandenbussche, Mar 1, 2004.

  1. I have this code provide by the person below.
    I added the lisp file to the start up suit I also added a path to were it is
    standing but for some reason it doesn't work.
    Does somebody know why it doesn't?

    Thanks in advance
    greetings
    stijn Vandenbussche

    ; Written By: Peter Jamtgaard
    ; This program will automatically zoom all before a drawing closes.
    ; The program must be loaded automatically by an acaddoc.lsp program
    ; or the startup suite.
    ; It is a good example of an editor reactor.

    (defun C:ZACLOSE ()
    (setq RXN_CLOSE (vlr-editor-reactor nil '(:)vlr-beginclose .
    zoomlimits ))))
    )
    (defun ZoomLimits (CALL COM / LIMMIN LIMMAX)
    (setq LIMMIN (vlax-make-safearray vlax-vbDouble '(0 . 2))
    LIMMAX (vlax-make-safearray vlax-vbDouble '(0 . 2))
    )
    (vlax-safearray-fill LIMMIN (reverse (cons 0.0 (reverse (getvar
    "limmin")))))
    (vlax-safearray-fill LIMMAX (reverse (cons 0.0 (reverse (getvar
    "limmax")))))
    (vla-ZoomWindow (vlax-get-acad-object) LIMMIN LIMMAX)
    (print "\nClosing drawing: ")
    )
     
    stijn vandenbussche, Mar 1, 2004
    #1
  2. stijn vandenbussche

    Doug Broad Guest

    That code in acaddoc.lsp would define a command. Only
    running the command would setup the reactor. Add
    (c:zaclose) at the end or delete the (defun c:zaclose .... and the
    corresponding closing parenthesis.
     
    Doug Broad, Mar 1, 2004
    #2
  3. can't get it to work.
    I don't put it in acaddoc.lsp but in the start up suit
     
    stijn vandenbussche, Mar 1, 2004
    #3
  4. Did you add a call to (vl-load-com) to activate the ActiveX functionality?
     
    Phil Kenewell, Mar 1, 2004
    #4
  5. I never worked with reactors before so I guess i have to answer your
    question with NO or i don't know

    If somebody can tellme where i find the information to set everything as it
    should be to be able to work with reactors i will search myselve
     
    stijn vandenbussche, Mar 2, 2004
    #5
  6. Stijn,

    I've looked over and tested this code and it has a problem in that it does
    not do the zoom Limits until AFTER the drawing has been prompted for save
    and saved. When the drawing closes, the zoom limits is simply discarded. Try
    this instead - uses ":vlr-CommandWillStart" Instead of ":vlr-BeginClose"

    ;;-------------------------------
    ;; Zooms Limits on Close Command.
    ;; Load the ActiveX Environment.
    (vl-load-com)

    ;; Prevents Multiple Loads during Degugging.
    (if rxn:CloseReactor (vlr-remove rxn:CloseReactor))

    ;; Initialize Reactor.
    (setq rxn:CloseReactor (vlr-editor-reactor nil '(:)vlr-CommandWillStart .
    Rxn:ZoomLimits))))

    ;; Callback Function.
    (defun Rxn:ZoomLimits (call com / lim-min lim-max)
    (if (= (car com) "CLOSE")
    (progn
    (setq lim-min (vlax-make-safearray vlax-vbDouble '(0 . 2))
    lim-max (vlax-make-safearray vlax-vbDouble '(0 . 2))
    )
    (vlax-safearray-fill lim-min (reverse (cons 0.0 (reverse (getvar
    "limmin")))))
    (vlax-safearray-fill lim-max (reverse (cons 0.0 (reverse (getvar
    "limmax")))))
    (vla-ZoomWindow (vlax-get-acad-object) lim-min lim-max)
    (print "\nClosing drawing: ")
    )
    )
    )
     
    Phil Kenewell, Mar 2, 2004
    #6
  7. PS: Watch out for the Word Wrap!
     
    Phil Kenewell, Mar 2, 2004
    #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.