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

Lisp to lock / unlock all viewports.

11 REPLIES 11
Reply
Message 1 of 12
Anonymous
10102 Views, 11 Replies

Lisp to lock / unlock all viewports.

Anonymous
Not applicable
Hi all I am after a small piece of code to lock or unlock all viewports.
Basically a toggle.

I know the command is Mview -> L -> on or off -> then select object.

Any help would be appreciated.

Regards
DB
0 Likes

Lisp to lock / unlock all viewports.

Hi all I am after a small piece of code to lock or unlock all viewports.
Basically a toggle.

I know the command is Mview -> L -> on or off -> then select object.

Any help would be appreciated.

Regards
DB
11 REPLIES 11
Message 2 of 12
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
Short example for you:

(defun c:avs(/ psCol wMode tFlag)
(vl-load-com)
(initget 1 "ON OFF")
(setq psCol
(vla-get-Paperspace
(vla-get-ActiveDocument
(vlax-get-acad-object)))
wMode(getkword "\nOn or Off all PViewports [ON/OFF]: ")
); end setq
(if(= wMode "ON")
(setq tFlag :vlax-true)
(setq tFlag :vlax-false)
); end setq
(vlax-for pw psCol
(if
(vl-catch-all-error-p
(vl-catch-all-apply
'vla-put-ViewportOn(list pw tFlag)))
t); end if
); end vlax-for
(princ)
); end of c:avs

Short example for you:

(defun c:avs(/ psCol wMode tFlag)
(vl-load-com)
(initget 1 "ON OFF")
(setq psCol
(vla-get-Paperspace
(vla-get-ActiveDocument
(vlax-get-acad-object)))
wMode(getkword "\nOn or Off all PViewports [ON/OFF]: ")
); end setq
(if(= wMode "ON")
(setq tFlag :vlax-true)
(setq tFlag :vlax-false)
); end setq
(vlax-for pw psCol
(if
(vl-catch-all-error-p
(vl-catch-all-apply
'vla-put-ViewportOn(list pw tFlag)))
t); end if
); end vlax-for
(princ)
); end of c:avs
Message 3 of 12
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
DB wrote:
> Hi all I am after a small piece of code to lock or unlock all viewports.
> Basically a toggle.
>
> I know the command is Mview -> L -> on or off -> then select object.
>
> Any help would be appreciated.
>
> Regards
> DB

these, if autoloaded, require only one command line input per On or OFF

;lock PS viewports

(defun C:LVP ()
(setq clay (getvar "CLAYER"))
(command "-VPORTS" "L" "ON" "ALL" "")
(setvar "CLAYER" clay)
(princ)
)

;unlock PS viewports

(defun C:UVP ()
(setq clay (getvar "CLAYER"))
(command "-VPORTS" "L" "OFF" "ALL" "")
(setvar "CLAYER" clay)
(princ)
)
0 Likes

DB wrote:
> Hi all I am after a small piece of code to lock or unlock all viewports.
> Basically a toggle.
>
> I know the command is Mview -> L -> on or off -> then select object.
>
> Any help would be appreciated.
>
> Regards
> DB

these, if autoloaded, require only one command line input per On or OFF

;lock PS viewports

(defun C:LVP ()
(setq clay (getvar "CLAYER"))
(command "-VPORTS" "L" "ON" "ALL" "")
(setvar "CLAYER" clay)
(princ)
)

;unlock PS viewports

(defun C:UVP ()
(setq clay (getvar "CLAYER"))
(command "-VPORTS" "L" "OFF" "ALL" "")
(setvar "CLAYER" clay)
(princ)
)
Message 4 of 12
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
To lock or unlock all PViewports in all Layouts
use the following:


(defun C:vpLocks (/ kw kval doc adoc lao cnt inc cvprt blk pw)
(vl-load-com)
(initget 1 "Lock Unlock")
(setq kw (getkword "\nLock or Unlock all PViewports [Lock/Unlock]: "))
(setq kw (strcase kw))
(if (= kw "LOCK")
(setq kval :vlax-true)
(if (= kw "UNLOCK")
(setq kval :vlax-false)
)
)
(setq doc (vlax-get-object "AutoCad.Application")
adoc (vla-get-ActiveDocument doc)
lao (vla-get-Layouts adoc)
cnt (vla-get-Count lao)
inc 0
)
(repeat cnt
(setq cvprt (vla-Item lao inc)
inc (+ inc 1)
blk (vla-get-Block cvprt)
)
(vlax-for itm blk
(if
(vlax-property-available-p itm 'DisplayLocked)
(progn
(vla-put-DisplayLocked itm kval)
(vla-update itm)
)
)
)
)
(princ)
)


"DB" wrote in message
news:4920637@discussion.autodesk.com...
Hi all I am after a small piece of code to lock or unlock all viewports.
Basically a toggle.

I know the command is Mview -> L -> on or off -> then select object.

Any help would be appreciated.

Regards
DB

To lock or unlock all PViewports in all Layouts
use the following:


(defun C:vpLocks (/ kw kval doc adoc lao cnt inc cvprt blk pw)
(vl-load-com)
(initget 1 "Lock Unlock")
(setq kw (getkword "\nLock or Unlock all PViewports [Lock/Unlock]: "))
(setq kw (strcase kw))
(if (= kw "LOCK")
(setq kval :vlax-true)
(if (= kw "UNLOCK")
(setq kval :vlax-false)
)
)
(setq doc (vlax-get-object "AutoCad.Application")
adoc (vla-get-ActiveDocument doc)
lao (vla-get-Layouts adoc)
cnt (vla-get-Count lao)
inc 0
)
(repeat cnt
(setq cvprt (vla-Item lao inc)
inc (+ inc 1)
blk (vla-get-Block cvprt)
)
(vlax-for itm blk
(if
(vlax-property-available-p itm 'DisplayLocked)
(progn
(vla-put-DisplayLocked itm kval)
(vla-update itm)
)
)
)
)
(princ)
)


"DB" wrote in message
news:4920637@discussion.autodesk.com...
Hi all I am after a small piece of code to lock or unlock all viewports.
Basically a toggle.

I know the command is Mview -> L -> on or off -> then select object.

Any help would be appreciated.

Regards
DB
Message 5 of 12
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
once again requiring two command line inputs to get the job done...

Dann wrote:
> To lock or unlock all PViewports in all Layouts
> use the following:
>
>
> (defun C:vpLocks (/ kw kval doc adoc lao cnt inc cvprt blk pw)
> (vl-load-com)
> (initget 1 "Lock Unlock")
> (setq kw (getkword "\nLock or Unlock all PViewports [Lock/Unlock]: "))
> (setq kw (strcase kw))
> (if (= kw "LOCK")
> (setq kval :vlax-true)
> (if (= kw "UNLOCK")
> (setq kval :vlax-false)
> )
> )
> (setq doc (vlax-get-object "AutoCad.Application")
> adoc (vla-get-ActiveDocument doc)
> lao (vla-get-Layouts adoc)
> cnt (vla-get-Count lao)
> inc 0
> )
> (repeat cnt
> (setq cvprt (vla-Item lao inc)
> inc (+ inc 1)
> blk (vla-get-Block cvprt)
> )
> (vlax-for itm blk
> (if
> (vlax-property-available-p itm 'DisplayLocked)
> (progn
> (vla-put-DisplayLocked itm kval)
> (vla-update itm)
> )
> )
> )
> )
> (princ)
> )
>
>
> "DB" wrote in message
> news:4920637@discussion.autodesk.com...
> Hi all I am after a small piece of code to lock or unlock all viewports.
> Basically a toggle.
>
> I know the command is Mview -> L -> on or off -> then select object.
>
> Any help would be appreciated.
>
> Regards
> DB
0 Likes

once again requiring two command line inputs to get the job done...

Dann wrote:
> To lock or unlock all PViewports in all Layouts
> use the following:
>
>
> (defun C:vpLocks (/ kw kval doc adoc lao cnt inc cvprt blk pw)
> (vl-load-com)
> (initget 1 "Lock Unlock")
> (setq kw (getkword "\nLock or Unlock all PViewports [Lock/Unlock]: "))
> (setq kw (strcase kw))
> (if (= kw "LOCK")
> (setq kval :vlax-true)
> (if (= kw "UNLOCK")
> (setq kval :vlax-false)
> )
> )
> (setq doc (vlax-get-object "AutoCad.Application")
> adoc (vla-get-ActiveDocument doc)
> lao (vla-get-Layouts adoc)
> cnt (vla-get-Count lao)
> inc 0
> )
> (repeat cnt
> (setq cvprt (vla-Item lao inc)
> inc (+ inc 1)
> blk (vla-get-Block cvprt)
> )
> (vlax-for itm blk
> (if
> (vlax-property-available-p itm 'DisplayLocked)
> (progn
> (vla-put-DisplayLocked itm kval)
> (vla-update itm)
> )
> )
> )
> )
> (princ)
> )
>
>
> "DB" wrote in message
> news:4920637@discussion.autodesk.com...
> Hi all I am after a small piece of code to lock or unlock all viewports.
> Basically a toggle.
>
> I know the command is Mview -> L -> on or off -> then select object.
>
> Any help would be appreciated.
>
> Regards
> DB
Message 6 of 12
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
Easily fixed.
Plus it unlocks ALL PaperSpace ViewPorts, not just the paperspace you are
currently in.

(defun C:vpl(/ kw)
(setq kw "LOCK")
(vplocks kw)
(princ)
)
(defun C:ulvp(/ kw)
(setq kw "UNLOCK")
(vplocks kw)
(princ)
)

(defun vpLocks (kw / kval doc adoc lao cnt inc cvprt blk pw)
(vl-load-com)
(if (= kw "LOCK")
(setq kval :vlax-true)
(if (= kw "UNLOCK")
(setq kval :vlax-false)
)
)
(setq doc (vlax-get-object "AutoCad.Application")
adoc (vla-get-ActiveDocument doc)
lao (vla-get-Layouts adoc)
cnt (vla-get-Count lao)
inc 0
)
(repeat cnt
(setq cvprt (vla-Item lao inc)
inc (+ inc 1)
blk (vla-get-Block cvprt)
)
(vlax-for itm blk
(if
(vlax-property-available-p itm 'DisplayLocked)
(progn
(vla-put-DisplayLocked itm kval)
(vla-update itm)
)
)
)
)




"ddpcad" wrote in message
news:4921387@discussion.autodesk.com...
once again requiring two command line inputs to get the job done...

Dann wrote:
> To lock or unlock all PViewports in all Layouts
> use the following:
>
>
> (defun C:vpLocks (/ kw kval doc adoc lao cnt inc cvprt blk pw)
> (vl-load-com)
> (initget 1 "Lock Unlock")
> (setq kw (getkword "\nLock or Unlock all PViewports [Lock/Unlock]: "))
> (setq kw (strcase kw))
> (if (= kw "LOCK")
> (setq kval :vlax-true)
> (if (= kw "UNLOCK")
> (setq kval :vlax-false)
> )
> )
> (setq doc (vlax-get-object "AutoCad.Application")
> adoc (vla-get-ActiveDocument doc)
> lao (vla-get-Layouts adoc)
> cnt (vla-get-Count lao)
> inc 0
> )
> (repeat cnt
> (setq cvprt (vla-Item lao inc)
> inc (+ inc 1)
> blk (vla-get-Block cvprt)
> )
> (vlax-for itm blk
> (if
> (vlax-property-available-p itm 'DisplayLocked)
> (progn
> (vla-put-DisplayLocked itm kval)
> (vla-update itm)
> )
> )
> )
> )
> (princ)
> )
>
>
> "DB" wrote in message
> news:4920637@discussion.autodesk.com...
> Hi all I am after a small piece of code to lock or unlock all viewports.
> Basically a toggle.
>
> I know the command is Mview -> L -> on or off -> then select object.
>
> Any help would be appreciated.
>
> Regards
> DB
0 Likes

Easily fixed.
Plus it unlocks ALL PaperSpace ViewPorts, not just the paperspace you are
currently in.

(defun C:vpl(/ kw)
(setq kw "LOCK")
(vplocks kw)
(princ)
)
(defun C:ulvp(/ kw)
(setq kw "UNLOCK")
(vplocks kw)
(princ)
)

(defun vpLocks (kw / kval doc adoc lao cnt inc cvprt blk pw)
(vl-load-com)
(if (= kw "LOCK")
(setq kval :vlax-true)
(if (= kw "UNLOCK")
(setq kval :vlax-false)
)
)
(setq doc (vlax-get-object "AutoCad.Application")
adoc (vla-get-ActiveDocument doc)
lao (vla-get-Layouts adoc)
cnt (vla-get-Count lao)
inc 0
)
(repeat cnt
(setq cvprt (vla-Item lao inc)
inc (+ inc 1)
blk (vla-get-Block cvprt)
)
(vlax-for itm blk
(if
(vlax-property-available-p itm 'DisplayLocked)
(progn
(vla-put-DisplayLocked itm kval)
(vla-update itm)
)
)
)
)




"ddpcad" wrote in message
news:4921387@discussion.autodesk.com...
once again requiring two command line inputs to get the job done...

Dann wrote:
> To lock or unlock all PViewports in all Layouts
> use the following:
>
>
> (defun C:vpLocks (/ kw kval doc adoc lao cnt inc cvprt blk pw)
> (vl-load-com)
> (initget 1 "Lock Unlock")
> (setq kw (getkword "\nLock or Unlock all PViewports [Lock/Unlock]: "))
> (setq kw (strcase kw))
> (if (= kw "LOCK")
> (setq kval :vlax-true)
> (if (= kw "UNLOCK")
> (setq kval :vlax-false)
> )
> )
> (setq doc (vlax-get-object "AutoCad.Application")
> adoc (vla-get-ActiveDocument doc)
> lao (vla-get-Layouts adoc)
> cnt (vla-get-Count lao)
> inc 0
> )
> (repeat cnt
> (setq cvprt (vla-Item lao inc)
> inc (+ inc 1)
> blk (vla-get-Block cvprt)
> )
> (vlax-for itm blk
> (if
> (vlax-property-available-p itm 'DisplayLocked)
> (progn
> (vla-put-DisplayLocked itm kval)
> (vla-update itm)
> )
> )
> )
> )
> (princ)
> )
>
>
> "DB" wrote in message
> news:4920637@discussion.autodesk.com...
> Hi all I am after a small piece of code to lock or unlock all viewports.
> Basically a toggle.
>
> I know the command is Mview -> L -> on or off -> then select object.
>
> Any help would be appreciated.
>
> Regards
> DB
Message 7 of 12
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
can you modify this to only lock viewports, as well as skip the promp so that it just locks them all?
0 Likes

can you modify this to only lock viewports, as well as skip the promp so that it just locks them all?
Message 8 of 12
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
Check this out.
http://www.theswamp.org/index.php?topic=7097.0
[code];;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;;; + Viewport Lock/Unlock +
;;; + Created by C. Alan Butler +
;;; + Copyright 2005-2006 +
;;; + by Precision Drafting & Design All Rights Reserved. +
;;; + Contact at ab2draft@TampaBay.rr.com +
;;; + look for updates in TheSwamp.org +
;;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;;;
;;; THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
;;; WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
;;; PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.
;;;
;;; You are hereby granted permission to use, copy and modify this
;;; software without charge, provided you do so exclusively for
;;; your own use or for use by others in your organization in the
;;; performance of their normal duties, and provided further that
;;; the above copyright notice appears in all copies and both that
;;; copyright notice and the limited warranty and restricted rights
;;; notice below appear in all supporting documentation.
;;;
;;; Version 05.12.07

;;; The following are several routines for locking & unlocking viewports
;;; They are dependent on subroutines vplock & vp_sel
;;;
;;; c:vpunlockall unlock all vp & set color to green
;;; c:vplockall lock all vp and set color to red
;;; c:vplock lock one vp & set color to red
;;; c:vpunlock unlock one vp & set color to green
;;; c:vptogle toggle vp lock & color until ENTER
;;; c:vpl choice to user to lock or unlock, one or all
;;; c:vplockctab lock all vp in ctab, set color to red
;;; c:vpunlockctab UNlock all vp in ctab, set color to green
;;;
;;; vplock sub lock or unlock one or all vp and set color
;;; vp_sel sub user pick vp - return the ename of vp or nil [/code]
0 Likes

Check this out.
http://www.theswamp.org/index.php?topic=7097.0
[code];;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;;; + Viewport Lock/Unlock +
;;; + Created by C. Alan Butler +
;;; + Copyright 2005-2006 +
;;; + by Precision Drafting & Design All Rights Reserved. +
;;; + Contact at ab2draft@TampaBay.rr.com +
;;; + look for updates in TheSwamp.org +
;;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;;;
;;; THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
;;; WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
;;; PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.
;;;
;;; You are hereby granted permission to use, copy and modify this
;;; software without charge, provided you do so exclusively for
;;; your own use or for use by others in your organization in the
;;; performance of their normal duties, and provided further that
;;; the above copyright notice appears in all copies and both that
;;; copyright notice and the limited warranty and restricted rights
;;; notice below appear in all supporting documentation.
;;;
;;; Version 05.12.07

;;; The following are several routines for locking & unlocking viewports
;;; They are dependent on subroutines vplock & vp_sel
;;;
;;; c:vpunlockall unlock all vp & set color to green
;;; c:vplockall lock all vp and set color to red
;;; c:vplock lock one vp & set color to red
;;; c:vpunlock unlock one vp & set color to green
;;; c:vptogle toggle vp lock & color until ENTER
;;; c:vpl choice to user to lock or unlock, one or all
;;; c:vplockctab lock all vp in ctab, set color to red
;;; c:vpunlockctab UNlock all vp in ctab, set color to green
;;;
;;; vplock sub lock or unlock one or all vp and set color
;;; vp_sel sub user pick vp - return the ename of vp or nil [/code]
Message 9 of 12
Anonymous
in reply to: Anonymous

Anonymous
Not applicable

Good job! Thank you.


@Anonymous wrote:
To lock or unlock all PViewports in all Layouts
use the following:


(defun C:vpLocks (/ kw kval doc adoc lao cnt inc cvprt blk pw)
(vl-load-com)
(initget 1 "Lock Unlock")
(setq kw (getkword "\nLock or Unlock all PViewports [Lock/Unlock]: "))
(setq kw (strcase kw))
(if (= kw "LOCK")
(setq kval :vlax-true)
(if (= kw "UNLOCK")
(setq kval :vlax-false)
)
)
(setq doc (vlax-get-object "AutoCad.Application")
adoc (vla-get-ActiveDocument doc)
lao (vla-get-Layouts adoc)
cnt (vla-get-Count lao)
inc 0
)
(repeat cnt
(setq cvprt (vla-Item lao inc)
inc (+ inc 1)
blk (vla-get-Block cvprt)
)
(vlax-for itm blk
(if
(vlax-property-available-p itm 'DisplayLocked)
(progn
(vla-put-DisplayLocked itm kval)
(vla-update itm)
)
)
)
)
(princ)
)


"DB" wrote in message
news:4920637@discussion.autodesk.com...
Hi all I am after a small piece of code to lock or unlock all viewports.
Basically a toggle.

I know the command is Mview -> L -> on or off -> then select object.

Any help would be appreciated.

Regards
DB

@Anonymous wrote:
To lock or unlock all PViewports in all Layouts
use the following:


(defun C:vpLocks (/ kw kval doc adoc lao cnt inc cvprt blk pw)
(vl-load-com)
(initget 1 "Lock Unlock")
(setq kw (getkword "\nLock or Unlock all PViewports [Lock/Unlock]: "))
(setq kw (strcase kw))
(if (= kw "LOCK")
(setq kval :vlax-true)
(if (= kw "UNLOCK")
(setq kval :vlax-false)
)
)
(setq doc (vlax-get-object "AutoCad.Application")
adoc (vla-get-ActiveDocument doc)
lao (vla-get-Layouts adoc)
cnt (vla-get-Count lao)
inc 0
)
(repeat cnt
(setq cvprt (vla-Item lao inc)
inc (+ inc 1)
blk (vla-get-Block cvprt)
)
(vlax-for itm blk
(if
(vlax-property-available-p itm 'DisplayLocked)
(progn
(vla-put-DisplayLocked itm kval)
(vla-update itm)
)
)
)
)
(princ)
)


"DB" wrote in message
news:4920637@discussion.autodesk.com...
Hi all I am after a small piece of code to lock or unlock all viewports.
Basically a toggle.

I know the command is Mview -> L -> on or off -> then select object.

Any help would be appreciated.

Regards
DB

 

Good job! Thank you.


@Anonymous wrote:
To lock or unlock all PViewports in all Layouts
use the following:


(defun C:vpLocks (/ kw kval doc adoc lao cnt inc cvprt blk pw)
(vl-load-com)
(initget 1 "Lock Unlock")
(setq kw (getkword "\nLock or Unlock all PViewports [Lock/Unlock]: "))
(setq kw (strcase kw))
(if (= kw "LOCK")
(setq kval :vlax-true)
(if (= kw "UNLOCK")
(setq kval :vlax-false)
)
)
(setq doc (vlax-get-object "AutoCad.Application")
adoc (vla-get-ActiveDocument doc)
lao (vla-get-Layouts adoc)
cnt (vla-get-Count lao)
inc 0
)
(repeat cnt
(setq cvprt (vla-Item lao inc)
inc (+ inc 1)
blk (vla-get-Block cvprt)
)
(vlax-for itm blk
(if
(vlax-property-available-p itm 'DisplayLocked)
(progn
(vla-put-DisplayLocked itm kval)
(vla-update itm)
)
)
)
)
(princ)
)


"DB" wrote in message
news:4920637@discussion.autodesk.com...
Hi all I am after a small piece of code to lock or unlock all viewports.
Basically a toggle.

I know the command is Mview -> L -> on or off -> then select object.

Any help would be appreciated.

Regards
DB

@Anonymous wrote:
To lock or unlock all PViewports in all Layouts
use the following:


(defun C:vpLocks (/ kw kval doc adoc lao cnt inc cvprt blk pw)
(vl-load-com)
(initget 1 "Lock Unlock")
(setq kw (getkword "\nLock or Unlock all PViewports [Lock/Unlock]: "))
(setq kw (strcase kw))
(if (= kw "LOCK")
(setq kval :vlax-true)
(if (= kw "UNLOCK")
(setq kval :vlax-false)
)
)
(setq doc (vlax-get-object "AutoCad.Application")
adoc (vla-get-ActiveDocument doc)
lao (vla-get-Layouts adoc)
cnt (vla-get-Count lao)
inc 0
)
(repeat cnt
(setq cvprt (vla-Item lao inc)
inc (+ inc 1)
blk (vla-get-Block cvprt)
)
(vlax-for itm blk
(if
(vlax-property-available-p itm 'DisplayLocked)
(progn
(vla-put-DisplayLocked itm kval)
(vla-update itm)
)
)
)
)
(princ)
)


"DB" wrote in message
news:4920637@discussion.autodesk.com...
Hi all I am after a small piece of code to lock or unlock all viewports.
Basically a toggle.

I know the command is Mview -> L -> on or off -> then select object.

Any help would be appreciated.

Regards
DB

 

Message 10 of 12
Anonymous
in reply to: Anonymous

Anonymous
Not applicable

Do you know how this can be applied to all layout tabs at the same time?

0 Likes

Do you know how this can be applied to all layout tabs at the same time?

Message 11 of 12
Sea-Haven
in reply to: Anonymous

Sea-Haven
Mentor
Mentor

"Lock or Unlock all PViewports" that is what the code is saying.

0 Likes

"Lock or Unlock all PViewports" that is what the code is saying.

Message 12 of 12
dlanorh
in reply to: Anonymous

dlanorh
Advisor
Advisor

In it's basic form

 

(defun rh:vpl ( )
  (ssget "_X" '((0 . "VIEWPORT") (410 . "~Model")))
  (vlax-for x (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object))) (vlax-put-property x 'displaylocked :vlax-true))
);end_defun

 

to call it in a lisp use (rh:vpl)

I am not one of the robots you're looking for

0 Likes

In it's basic form

 

(defun rh:vpl ( )
  (ssget "_X" '((0 . "VIEWPORT") (410 . "~Model")))
  (vlax-for x (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object))) (vlax-put-property x 'displaylocked :vlax-true))
);end_defun

 

to call it in a lisp use (rh:vpl)

I am not one of the robots you're looking for

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report