setvar and reactors

Discussion in 'AutoCAD' started by Mark Ingram, Apr 27, 2004.

  1. Mark Ingram

    Mark Ingram Guest

    How would you change the LTSCALE with a sysvarchanged reactor? I asumed and
    confirmed (setvar...) doesn't work as it puts the function into a loop.

    Any suggestions on pulling this off? I already have a conditional statement
    to test the users current space, but that requires something to call it - it
    works, but not automatically as a reactor would.

    ???
    Thanks,
    Mark
     
    Mark Ingram, Apr 27, 2004
    #1
  2. Mark Ingram

    Rudy Tovar Guest

    Rudy Tovar, Apr 27, 2004
    #2
  3. Mark Ingram

    JamesA Guest

    We use that here. In the callback function check the var and only change it
    if it is wrong. Then when it fires because you just changed it, it does
    nothing else and closes out.

    I had thought that I could disable the reactor and then reenable it to start
    and close the callback, but that didn't seem to work. If someone knows how
    to make that work, I think it would be even better.

    HTH,
     
    JamesA, Apr 27, 2004
    #3
  4. Mark Ingram

    Doug Broad Guest

    As long as you're not stuck on sysvar changed reactors,
    this might give you some ideas. Typically the modelspace
    dimension and linetype scales should be saved in a dictionary
    or should be derived from the standard scale of the last
    viewport used.

    (vl-load-com)
    (if layswitch (vlr-remove layswitch))
    (setq layswitch (vlr-miscellaneous-reactor nil '(:)vlr-layoutswitched . mglayouts))))

    (setq mdimscale 48.0);;typical drawing dimscale

    (defun mglayouts (react layout)
    ;;D. C. Broad, Jr. Demonstration
    (cond
    ((/= "Model" (car layout))
    (setvar "ltscale" 0.75)
    (setvar "psltscale" 1)
    (setvar "dimscale" 0))
    (t
    (setvar "dimscale" mdimscale)
    (setvar "ltscale" (* mdimscale 0.75))))
    )
     
    Doug Broad, Apr 27, 2004
    #4
  5. Mark Ingram

    Mark Ingram Guest

    Thanks, I will look.
    Mark
     
    Mark Ingram, Apr 27, 2004
    #5
  6. Mark Ingram

    Mark Ingram Guest

    Right tree. I can tell if user switches to modelspace/paperspace/paperspace
    vp, depending on were they are, i want to change some settings. I was using
    LTSCALE as an example of one setting I may/may not change depending on
    current space. Currently looking at sysvarchanged reactor, but that may be
    the wrong one since i am changing setvars.
     
    Mark Ingram, Apr 27, 2004
    #6
  7. Mark Ingram

    Mark Ingram Guest

    Thanks Doug. I have a little test layoutswitch reactor working, but it
    wasn't helping me when switching from PS to a PS Viewport. I'm not stuck on
    sysvarchanged - taking any suggestions. I want LTSCALE (for example) to
    change if any "current space" change is made.

    Thanks,
    Mark
     
    Mark Ingram, Apr 27, 2004
    #7
  8. Mark Ingram

    Mark Ingram Guest

    Thanks James, good suggestion of changing only if not correct..
    Mark
     
    Mark Ingram, Apr 27, 2004
    #8
  9. Mark Ingram

    Mark Ingram Guest

    That's ok. I'll have to gleen what I can here. You are well worth whatever
    you are charging, but I have no budget here. Thanks for all your help you've
    always offered. :)

    Best regards,
    Mark
     
    Mark Ingram, Apr 27, 2004
    #9
  10. Mark Ingram

    Doug Broad Guest

    Mark,
    You should use psltscale=1 to avoid the need to change ltscale
    as you move from viewport to viewport. The only thing that
    needs to change from viewport to viewport is the text size.
    That can be accomplished by revising the text and mtext
    commands. Sysvarchanged does work well for this.
    All these operations are most effective when the viewports are
    display locked.



    <snip>
     
    Doug Broad, Apr 27, 2004
    #10
  11. Mark Ingram

    Mark Ingram Guest

    Thanks Doug. I have set psltscale to1. this works fine working between ps
    and a psvp, but not in model.

    Let's say I have a floor plan xrefed into sheet A1 in model. The ltscale is
    fine in the floor plan, fine in sheet A1-paperspace, fine in A1
    paperspacevp, but wrong in A1 modelspace.

    Am I making sense?

    Thanks,
    Mark
     
    Mark Ingram, Apr 28, 2004
    #11
  12. Mark Ingram

    Jamie Duncan Guest

    maybe tie the ltscale to dimscale then?

    in pspace ltscale = factor
    in mspace = dimscale of current dimstyle *factor
    in mspace thru' viewport lts = factor

    psltscale always 1...



    --
    Jamie Duncan

    "How wrong it is for a woman to expect the man to build the world she wants,
    rather than to create it herself."
    - Anais Nin (1903-1977)
     
    Jamie Duncan, Apr 28, 2004
    #12
  13. Mark Ingram

    Doug Broad Guest

    Look at the reactor I proposed. It changes the dimscale and
    ltscale based on which layout you're in. That solves half of the
    problem. Changes to dimscale while in the model tab should affect
    certain other things should change with it (text heights and ltscale).
    That can be handled with either a sysvar reactor or a command
    ended reactor that checks dimscale.

    If you decide to use a setvar reactor to change the variables,
    you must disable the reactor during the callback and then re-enable
    it.

    HTH
     
    Doug Broad, Apr 28, 2004
    #13
  14. Mark Ingram

    Mark Ingram Guest

    Thank you Jamie.
    Mark


     
    Mark Ingram, Apr 28, 2004
    #14
  15. Mark Ingram

    Mark Ingram Guest

    Thanks again Doug, and everyone else. After much testing last night, I'm
    headed in this direction (misc-reator and layoutswitch), and seems to be
    going fine. All the different suggestions are greatly apprecitated.

    Best regards,
    Mark
     
    Mark Ingram, Apr 28, 2004
    #15
  16. Mark Ingram

    Mark Ingram Guest

    Err... misc-reaCtor, and appreciated. Late night. Bad spellchecker, BAD!
    :)
    Mark
     
    Mark Ingram, Apr 28, 2004
    #16
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.