solved
private void RunScript(Curve icurves, double deRadius, ref object A, ref object B, ref object C, ref object D, ref object E, ref object F, ref object AA, ref object AB, ref object AC)
{
//fetch discontinuity of curve
double t0 = 0.0;
double t1 = 1.0;
double tout;
icurves.GetNextDiscontinuity(Continuity.G2_continuous, t0, t1, out tout);
Curve[] splitcrv = null;
splitcrv = icurves.Split(tout);
A = splitcrv[0];
B = splitcrv[0].PointAtStart;
C = splitcrv[0].PointAtEnd;
D = splitcrv[1];
E = splitcrv[1].PointAtStart;
F = splitcrv[1].PointAtEnd;
double rad = RhinoMath.Epsilon;
double radStep = 0.05;
double tol = radStep / 50;
bool search = true;
//int Count = 1;
while(search)
{
//update radius and draw new filletcrv
var filletcrv = Curve.CreateFillet(splitcrv[0], splitcrv[1], rad, t1, t0);
var midpoint = filletcrv.MidPoint;
var currLength = midpoint.DistanceTo(splitcrv[0].PointAtEnd);
//Print("Radius step too large x{0} {1}", Count, rad);
//Count = Count + 1;
if((deRadius - currLength) < tol && (deRadius - currLength > RhinoMath.Epsilon))
{
AA = filletcrv;
AB = filletcrv.MidPoint;
Print((deRadius - currLength).ToString());
Print(tol.ToString());
Curve filletcrvNURBS = filletcrv.ToNurbsCurve();
Curve[] outCrv = {splitcrv[0], filletcrvNURBS, splitcrv[1]};
//AC = Curve.JoinCurves(outCrv, 0.0);
AC = outCrv;
search = false;
}
if((deRadius - currLength < RhinoMath.Epsilon))
{
//radius step is too large and causes a miss
//reset radius and half the step size
rad = RhinoMath.Epsilon;
radStep /= 2;
//Count = 1;
}
rad += radStep;
}
}