[merge.rar][1] has many curves ,and I want merge these curves to one curve.
using rhinomergecurves function.
the biggest gap between curves is less tham 30.but I set the tol to 50,the result curves are also not just one ,but two .
I have to using rhinomergecurves function again to merge the two result curves to one .
why I can’t merge the curves to one curve just one time.
My “solution” in this case is to increase the tolerance a few times until the curves are joined:
double originalTolerance = 1e-12;
double tol = originalTolerance;
Curve[] curvesToJoin; // this is the collection of curves to join;
Curve[] joined = curvesToJoin;
int n = 0;
while(joined.Length > 1 && n < 6)
{
joined = Curve.JoinCurves(curves, tol);
tol = originalTolerance*Math.Pow(10, n++);
}
if (joined.Length > 1) // uh-oh, the curves are still not joined.
Ok, I know this is C#-like pseudocode, but I hope you understand what I mean. Basically, you increase the tolerance with a factor of 10 in each iteration of the while loop until either the curves are joined or the tolerance has become too large.
thanks for you help ,my codes are just like your.
and these can solve the problem.
but i think maybe this is a bug of rhinomergecurves.
and i want to know why this happens?
Clearly, you cannot join all of the curve segments together because not all of the curve segments match end point to end point. The curve segments that do match end-to-end join using the Join command. They also join using the RhinoMergeCurves() SDK function. When using RhinoMergeCurves(), use a joining tolerance of 2.1 * the document’s absolute tolerance.