Build a Curve on a model through two Point3D

Is there any built-in function for building a curve connecting two points (Point3D) on the same Brep ?(guarantee that these the BrepFace connecting these two points exist)

Connecting these two blue points through the yellow line.

You can create a line curve between the two points and project it to the brep.

1 Like

Thanks, I will give the code to anyone interested, I also added trimming to only get the curve limited by my two points.

Vector3d v = new Vector3d(upperPoint.X - lowerPoint.X,
                        upperPoint.Y - lowerPoint.Y,
                        0);
LineCurve freeSpaceCurve = new LineCurve(upperPoint, lowerPoint);
Curve[] builtCrvs = Curve.ProjectToBrep(freeSpaceCurve, brep, v, doc.ModelAbsoluteTolerance);

if (builtCrvs.Length>0)
{
    // Get and trim curve
    Curve crv = builtCrvs[0];

    crv.ClosestPoint(upperPoint, out double crvStartParam);
    crv.ClosestPoint(lowerPoint, out double crvEndParam);
    if (crvEndParam < crvStartParam)
    {
        double temp = crvStartParam;
        crvStartParam = crvEndParam;
        crvEndParam = temp;
    }

    Interval trimInterval = new Interval(crvStartParam, crvEndParam);
    crv = crv.Trim(trimInterval);
}