Changing between PSViewports Reactor

Discussion in 'AutoCAD' started by Matthew, Jul 20, 2004.

  1. Matthew

    Matthew Guest

    What is the sequence of events that happen when switching between paperspace
    viewports?
    I have a sysvar reactor to the "CVPORT" variable, but then I need to wait
    for something else to get done to update the dimscale based on the vpscale.
    I just don't know what that something is. ??

    Any help is appreciated.
    Matthew
     
    Matthew, Jul 20, 2004
    #1
  2. Recently with the help of some guys in the forum I came with this reactor:

    (vl-load-com)
    (if (null db:svr)
    (setq db:svr (vlr-sysvar-reactor '("CVPORT") '(:)vlr-sysvarchanged .
    setscale)))
    )
    )

    If fires every time you change the viewport or go to paperspace and don't
    react when you go to Model Layout.
    The callback function looks like this:

    (defun setscale (r data)
    (if (member (car data) (vlr-data r))
    (cond
    ((> (getvar "cvport") 1)
    (setq xpf (rtos (/ 1 (caddr (trans '(0 0 1) 2 3))) 2 0))
    (setq setsc (strcat "mode" xpf))
    (eval (list (read (strcat "c:" setsc))))
    )
    ((= (getvar "cvport") 1)
    (cond
    ((= (getvar "lunits") 4)
    (c:apsmode)
    )
    ((/= (getvar "lunits") 4)
    (c:psmode)
    )
    )
    )
    )
    )
    )

    You may simplify/replace this with your own. Keep in mind that some AutoLisp
    commands doesn't work under reactor (like COMMAND, VL-CMDF, INSERT and
    other command considered as INTERACTIVE).
    The way my callback function is working is this:
    I have separate functions for each scale - they are setting many parameters
    based on the viewport scale - Current Text Style, Dimension Style, LTScale,
    Units, ect.
    Each of these functions has a name MODE with the scale factor at the end
    (e.g. MODE50 for 1:50 or MODE24 for 1/2"=1'-0"), so the callback function is
    assembling the name based on the scale of the viewport and then activating
    this function. In case you are returning from viewport to PS it goes to
    function PSMODE (if you were in decimal unit viewport) or APSMODE (if you
    were in architectural units viewport).
    This way the drafters don't have to think about setting dimension style or
    linetype scale or text style - they just jumping from viewport to viewport
    and drawing.
    John
     
    John Georgiev, Jul 20, 2004
    #2
  3. Matthew

    Matthew Guest

    There must be something about making selection sets inside reactors also.
    The selection set must be setting a sysvar because the reactor fires just
    after creating it and I get a unhandled exception. ??

    Seems to work ok after using ActiveX methods.

    Thanks
    Matthew
     
    Matthew, Jul 21, 2004
    #3
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.