@powerpp wrote:
I am trying to start some action every time a newly created view (named "Testview" below) is activated.
But the event is fired every time any viewport is selected.import Rhino as rc import scriptcontext import System def new_view_activated(sender, e): print "Activated view: {}".format(e.View) def add_floating_viewport(name, x, y, w, h): view_table = rc.RhinoDoc.ActiveDoc.Views new_view = view_table.Add(name, rc.Display.DefinedViewportProjection.Perspective, System.Drawing.Rectangle(x,y,w,h), True) print "New view: {}".format(new_view) return new_view new_view = add_floating_viewport("Testview", 100,100, 100,100) func = new_view_activated scriptcontext.sticky["new_view_activated"] = func new_view.SetActive += func
I guess I am missing the exact difference between a view and a viewport? But a viewport does not have a setActive event.
Thanks!
Philip
Posts: 5
Participants: 2