Change Viewport object properties based on lock\unlock status

Change Viewport object properties based on lock\unlock status

jnelson1071
Advocate Advocate
593 Views
1 Reply
Message 1 of 2

Change Viewport object properties based on lock\unlock status

jnelson1071
Advocate
Advocate

I am looking for a way to change the properties of paperspace Viewport objects in the drawing depending on the viewport lock status.  This would be for any time the viewport lock status is changed in the db. (properties, statusbar)

 

I hate my code watching all the commands and trigger the code, but currently we have a "CommandEnded" running and watching for comands -VPORTS or MVIEW and then kicking off a utility that gets the layout.Getviewports to check the status "if vp.locked" putting it on the specified layer, and adjusting color to bylayer or magenta.  The problem with this is that it is a workaround and only functions on the layout viewports after those commands are used.  Surprisingly this does work if I use the right click menu to lock\unlock the viewport,  just not switching in the properties menu or the statusbar.

 

Is there a way to see the switching of the lock status of the viewport objects in the db and modify them on the fly?  I'm using VB.Net if that help resolve the problem.  I just don't see where that is exposed in the API to watch the status of the viewport in the db to trigger my code.  If this can't be done, any idea on the command names for locking the viewport via properties or statusbar?  To be honest I'm surprised the the Right click menu makes it trigger.

0 Likes
594 Views
1 Reply
Reply (1)
Message 2 of 2

ActivistInvestor
Mentor
Mentor
I'm not aware of any specific event that would signal a change in a viewport's DisplayLocked status, but an ObjectOverrule that targets the Viewport entity class would allow you to monitor and react to that change. You would simply override the Closed() event of the ObjectOverrule, and in your override, check the viewport's DisplayLocked status and act accordingly. (Once again, the quote button in the message editor doesn't work).
0 Likes