Click or drag to resize

RhinoPageViewPageWidth Property

Width of the page in the document's PageUnitSystem

Namespace:  Rhino.Display
Assembly:  RhinoCommon (in RhinoCommon.dll)
Since: 5.10
Syntax
public double PageWidth { get; set; }

Property Value

Type: Double
Examples
using Rhino;
using Rhino.Commands;
using Rhino.Input;

namespace examples_cs
{
  public class RhinoPageViewWidthHeightCommand : Command
  {
    public override string EnglishName { get { return "csSetRhinoPageViewWidthAndHeight"; } }

    protected override Result RunCommand(RhinoDoc doc, RunMode mode)
    {
      var width = 1189;
      var height = 841;
      var page_views = doc.Views.GetPageViews();
      int page_number = (page_views==null) ? 1 : page_views.Length + 1;
      var pageview = doc.Views.AddPageView(string.Format("A0_{0}",page_number), width, height);

      int new_width = width;
      var rc = RhinoGet.GetInteger("new width", false, ref new_width);
      if (rc != Result.Success || new_width <= 0) return rc;

      int new_height = height;
      rc = RhinoGet.GetInteger("new height", false, ref new_height);
      if (rc != Result.Success || new_height <= 0) return rc;

      pageview.PageWidth = new_width;
      pageview.PageHeight = new_height;
      doc.Views.Redraw();
      return Result.Success;
    }
  }
}
Python
from Rhino import *
from Rhino.Commands import *
from Rhino.Input import *
from scriptcontext import doc

def RunCommand():
  width = 1189
  height = 841
  page_views = doc.Views.GetPageViews()
  page_number = 1 if page_views==None else page_views.Length + 1
  pageview = doc.Views.AddPageView("A0_{0}".format(page_number), width, height)

  new_width = width
  rc, new_width = RhinoGet.GetInteger("new width", False, new_width)
  if rc != Result.Success or new_width <= 0: return rc

  new_height = height
  rc, new_height = RhinoGet.GetInteger("new height", False, new_height)
  if rc != Result.Success or new_height <= 0: return rc

  pageview.PageWidth = new_width
  pageview.PageHeight = new_height
  doc.Views.Redraw()
  return Result.Success

if __name__ == "__main__":
  RunCommand()
See Also