Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GLOBALLY LOCK/UNLOCK MULTIPLE LAYOUT VIEWPORTS

9 REPLIES 9
Reply
Message 1 of 10
powellg
3561 Views, 9 Replies

GLOBALLY LOCK/UNLOCK MULTIPLE LAYOUT VIEWPORTS

Does anyone know were I could find a lisp routine to globally lock/unlock multiple layout vieports.
I have a DWG with 65 layouts and a routine to to lock/unlock all viewports would be great.
I found reference to a lisp routine: "lockallvp.lsp" but cannot find it on any Lisp web site.
Any help would be appreciated.
Thanks in advance
Gerry Powell
9 REPLIES 9
Message 2 of 10
Anonymous
in reply to: powellg

These would be one way of doing it.  This does
set each tab current, then unlock or lock the viewports.

 

(defun C:VpLockAll (/ ss otab)
  (setq otab
(getvar "ctab"))
  (foreach item (layoutlist)
   
(setvar "ctab" item)
    (setq ss (ssget "x" '((0 .
"VIEWPORT"))))
    (command ".-vports" "Lock" "On" ss
"")
    )
  (setvar "ctab" otab)
 
(princ)
  )

 

(defun C:VpUnLockAll (/ ss otab)
  (setq
otab (getvar "ctab"))
  (foreach item (layoutlist)
   
(setvar "ctab" item)
    (setq ss (ssget "x" '((0 .
"VIEWPORT"))))
    (command ".-vports" "Lock" "Off" ss
"")
    )
  (setvar "ctab" otab)
 
(princ)
  )


--

-Jason

 

Member of the Autodesk Discussion Forum Moderator Program

 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Does
anyone know were I could find a lisp routine to globally lock/unlock multiple
layout vieports.
I have a DWG with 65 layouts and a routine to to
lock/unlock all viewports would be great.
I found reference to a lisp
routine: "lockallvp.lsp" but cannot find it on any Lisp web site.
Any help
would be appreciated.
Thanks in advance
Gerry
Powell
Message 3 of 10
Anonymous
in reply to: powellg

Does not that locking capability comes with AutoCAD
2000? (My hme 2000i has it).  If you are in Paper space, type "MV" then "L"
for Lock, then "ON" then"ALL".   OFF reverses the
process.


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Does
anyone know were I could find a lisp routine to globally lock/unlock multiple
layout vieports.
I have a DWG with 65 layouts and a routine to to
lock/unlock all viewports would be great.
I found reference to a lisp
routine: "lockallvp.lsp" but cannot find it on any Lisp web site.
Any help
would be appreciated.
Thanks in advance
Gerry
Powell
Message 4 of 10
Anonymous
in reply to: powellg

below is a snip from a group of viewport utilities posted by Bobby Jones
last year. If you'd like the whole thing advise.
--
Dave Jones
Member of the Autodesk Discussion Forum Moderator Program

"powellg" wrote in message
news:f0c2d12.-1@WebX.maYIadrTaRb...
> Does anyone know were I could find a lisp routine to globally lock/unlock
multiple layout vieports.
> I have a DWG with 65 layouts and a routine to to lock/unlock all viewports
would be great.
> I found reference to a lisp routine: "lockallvp.lsp" but cannot find it on
any Lisp web site.
> Any help would be appreciated.
> Thanks in advance
> Gerry Powell
>

;|**************************************************************************
****
*** VPMax
***
Utilities for viewports.
Bobby C. Jones
5/27/01

Special thanks to (in no particualr order):
Michael Puckett
Cliff Middleton
Frank Oquendo
Vladimir Nesterovsky
Who all, knowingly or unknowingly, directly or indirectly, have contributed
to this set of functions
If I have mistakenly left a name off this list, please accept my apologies
and contact me immediatly

Functions included:
**General Utilities**
1. Massoc - My own flavor. Don't know if it's faster than the others, but
it's easy to read
2. Buildfilter - Takes dotted pair lists and converts to a pair of arrays
3. active-ss - Returns the current active selection set collection object

**XData Utilities**
1. vla:getXdata - Retrives eed from a vla object
2. vla:putXdata - Attaches eed to a vla object
3. sxd - parses an eed string

**Viewport handling utilities**
1. getVPFLayers - gets a list of layers that are frozen in a viewport
2. PutVPFLayers - freezes a list of layers in a viewport
3. getViewData - Gets a list of 'view' data from a viewport
4. putView - Changes a viewports view
5. CopyVP - Creates an exact copy of a viewport sans the eed frozen layer
list
6. togglePSVPon - Turns viewports on and off
7. togglePSVPlocked - Locks and unlocks viewports

**User Interface**
1. c:MvpLay - Matches viewport frozen layers to a user selected viewport
2. c:MvpView - Matches viewport views to a user selected viewport
3. c:vpwd - Sets selected viewports to the "WORKING" layers *(See Data at
EOF)*
4. c:Tvl - Toggles the locked state of selected viewports
5. c:uV - Unlocks all selected viewports
6. c:lV - Locks all selected viewports
|;

;;;***********************
;;;****Initialization*****
;;;***********************
(vl-load-com)
(setq *active-document* (vla-get-activedocument (vlax-get-acad-object))
*paper-space* (vla-get-paperspace *active-document*)
) ;_ end of setq
;;;Lock viewports
(defun c:lv (/ ss)
(setq ss (ssget '((0 . "VIEWPORT"))))
(if ss
(vlax-for obj (active-ss)
(TogglePsVpLocked obj :vlax-true)
) ;_ end of vlax-for
) ;_ end of if
) ;_ end of defun
Message 5 of 10
Anonymous
in reply to: powellg

Here's one from Vladimir Nesterovsky:

(defun c:vpLockAll () ; 4/26/01
(vl-load-com)
(vlax-for lay
(vla-get-Layouts
(vla-get-ActiveDocument
(vlax-get-acad-object)))
(if (eq :vlax-false (vla-get-ModelType lay))
(vlax-for ent (vla-get-Block lay) ; for each ent in layout
(if (= (vla-get-ObjectName ent) "AcDbViewport")
(vla-put-DisplayLocked ent :vlax-true))))))
--
"Make the most of the best
and the least of the worst."
Robert Louis Stevenson

http://www.acadx.com

"powellg" wrote in message
news:f0c2d12.-1@WebX.maYIadrTaRb...
> Does anyone know were I could find a lisp routine to globally lock/unlock
multiple layout vieports.
> I have a DWG with 65 layouts and a routine to to lock/unlock all viewports
would be great.
> I found reference to a lisp routine: "lockallvp.lsp" but cannot find it on
any Lisp web site.
> Any help would be appreciated.
> Thanks in advance
> Gerry Powell
>
Message 6 of 10
powellg
in reply to: powellg

Thanks to everyone that replied.
Bobby, this works great, iIs there one to unlock ??
Message 7 of 10
Anonymous
in reply to: powellg

A simple modification to the original will unlock them. You can keep these
two separate versions with redundant code, or you could re-write the
function and pass an argument that would determine locked or unlocked. I'll
let you decide 🙂

(defun c:vpUnLockAll () ; 4/26/01
(vl-load-com)
(vlax-for lay
(vla-get-Layouts
(vla-get-ActiveDocument
(vlax-get-acad-object)))
(if (eq :vlax-false (vla-get-ModelType lay))
(vlax-for ent (vla-get-Block lay) ; for each ent in layout
(if (= (vla-get-ObjectName ent) "AcDbViewport")
(vla-put-DisplayLocked ent :vlax-false)))))) <--Can you see the
change?
--
"Make the most of the best
and the least of the worst."
Robert Louis Stevenson

http://www.acadx.com

"powellg" wrote in message
news:f0c2d12.4@WebX.maYIadrTaRb...
> Thanks to everyone that replied.
> Bobby, this works great, iIs there one to unlock ??
>
Message 8 of 10
ganeshmag
in reply to: powellg

Thanks For your lisp...

its help to me....

 

 

vplockall

 

Some error is 

 

“; error: AutoCAD variable setting rejected: "ctab" "DE-D-010"

 

DE-D-010 is the file name...

 

how is come????

how to rectify this error...

 

Thanks....

Message 9 of 10
Kent1Cooper
in reply to: ganeshmag


@ganeshmag wrote:

.... 

Some error is 

 

“; error: AutoCAD variable setting rejected: "ctab" "DE-D-010"

 

DE-D-010 is the file name...

 

how is come????

how to rectify this error...

....


The CTAB System Variable must be the name in one of the Tabs ["Model" or one of the other Layouts], rather than the name of the drawing file.  Since you don't mention which routine on this thread you are using, it's hard to say what could be causing the error.  The top one is getting the values it sets into CTAB from the list of Layouts, so it shouldn't be causing trouble, but I haven't looked at the others closely.

Kent Cooper, AIA
Message 10 of 10
mbrandt5
in reply to: powellg

Hi

 

Anyone know of the extra lines of code to apply this to a whole sheet set of dwgs?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost