Get corners Geometry Curve


#1

I´m programming a project with C# and rhinho.

I´ve a Curve in my Code and I want to find the points of the corners in this Curve.

For exmple, This figure has six points

but I dont´t know how to get these points.


(Menno Deij - van Rijswijk) #2

You can use Curve.GetNextDiscontinuity (see http://4.rhino3d.com/5/rhinocommon/html/M_Rhino_Geometry_Curve_GetNextDiscontinuity.htm)
with ContinuityType.G1_continuous or ContinuityType.G1_locus_continuous


(Dale Fugier) #3

You might also try this:

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
  Rhino.DocObjects.ObjRef obj_ref;
  const string prompt = "Select curve";
  const Rhino.DocObjects.ObjectType object_type = Rhino.DocObjects.ObjectType.Curve;
  Result res = Rhino.Input.RhinoGet.GetOneObject(prompt, false, object_type, out obj_ref);
  if (res != Result.Success) 
    return res;

  Rhino.Geometry.Curve curve = obj_ref.Curve();
  if (null == curve)
    return Result.Failure;

  Rhino.Geometry.Polyline pline = null;
  if (curve.TryGetPolyline(out pline))
  {
    foreach (Rhino.Geometry.Point3d point in pline)
      RhinoApp.WriteLine(point.ToString());
  }

  return Result.Success;
}

#4

Thanks,

I´ve checked both solutions are perfect