Click or drag to resize
LinearDimension Constructor (Plane, Point2d, Point2d, Point2d)
Initializes a new instance of the LinearDimension class

Namespace: Rhino.Geometry
Assembly: RhinoCommon (in RhinoCommon.dll) Version: 5.1.50000.0 (5.0.20693.0)
Syntax
public LinearDimension(
	Plane dimensionPlane,
	Point2d extensionLine1End,
	Point2d extensionLine2End,
	Point2d pointOnDimensionLine
)

Parameters

dimensionPlane
Type: Rhino.GeometryPlane

[Missing <param name="dimensionPlane"/> documentation for "M:Rhino.Geometry.LinearDimension.#ctor(Rhino.Geometry.Plane,Rhino.Geometry.Point2d,Rhino.Geometry.Point2d,Rhino.Geometry.Point2d)"]

extensionLine1End
Type: Rhino.GeometryPoint2d

[Missing <param name="extensionLine1End"/> documentation for "M:Rhino.Geometry.LinearDimension.#ctor(Rhino.Geometry.Plane,Rhino.Geometry.Point2d,Rhino.Geometry.Point2d,Rhino.Geometry.Point2d)"]

extensionLine2End
Type: Rhino.GeometryPoint2d

[Missing <param name="extensionLine2End"/> documentation for "M:Rhino.Geometry.LinearDimension.#ctor(Rhino.Geometry.Plane,Rhino.Geometry.Point2d,Rhino.Geometry.Point2d,Rhino.Geometry.Point2d)"]

pointOnDimensionLine
Type: Rhino.GeometryPoint2d

[Missing <param name="pointOnDimensionLine"/> documentation for "M:Rhino.Geometry.LinearDimension.#ctor(Rhino.Geometry.Plane,Rhino.Geometry.Point2d,Rhino.Geometry.Point2d,Rhino.Geometry.Point2d)"]

Examples
using System;
using Rhino.Geometry;

partial class Examples
{
  public static Rhino.Commands.Result AddLinearDimension2(Rhino.RhinoDoc doc)
  {
    Point3d origin = new Point3d(1,1,0);
    Point3d offset = new Point3d(11,1,0);
    Point3d pt = new Point3d((offset.X-origin.X)/2,3,0);

    Plane plane = Plane.WorldXY;
    plane.Origin = origin;

    double u,v;
    plane.ClosestParameter(origin, out u, out v);
    Point2d ext1 = new Point2d(u, v);

    plane.ClosestParameter(offset, out u, out v);
    Point2d ext2 = new Point2d(u, v);

    plane.ClosestParameter(pt, out u, out v);
    Point2d linePt = new Point2d(u, v);

    LinearDimension dimension = new LinearDimension(plane, ext1, ext2, linePt);
    if (doc.Objects.AddLinearDimension(dimension) != Guid.Empty)
    {
      doc.Views.Redraw();
      return Rhino.Commands.Result.Success;
    }
    return Rhino.Commands.Result.Failure;
  }
}
import Rhino
import scriptcontext
import System.Guid

def AddLinearDimension2():
    origin = Rhino.Geometry.Point3d(1,1,0)
    offset = Rhino.Geometry.Point3d(11,1,0)
    pt = Rhino.Geometry.Point3d((offset.X-origin.X)/2.0,3,0)
    plane = Rhino.Geometry.Plane.WorldXY
    plane.Origin = origin

    rc, u, v = plane.ClosestParameter(origin)
    ext1 = Rhino.Geometry.Point2d(u,v)
    rc, u, v = plane.ClosestParameter(offset)
    ext2 = Rhino.Geometry.Point2d(u,v)
    rc, u, v = plane.ClosestParameter(pt)
    linePt = Rhino.Geometry.Point2d(u,v)

    dimension = Rhino.Geometry.LinearDimension(plane, ext1, ext2, linePt)
    if scriptcontext.doc.Objects.AddLinearDimension(dimension)!=System.Guid.Empty:
        scriptcontext.doc.Views.Redraw()
        return Rhino.Commands.Result.Success
    return Rhino.Commands.Result.Failure

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