FAROQOUE_VIVA
Mechanical
- Aug 1, 2023
- 1
I have code to check VIEW PORT LOCK STAUTS.
but it is not working, could any one help me in this to resolve.
(defun get-viewport-lock-status ()
(setq lock-status-list '())
(vlax-for layout (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))
(if (= (vla-get-objectname layout) "AcDbLayout")
(progn
(setq viewport (vlax-ename->vla-object (car (vla-get-viewports layout))))
(setq lock-status (vla-get-locked viewport))
(setq lock-status-list (cons (list (vla-get-name layout) lock-status) lock-status-list))
)
)
)
(setq lock-status-list (reverse lock-status-list))
)
(setq viewport-lock-status (get-viewport-lock-status))
(princ "\nViewport Lock Status:\n")
(setq counter 1)
(vlax-for item viewport-lock-status
(setq layout-name (car item))
(setq locked (cadr item))
(setq lock-status-str (if locked "Locked" "Unlocked"))
(princ (strcat "\n" (itoa counter) ". " layout-name ": " lock-status-str))
(setq counter (1+ counter))
)
but it is not working, could any one help me in this to resolve.
(defun get-viewport-lock-status ()
(setq lock-status-list '())
(vlax-for layout (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))
(if (= (vla-get-objectname layout) "AcDbLayout")
(progn
(setq viewport (vlax-ename->vla-object (car (vla-get-viewports layout))))
(setq lock-status (vla-get-locked viewport))
(setq lock-status-list (cons (list (vla-get-name layout) lock-status) lock-status-list))
)
)
)
(setq lock-status-list (reverse lock-status-list))
)
(setq viewport-lock-status (get-viewport-lock-status))
(princ "\nViewport Lock Status:\n")
(setq counter 1)
(vlax-for item viewport-lock-status
(setq layout-name (car item))
(setq locked (cadr item))
(setq lock-status-str (if locked "Locked" "Unlocked"))
(princ (strcat "\n" (itoa counter) ". " layout-name ": " lock-status-str))
(setq counter (1+ counter))
)