Community
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
Do you know how this can be applied to all layout tabs at the same time?
Do you know how this can be applied to all layout tabs at the same time?
"Lock or Unlock all PViewports" that is what the code is saying.
"Lock or Unlock all PViewports" that is what the code is saying.
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
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.