Click or drag to resize

RadialDimension Constructor (Point3d, Point3d, Vector3d, Vector3d, Double)

Construct a radial dimension from 3d input

Namespace:  Rhino.Geometry
Assembly:  RhinoCommon (in RhinoCommon.dll)
public RadialDimension(
	Point3d center,
	Point3d arrowTip,
	Vector3d xAxis,
	Vector3d normal,
	double offsetDistance


Type: Rhino.GeometryPoint3d
center of Circle
Type: Rhino.GeometryPoint3d
3d point on the circle at the dimension arrow tip
Type: Rhino.GeometryVector3d
x axis of the dimension's plane
Type: Rhino.GeometryVector3d
normal to the dimension's plane
Type: SystemDouble
distance from arrow tip to knee point
using Rhino;
using Rhino.DocObjects;
using Rhino.Commands;
using Rhino.Geometry;
using Rhino.Input;

namespace examples_cs
  public class AddRadialDimensionCommand : Rhino.Commands.Command
    public override string EnglishName
      get { return "csAddRadialDimension"; }

    protected override Result RunCommand(RhinoDoc doc, RunMode mode)
      ObjRef obj_ref;
      var rc = RhinoGet.GetOneObject("Select curve for radius dimension", 
        true, ObjectType.Curve, out obj_ref);
      if (rc != Result.Success)
        return rc;
      double curve_parameter;
      var curve = obj_ref.CurveParameter(out curve_parameter);
      if (curve == null)
        return Result.Failure;

      if (curve.IsLinear() || curve.IsPolyline())
        RhinoApp.WriteLine("Curve must be non-linear.");
        return Result.Nothing;

      // in this example just deal with planar curves
      if (!curve.IsPlanar())
        RhinoApp.WriteLine("Curve must be planar.");
        return Result.Nothing;

      var point_on_curve = curve.PointAt(curve_parameter);
      var curvature_vector = curve.CurvatureAt(curve_parameter);
      var len = curvature_vector.Length;
      if (len < RhinoMath.SqrtEpsilon)
        RhinoApp.WriteLine("Curve is almost linear and therefore has no curvature.");
        return Result.Nothing;

      var center = point_on_curve + (curvature_vector/(len*len));
      Plane plane;
      curve.TryGetPlane(out plane);
      var radial_dimension = 
        new RadialDimension(center, point_on_curve, plane.XAxis, plane.Normal, 5.0);
      return Result.Success;
from Rhino import *
from Rhino.DocObjects import *
from Rhino.Commands import *
from Rhino.Geometry import *
from Rhino.Input import *
from scriptcontext import doc

def RunCommand():
  rc, obj_ref = RhinoGet.GetOneObject("Select curve for radius dimension", 
    True, ObjectType.Curve)
  if rc != Result.Success:
    return rc
  curve, curve_parameter = obj_ref.CurveParameter()
  if curve == None:
    return Result.Failure

  if curve.IsLinear() or curve.IsPolyline():
    print "Curve must be non-linear."
    return Result.Nothing

  # in this example just deal with planar curves
  if not curve.IsPlanar():
    print "Curve must be planar."
    return Result.Nothing

  point_on_curve = curve.PointAt(curve_parameter)
  curvature_vector = curve.CurvatureAt(curve_parameter)
  len = curvature_vector.Length
  if len < RhinoMath.SqrtEpsilon:
    print "Curve is almost linear and therefore has no curvature."
    return Result.Nothing

  center = point_on_curve + (curvature_vector/(len*len))
  _, plane = curve.TryGetPlane()
  radial_dimension = \
    RadialDimension(center, point_on_curve, plane.XAxis, plane.Normal, 5.0)
  return Result.Success

if __name__=="__main__":
Version Information

Rhino for Mac

Supported in: 5.4
See Also