locking viewports

Discussion in 'AutoCAD' started by martin, Feb 15, 2004.

  1. martin

    martin Guest

    is there a variabel that controls locking viewports globally or a lisp that
    does this for a number of layouts in a drawing?
    martin
     
    martin, Feb 15, 2004
    #1
  2. martin

    dean_bourke Guest

    I use this in my menu:

    [PsVports LOCK ALL (all layouts)]^c^c(setq or_ctab (getvar"ctab"))(foreach layout (layoutlist) (progn(setvar "ctab" layout)(command"-vports" "lock" "on" (ssget "X" (list (cons 67 1) (cons 0 "VIEWPORT"))) "")))(setvar "ctab" or_ctab);

    Dean
     
    dean_bourke, Feb 15, 2004
    #2
  3. martin

    John Uhden Guest

    This might help...

    (defun VPLOCKALL (mode / ss i)
    (and
    (vl-position mode '(0 1))
    (setq ss (ssget "X" '((0 . "VIEWPORT"))))
    (setq i -1)
    (repeat (sslength ss)
    (vlax-put
    (vlax-ename->vla-object (ssname ss (setq i (1+ i))))
    'DisplayLocked
    mode
    )
    T
    )
    )
    )
    To lock all viewports: (vplockall 1)
    To unlock all viewports: (vplockall 0)
     
    John Uhden, Feb 16, 2004
    #3
  4. martin

    RickW Guest

    If you are using 2000 or newer:

    MVIEW
    L(ock)
    O(n)
    Then pick the viewport(s) you want to lock
     
    RickW, Feb 16, 2004
    #4
  5. martin

    archer57 Guest

    You could add 2 buttons to the viewports toolbar (or any one you like):

    ^C^C_mview;lock;on;

    ^C^C_mview;lock;off;

    Pete
     
    archer57, Feb 16, 2004
    #5
  6. martin

    Dr Fleau Guest

    I don't know of a variable that actually controls the locking of a viewport, but there is
    a variation in the (90 . XX) DXF code for the viewport. When locked, its value decreases
    by 32672 (IIRC). The problem is, viewports cannot be changed by using ENTMOD. So you're
    stuck using one of the methods described above, or my own, a little simpler method (no
    vlax-blabla) :

    (DEFUN c:mvlock (/ mvss)
    (setvar "cmdecho" 0)
    ;; Get all VIEWPORT entities
    (SETQ mvss (SSGET "X" '((0 . "VIEWPORT"))))
    ;; Locks them
    (COMMAND "_.vports" "L" "ON" mvss "")
    (PRINC)
    ) ;_ end DEFUN

    Of course, this is good if you want to lock all VPs in a drawing at once.

    Lock on... sorry... Rock on !

    Pierre
    We are born naked, cold and hungry. Then things get worse.
     
    Dr Fleau, Feb 17, 2004
    #6
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.