Reactor-Tab-Paper Space-Easy

Discussion in 'AutoCAD' started by BobShumake, Mar 8, 2005.

  1. BobShumake

    BobShumake Guest

    Compiled this reactor from various sources on this site;
    (defun ChangedLayout (reactor layout / )
    (if (= (nth 0 layout) "Model")
    (progn
    (setvar "ltscale" (getvar "dimscale"))
    )
    (progn
    (setvar "ltscale" 1)
    (setvar "psltscale" 1)
    (vla-zoomextents (vlax-get-acad-object))
    )
    )
    )
    (if(not *LayoutLTS*)
    (setq *LayoutLTS* (VLR-Miscellaneous-Reactor nil
    '(:)VLR-layoutSwitched . ChangedLayout))))
    )
    (princ)

    It keeps the LTSCALE set correctly in the MODEL or TAB environments, and keeps plotting simple for our users.

    The; (vla-zoomextents (vlax-get-acad-object)) function was added to auto-zoomextents when a TAB is activated. This sets the drawing to a clean starting point zoomed to the edges of the border. Problem is, if the pointer is left inside a viewport the last time the TAB was closed, and if the VIEWPORT is not locked, the ZoomExtents occurs in the MODEL space of the VIEWPORT.
    What needs added is a line to move the Crosshairs to PAPERSPACE, if they are found in MODELSPACE.

    Of course better way to go about this is to add the crosshair move to PAPERSPACE and the ZOOMEXTENTS to the event of the TAB exit.

    Either way works well enough for me.

    This is an easy question for someone, but not me. Thanks for all the help I have received in the past, especially Rob Starz, Jason Piercey, oldcadaver, and others.
     
    BobShumake, Mar 8, 2005
    #1
  2. (defun ChangedLayout (reactor layout /)
    (if (= (nth 0 layout) "Model")
    (progn
    (setvar "ltscale" (getvar "dimscale"))
    )
    (progn
    (setvar "ltscale" 1)
    (setvar "psltscale" 1)
    (if (= (getvar "CVport") 1);;;<------- If 1 PaperSpace, anything else
    Model Space
    (vla-zoomextents (vlax-get-acad-object))
    )
    )
    )
    )
    (if (not *LayoutLTS*)
    (setq *LayoutLTS*
    (VLR-Miscellaneous-Reactor
    nil
    '(:)VLR-layoutSwitched . ChangedLayout))
    )
    )
    )
    (princ)
     
    Marco Jacinto, Mar 8, 2005
    #2
  3. BobShumake

    BobShumake Guest

    Thank you Marco, I think this is the right direction, however, this give an error message. When I type CAVORT at the command line followed by 1, there is a note;
    "Cannot set CAVORT to that value.
    *Invalid*

    When I read what CAVORT does, it is to change between active viewports. Not between paper space and a view port. The command PSPACE seems to be what is needed here. Something like the zoom function;
    (vla-pspace (vlax-get-acad-object))
    But that did not work either. Possibly PSPACE is not the right term in VBA.
    VBA help yields;
    This menu item uses the DIESEL expression:
    [Ps/Ms]^C^C^P$M=$(if,$(=,$(getvar,cvport),1),mspace,pspace)
    This menu item uses the AutoLISP expression:
    [-Ps/Ms-]^C^C^P(if (= (getvar "cvport") 1)(command "mspace")+
    (command "pspace"))(princ) ^P

    So I tried (amoung others);
    (defun ChangedLayout (reactor layout /)
    (if (= (nth 0 layout) "Model")
    (progn
    (setvar "ltscale" (getvar "dimscale"))
    )
    (progn
    (setvar "ltscale" 1)
    (setvar "psltscale" 1)
    (if (= (getvar "cvport") 1)(command "pspace"))
    (if (= (getvar cvport) 1) "pspace")
    (vla-zoomextents (vlax-get-acad-object))
    )
    )
    )
    (if (not *LayoutLTS*)
    (setq *LayoutLTS* (VLR-Miscellaneous-Reactor nil
    '(:)VLR-layoutSwitched . ChangedLayout))
    )
    ))
    (princ)

    However, each attempt yieds another form of error.

    Any additional help please?
     
    BobShumake, Mar 8, 2005
    #3
  4. BobShumake

    BobShumake Guest

    Actually the routine I posted last was not quite right. I think part of the problem is if CVPORT is 1, then the crosshairs ARE in PAPERSPACE and that is where they need to be. The lisp needs to look for a CVPORT variable greater than 1, then if found, exicute the PSPACE command.

    This line: (if (= (getvar "cvport") 1)(command "pspace")) maybe needs to be something like;( if (> (getvar "cvport") 1)(command "pspace"))

    But I tested that of course and it did not work either. Also tested; (if (> (getvar "cvport") 1) "pspace")

    So much for the EASY part of this post heading. At least for me.

    Thanks for any help.
     
    BobShumake, Mar 8, 2005
    #4
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.