Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

VIEW PORT LOCK STATUS

Status
Not open for further replies.

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))
)
 
Replies continue below

Recommended for you

What part isn't working, what is error message?
 
Isn't it easier to just look at the viewport lock icon at the bottom of the screen?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor