Change activeview event

is there an event in Rhinocommon which raises when Doc.Views.ActiveView is changed by the user?


Subscribe to the event Rhino.Display.RhinoView.SetActive.

thanks Nathan, I tryed with that event but seems that it is raised only when the user is “getting out” from a detail view, not even when double clicking on it to enter in “model space”, neither navigating between layouts.
What I am looking for is an I an event to get raised when the user navigates from layout to layout (pageView to pageView)

I’ll have to defer answering that to @dale.


This seems to work for me:

public class TestAitorleceta : Command
  private bool m_enabled;

  public override string EnglishName => "TestAitorleceta";

  protected override Result RunCommand(RhinoDoc doc, RunMode mode)
    if (m_enabled)
      RhinoView.SetActive -= OnSetActiveViewEventHandler;
      RhinoView.SetActive += OnSetActiveViewEventHandler;

    m_enabled = !m_enabled;

    return Result.Success;

  /// <summary>
  /// RhinoView.SetActive event handler
  /// </summary>
  public static void OnSetActiveViewEventHandler(object sender, ViewEventArgs e)
    RhinoApp.WriteLine("Active view set to \"{0}\"", e.View.ActiveViewport.Name);

– Dale