Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Lisp routine to Lock / Unlock viewports

  1. #1
    I could stop if I wanted to
    Join Date
    2003-11
    Posts
    450
    Login to Give a bone
    0

    Default Lisp routine to Lock / Unlock viewports

    I am trying to write a routine that will turn a viewport on or off. I know that the information is stored in xdata under the dotted pair 90 but there are 18 different options for that variable. How would I filter out the other values?

    Thanks

  2. #2
    All AUGI, all the time
    Join Date
    2015-12
    Location
    Central Oregon
    Posts
    591
    Login to Give a bone
    0

    Default Re: Lisp routine to Lock / Unlock viewports

    A few things......the association group 90 is not a part of the extended data, but is a part of the object's data. Next, those values are bit coded values and to turn off a VP requires the bitcode value of 131072 to be set.

    However, you cannot use (entmod) on a paperspace viewport.....

    But, using ActiveX you CAN manipulate the Off/On value:
    (setq vpObj (vlax-ename->vla-object vpEnt))
    (vla-display vpObj :vlax-true);;;turns it on
    (vla-display vpObj :vlax-false);;;turns it off

    HTH,
    Jeff

  3. #3
    I could stop if I wanted to
    Join Date
    2003-11
    Posts
    450
    Login to Give a bone
    0

    Default Re: Lisp routine to Lock / Unlock viewports

    I realized i made a mistake in my first question and post. I want to know how to LOCK and UNLOCK a viewport not turn on and off. Sorry my mistake.

  4. #4
    I could stop if I wanted to
    Join Date
    2003-11
    Posts
    450
    Login to Give a bone
    0

    Default Re: Lisp routine to Lock / Unlock viewports

    I found something on theswamp.org to help

    http://www.theswamp.org/index.php?topic=7097.0

  5. #5
    All AUGI, all the time CAB2k's Avatar
    Join Date
    2016-01
    Location
    Brandon, Florida
    Posts
    687
    Login to Give a bone
    0

    Default Re: Lisp routine to Lock / Unlock viewports

    Look at (vla-put-DisplayLocked vpObj [:vlax-true / :vlax-false] )

    PS I see you found more info.
    Last edited by CAB2k; 2006-05-09 at 04:29 PM.

  6. #6
    The Silent Type Mike.Perry's Avatar
    Join Date
    2000-11
    Posts
    13,656
    Login to Give a bone
    0

    Default Re: Lisp routine to Lock / Unlock viewports

    Quote Originally Posted by boesiii
    I realized i made a mistake in my first question and post. I want to know how to LOCK and UNLOCK a viewport not turn on and off. Sorry my mistake.
    Hi

    You may also find the following thread, helpful...

    Locking Viewports

    Have a good one, Mike

  7. #7
    Certifiable AUGI Addict tedg's Avatar
    Join Date
    2005-06
    Location
    in the upper right corner
    Posts
    3,507
    Login to Give a bone
    0

    Thumbs up Re: Lisp routine to Lock / Unlock viewports

    I don't know if this helps but..
    Here's a quick routine I wrote a while back to quickly lock (and unlock) several viewports at once.
    Code:
    ;;lock selected vports
    (defun c:lvp (/ ss)
    	(setq ss (ssget))
    	(command "mview" "l" "on" ss "")
    	(princ)
    )
    ;;unlock selected vports
    (defun c:ulvp (/ ss)
    	(setq ss (ssget))
    	(command "mview" "l" "off" ss "")
    	(princ)
    )
    (princ)
    (princ "LVP loaded.")
    (princ "\nType LVP, select the viewports you want to lock and then hit ENTER.")
    (princ "\nType ULVP, select the viewports you want to unlock and then hit ENTER.")
    Ted

  8. #8
    Member
    Join Date
    2015-11
    Location
    California
    Posts
    6
    Login to Give a bone
    0

    Default Re: Lisp routine to Lock / Unlock viewports

    Ted,
    Thanks for the post of the lisp routine.
    That is exactly what I was looking for.

    Have a great day.

    Michael

  9. #9
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Lisp routine to Lock / Unlock viewports

    Quote Originally Posted by tedg View Post
    I don't know if this helps but..
    Here's a quick routine I wrote a while back to quickly lock (and unlock) several viewports at once.
    Code:
    ;;lock selected vports
    (defun c:lvp (/ ss)
        (setq ss (ssget))
        (command "mview" "l" "on" ss "")
        (princ)
    )
    ;;unlock selected vports
    (defun c:ulvp (/ ss)
        (setq ss (ssget))
        (command "mview" "l" "off" ss "")
        (princ)
    )
    (princ)
    (princ "LVP loaded.")
    (princ "\nType LVP, select the viewports you want to lock and then hit ENTER.")
    (princ "\nType ULVP, select the viewports you want to unlock and then hit ENTER.")
    ... ss = nil?

    Besides, there's no need to make a(n unfiltered) selection set at all:

    Code:
    (defun c:LVP ()
      (command "._mview" "lock" "on"))
     
    (defun c:ULVP ()
      (command "._mview" "lock" "off"))
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  10. #10
    Member
    Join Date
    2013-06
    Posts
    4
    Login to Give a bone
    0

    Default Re: Lisp routine to Lock / Unlock viewports

    Quote Originally Posted by BlackBox View Post
    ... ss = nil?

    Besides, there's no need to make a(n unfiltered) selection set at all:

    Code:
    (defun c:LVP ()
      (command "._mview" "lock" "on"))
     
    (defun c:ULVP ()
      (command "._mview" "lock" "off"))
    ... TILEMODE = 1?

    Code:
    (defun c:LVP ()
    	(if (= (getvar 'TILEMODE) 0) ;if you're in paperspace
    		(command "._mview" "_lock" "_on" "_all" "")        ;then do it
    		(princ "\n** Command not allowed in Model Tab **") ;else, announce failure
    	)
    (princ);exit cleanly
    )
     
    (defun c:ULVP ()
    	(if (= (getvar 'TILEMODE) 0) ;if you're in paperspace
    		(command "._mview" "_lock" "_off" "_all" "")       ;then do it
    		(princ "\n** Command not allowed in Model Tab **") ;else, announce failure
    	)
    (princ);exit cleanly
    )

Page 1 of 2 12 LastLast

Similar Threads

  1. Ability to Lock / Unlock the Current Viewport in a Layout
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 1
    Last Post: 2013-01-17, 04:57 AM
  2. Lock&Unlock Underlay
    By iluhaglukhanuk in forum Revit Structure - Wish List
    Replies: 0
    Last Post: 2008-04-17, 04:07 PM
  3. Create commands to Lock / Unlock viewports
    By Rico in forum AutoCAD CUI Menus
    Replies: 5
    Last Post: 2005-10-27, 07:11 PM
  4. lock/unlock all viewports at once
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 1
    Last Post: 2005-10-21, 03:41 PM
  5. Lock / Unlock Viewports
    By Rico in forum AutoCAD General
    Replies: 3
    Last Post: 2005-06-23, 08:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •