I wonder which event is triggered upon the change of its value?
One way is to create a display conduit and override
Rhino.Display.DisplayConduit.CalculateBoundingBox, as this will be called when zooming.
CalculateBoundingBox seems to be firing not only during zoom but also pan. Is there a way to isolate and trigger only if zooming?
I wanted to GetWorldToScreenScale within the event handler but Rhino crashes.
This is what I do:
If you uncomment either of the commented lines rhino will crash.
import scriptcontext as sc import Rhino vp = None class dc(Rhino.Display.DisplayConduit): def CalculateBoundingBox(self,e): global vp vp = e.Viewport#.GetWorldToScreenScale(pt) print vp#.GetWorldToScreenScale(pt) def zoom_event_helper_func(): #Event trigger helper function if sc.sticky.has_key('ZoomCallback'): callback = sc.sticky['ZoomCallback'] if callback: callback.Enabled = False callback = None sc.sticky.Remove('ZoomCallback') print "zoom event listener stopped." else: callback = dc() callback.Enabled = True sc.sticky['ZoomCallback'] = callback print "zoom event listener started." zoom_event_helper_func()
Can you think of any workaround, @dale?
Oh, now I see pt is not defined.
Heeyy I got it.