Expression to check if current viewport is locked

Expression to check if current viewport is locked

ArchD
Collaborator Collaborator
1,658 Views
7 Replies
Message 1 of 8

Expression to check if current viewport is locked

ArchD
Collaborator
Collaborator

I'm looking for a method to check if the current viewport is locked or unlocked, returning T or nil.

I find many methods that are similar to the one below, but gives me an error: 

; error: Automation Error. No active viewport in paperspace

 

(vl-load-com)
(setq is_vp_lock (vla-get-displaylocked (vla-get-activeviewport (vla-get-activedocument (vlax-get-acad-object)))))

Thanks for any help.

Archie Dodge
Applications Expert - Infrastructure Solutions Division
IMAGINiT Technologies
0 Likes
Accepted solutions (1)
1,659 Views
7 Replies
Replies (7)
Message 2 of 8

Shneuph
Collaborator
Collaborator

I'd have to look at it more... but I think the code is accessing the wrong type of viewport?

Viewports - Object Model.png

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 3 of 8

Shneuph
Collaborator
Collaborator
(vla-get-displaylocked (VLA-GET-activePviewport (vla-get-activedocument (vlax-get-acad-object))))
---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 4 of 8

Kent1Cooper
Consultant
Consultant
Accepted solution

This has come up before.

Kent Cooper, AIA
Message 5 of 8

ArchD
Collaborator
Collaborator

Wow, I've looked at so many of these posts and they all seemed to give me this error. Unfortunately this post never came up in my searches, but is exactly what I needed. Thanks for the link!

Archie Dodge
Applications Expert - Infrastructure Solutions Division
IMAGINiT Technologies
0 Likes
Message 6 of 8

ArchD
Collaborator
Collaborator

Where did you find that chart? I'd love to look at that in full.

Archie Dodge
Applications Expert - Infrastructure Solutions Division
IMAGINiT Technologies
0 Likes
Message 7 of 8

Shneuph
Collaborator
Collaborator

It used to be really easy to find in the help menu.  Along with all other developer info.  I found one here:

https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/AutoCAD-ActiveX/files...

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
0 Likes
Message 8 of 8

Shneuph
Collaborator
Collaborator

Windows+R then paste the path:

%ProgramFiles%\Common Files\Autodesk Shared

 

acadauto.chm  is the help file you want.

 

I'm making a shortcut to it for myself to use right now.

 

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
0 Likes