Click or drag to resize
RhinoViewportSize Property
Gets or sets the height and width of the viewport (in pixels)

Namespace: Rhino.Display
Assembly: RhinoCommon (in RhinoCommon.dll) Version: 5.1.50000.0 (5.0.20693.0)
Syntax
public Size Size { get; set; }

Property Value

Type: Size
Examples
using Rhino;
using Rhino.Commands;

namespace examples_cs
{
  public class ViewportResolutionCommand : Command
  {
    public override string EnglishName { get { return "csViewportResolution"; } }

    protected override Result RunCommand(RhinoDoc doc, RunMode mode)
    {
      var active_viewport = doc.Views.ActiveView.ActiveViewport;
      RhinoApp.WriteLine("Name = {0}: Width = {1}, Height = {2}", 
        active_viewport.Name, active_viewport.Size.Width, active_viewport.Size.Height);
      return Result.Success;
    }
  }
}
from scriptcontext import doc

activeViewport = doc.Views.ActiveView.ActiveViewport
print "Name = {0}: Width = {1}, Height = {2}".format(
    activeViewport.Name, activeViewport.Size.Width, activeViewport.Size.Height)
See Also