I am trying to create multiple offsets by selecting two centre curves in c#
I am using the CreateFilletCurves method to create the fillet but I am facing a problem. I offset the centre curve and split successfully but when I try to fillet the split curves it works only in one direction.
double parameter1,parameter2;
//Split First Curve
c.ClosestPoint(events.First().PointA, out parameter1);
c.ClosestPoint(events3.First().PointA,out parameter2);
var paramsList = new List<Double>();
paramsList.Add(parameter1);
paramsList.Add(parameter2);
var splitCurves= c.Split(paramsList);
//Second Curve Split
c2.ClosestPoint(events.First().PointA, out parameter1);
c2.ClosestPoint(events2.First().PointA, out parameter2);
paramsList.Clear();
paramsList.Add(parameter1);
paramsList.Add(parameter2);
var splitCurves2 = c2.Split(paramsList);
//Third Curve Split
c3.ClosestPoint(events3.First().PointA, out parameter1);
c3.ClosestPoint(events4.First().PointA, out parameter2);
paramsList.Clear();
paramsList.Add(parameter1);
paramsList.Add(parameter2);
var splitCurves3 = c3.Split(paramsList);
var splits =splitCurves.ToList();
var splits2 = splitCurves2.ToList();
var splits3 = splitCurves3.ToList();
var filletcurves = Curve.CreateFilletCurves(splits.FirstOrDefault(), events3.First().PointA, splits3.FirstOrDefault(), events3.First().PointA, radius, false, true, true, doc.ModelAbsoluteTolerance, doc.ModelAngleToleranceDegrees);
var filletcurves1 = Curve.CreateFilletCurves(splits.LastOrDefault(), events.First().PointA, splits2.FirstOrDefault(), events.First().PointA, radius, false, true, true, doc.ModelAbsoluteTolerance, doc.ModelAngleToleranceDegrees);
doc.Objects.Add(filletcurves);
doc.Objects.Add(filletcurves1);
this is image with split,split1,split2,split 3 curve arrays for reference
I am hard coding this to understand where is the exact error. Only one of the filletcurves is appearing but missing the second offset curve.
I am splitting the offset curves using intersection points and I get three curves(from a single curve). I remove the index 1 element and i am using the fillet method. Using the curve intersection points as curve endpoints in the filletcurves method.
The offset work when i try another curve in the code.
changed this part of the code to use the first curve from “splits” list
var filletcurves1 = Curve.CreateFilletCurves(splits.FirstOrDefault(), events.First().PointA, splits2.FirstOrDefault(), events.First().PointA, radius, false, true, true, doc.ModelAbsoluteTolerance, doc.ModelAngleToleranceDegrees);
My guess was it is due to the curve direction but when you use the fillet in rhino, you can select any part of the curve to fillet this type of scenario.
Is there any other way I could make this offset work successfully in my code?