as far as i read in other topics:
grasshopper explode gives back sub-objects / segments of a Polycurve
rhino explode splits at Discontinuity
It also seams a difference wether you handle Segments vs. SubObjects.
as the given Curve is a single Nurbs Curve… (has no Sub-Objects / Segments…)
so my solution is using Discontinuity:
explode_Curve_00.gh (8.7 KB)
with this script:
List<double> ts = new List<double>();
double t0 = crv.Domain.T0;
double t1 = crv.Domain.T1;
// handle closed curves
// not sure if this is the best / correct way...
if (crv.IsClosed)
{
ts.Add(t0);
}
// collect all Discontinuities
// also see
// https://discourse.mcneel.com/t/rhinocommon-equivalent-of-explode/21093/8
double tLast = t0;
double ti = t0;
while (crv.GetNextDiscontinuity(Continuity.Gsmooth_continuous, tLast, t1, out ti)) {
ts.Add(ti);
tLast = ti;
}
Curve[] crvs = crv.Split(ts);
if ((crvs != null) && (crvs.Length > 1))
{
A = crvs;
} else
{
Print("split failed");
A = crv;
}
It seams that it also makes a difference wether
hope this helps - kind regards -tom