Locking Layout Viewports

Is there a way to lock all Viewports in a current Layout with individually clicking (selecting) each Viewport and locking from "Display Locked"?
Thanks
Richard

Comments

  •  I am not clear about the exact process you are seeking.  But, I found a lisp routine that defined some commands to lock or selected or all viewports.

    ; By Lee-Mac, found at the Augi forums
    ;; Lock selected or all viewport
     
    (vl-load-com)

    (princ "\n type VPL or VPU to lock or unlock selected viewports")
    (princ "\n type VPLA or VPLA to lock or unlock all vieports")
     
    (defun c:vpl nil
     
    (if (SSVPLock (ssget "_+.:E:S:L" '((0 . "VIEWPORT"))) :vlax-true)
     
    (princ "\n--> Viewport Locked.")
     
    )
     
    (princ)
     
    )
     
    ;; Unlock Selected Viewport
     
    (defun c:vpu nil
     
    (if (SSVPLock (ssget "_+.:E:S:L" '((0 . "VIEWPORT"))) :vlax-false)
     
    (princ "\n--> Viewport Unlocked.")
     
    )
     
    (princ)
     
    )
     
    ;; Lock All Viewports
     
    (defun c:vpla nil
     
    (SSVPLock (ssget "_X" '((0 . "VIEWPORT"))) :vlax-true)
     
    (princ "\n--> All Viewports Locked.")
     
    (princ)
     
    )
     
    ;; Unlock All Viewports
     
    (defun c:vpua nil ;; changed "VPLU" to "VPUA" to be consistant with the above function
     
    (SSVPLock (ssget "_X" '((0 . "VIEWPORT"))) :vlax-false)
     
    (princ "\n--> All Viewports UnLocked.")
     
    (princ)
     
    )
     
    (defun SSVPLock ( ss lock / i )
     
    (if ss
     
    (repeat (setq i (sslength ss))
     
    (vla-put-displaylocked (vlax-ename->vla-object (ssname ss (setq i (1- i)))) lock) t
     
    )
     
    )
     
    )

    -Joe
  • Occasionally I go to look at something inside a viewport and zoom in and lo and behold, it's not locked and then I have to fiddle to get all setup how it once was.
    That made me hope for a simple routine that before I dive into any editing I can just invoke a routine that if it isn;t locked then it locks all viewports, or if it is locked to ignore or perhaps say - Viewports Locked (already), or similar.

    Anthony's link is obviously aimed at my 'dilemma'
    Viewport Lock and Unlock (Tip #2129) from frequent contributor Theodorus Winata is used to lock up viewports quickly. When a viewport is not locked, it is not difficult to change the model view by accident. Theodorus's solution is to lock them all (or unlock them all) at once with this handy LISP function. Use this function by typing LV at the Command line after loading in the LISP code. This program is short due to the power of Visual LISP objects -- a great example for those learning to use these tools.

    Thanks for posting.

    I'll look at these and am sure it will save some very frustrating moments.

    regards

    Richard

  • I loaded the 'Theodorus Winata's Viewport Lock and Unlock' and that works a treat.
    Joe I imagine yours does the same, but LISP isn't a language I understand so can't compare.
    Very much appreciate your inputs thanks.

    This will help no end and save some very frustrating moments when all manner of things go wrong!!

    regards
    Richard
  • Lee's code is quite a bit shorter than the one that I am using - i'll have to look at the SSVPLock function; the script that I am using also sets the layer of all viewports to a viewport layer if it exists in the drawing, if not the viewports are placed on the defpoints layer.  I have placed the function in my startup routines and call it with the loading of every drawing - that way I don't have to worry about accidentally leaving a viewport in model space mode when I close a drawing. I find that to be one of the most aggravating problems that I have come across in the past - open the drawing unknowingly and with one click of the mouse you have potentially caused yourself hours of needless work - well maybe not hours but anyway.  That being said, it is surprising how many users I have come across in my time that didn't realize that one could lock viewports.
  • A simple method without needing to write a .lsp :
    1) Open properties dialog box/panel.
    2) Select all viewports
    3) Change locked property in dialog box/panel.
This discussion has been closed.

Howdy, Stranger!

It looks like you're new here. Click one of the buttons on the top bar to get involved!