Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski 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
Joined
Aug 1, 2023
Messages
1
Location
IN
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))
)
 
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

Back
Top