Hi All, Rhino 6 release 14 common . In some closed planar curves the method FrameAt passing the start point parameter gives a plane that is perpendicular to the plane of the curve. Why? See the attachment

Hi Dale, thank you. I use c# and rhino common. my piece of code takes the 2 curve from the 2 ids with a get point, from objref or from rhobj. then I take the Plane with “curve. FrameAt(t, out Plane)”. now I am not in my office, tomorrow I will send the exact code.

I did the plane for the 2 curves that i sent to you the first time and it worked also form me(i did not understand why???) so i did a copy of the 2 curves and i tried again to see if i was crazy and you can see the result in the following shot: i did it with the following command

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
var gx = new Rhino.Input.Custom.GetObject();
gx.SetCommandPrompt("Select curves");
gx.GeometryFilter = Rhino.DocObjects.ObjectType.Curve;
gx.GetMultiple(1, 0);
if (gx.CommandResult() != Rhino.Commands.Result.Success)
{
return Result.Failure;
}
var objrefs = gx.Objects();
for (int i = 0; i < objrefs.Length; i++)
{
var objref = objrefs[i];
var curva = objref.Curve();
if (curva == null)
{
continue;
}
Rhino.Geometry.Plane piano;
double t;
curva.ClosestPoint(curva.PointAtStart, out t);
//t=curva.Domain.Min as you want, i tried both
if(!curva.FrameAt(t, out piano))
{
continue;
}
var dom =new Rhino.Geometry.Interval(0.0, 1.0);
var srf = new Rhino.Geometry.PlaneSurface(piano, dom, dom);
Rhino.RhinoDoc.ActiveDoc.Objects.AddSurface(srf);
Rhino.RhinoDoc.ActiveDoc.Views.Redraw();
}
return Result.Success;
}

I repeated the command with 60 sections more or less and i am not able to understand the bug(because i can only think it is a bug). the planes depends on where the sections are. if a translate the same sections and i repeat the creations of the planes at the starting point sometimes they are wrong, some others they are ok but in a random way.

Curve.FrameAt returns a plane based on the curve’s tangent and curvature vectors at a given parameter. If the curvature is really small at a given parameter, then you can end up with a vector that is basically noise. In this case, best to use Curve.TryGetPlane, if the curve is planar. If the curve is not planar, then use Curve.PerpendicularFrameAt and orient the output plane to your liking.