(defun C:lva (/ 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)
)
(c:lva)

Advertisements