Using the ChangeCounter

Hello all, this is a dumb question, but how would someone go about using the “ChangeCounter” attribute of a viewport. I’m trying to create a “fake” viewport in a separate window that changes whenever the active viewport changes. I see that there’s a “ChangeCounter” that changes whenever a specific viewport changes, but how do I listen for this change? I figured I would do something similar to what this post is suggesting, in which I listen for a “property” to change and then trigger an action. But I don’t really understand their code: c# - How to trigger event when a variable's value is changed? - Stack Overflow

The action that I would like is for an event to be triggered whenever a user stops moving the camera in the active viewport. but I don’t know how to ‘listen’ for the change counter.

Rhino triggers an event when the active viewport changes from one viewport to another. For an example, see the following:

https://github.com/dalefugier/SampleCsEventWatcher

Does this help?

1 Like

this helps tremendously! thanks Dale.

Hi @dale ,

This link no longer appears to be valid (I realize it was 8 years ago… )

Is there a new location that this example lives or something similar you could point to?

I simply want the ability to have my script listen for anytime the viewport changes/rotates/pans/etc.

Thank you!

There’s also lots of other goodies in here incase you get stuck in the future :wink:

– cs

1 Like

Thanks @CallumSykes !