Yes, @Alain, this looks like a bug in rhinoscriptsyntax. In view.py, the RhinoViewport.Magnify method is indeed missing the second argument, which is a Boolean value to either normal or dolly zoom. I will assume normal zoom is used here.
If you feel comfortable modifying your rhinoscriptsyntax file, you can simply change that line to
viewport.Magnify(d,True)
Close Rhino
Navigate to C:\Users\<username>\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript
Open the file views.py in a text editor such as notepad.
Yeah, I don’t know what’s going on there… Looks like RhinoViewport.Magnify is always failing for some reason. @Alain or @stevebaer can you figure this out? --Mitch
For some reason the viewport.Magnify method fails when Point hasn’t been assigned as the third argument. When you assign it, it works without a problem:
import System
def ViewRadius(view=None, radius=None):
"""Returns or sets the radius of a parallel-projected view. Useful
when you need an absolute zoom factor for a parallel-projected view
Parameters:
view:[opt] title or id of the view. If omitted, current active view is used
radius:[opt] the view radius
Returns:
if radius is not specified, the current view radius for the specified view
if radius is specified, the previous view radius for the specified view
"""
view = __viewhelper(view)
viewport = view.ActiveViewport
if not viewport.IsParallelProjection: return scriptcontext.errorhandler()
fr = viewport.GetFrustum()
frus_right = fr[2]
frus_top = fr[4]
old_radius = min(frus_top, frus_right)
if radius is None: return old_radius
magnification_factor = radius / old_radius
d = 1.0 / magnification_factor
x = viewport.Bounds.Width
y = viewport.Bounds.Height
viewport.Magnify(d, True, System.Drawing.Point(int(x/2), int(y/2)))
#viewport.Magnify(d, True)
view.Redraw()
return old_radius