Curve.SplitByPoints fails super often in super simple examples?

Hi folks,
I wanted to test Dynamo’s ability to split Polycurves at multiple points, before using this functionality in a more complex script. So I broke up 4 planar (!) curves which intersect each other into several pieces each, made Polycurves out of them, and then tried to split these Polycurves at their intersection points (each Polycurve has two of those, these points are different to those which were used to split the original curves).
This fails in 3 out of 4 cases? Any idea why, and/ how to get around this?

Curve-Split-Test-0.3.dyn (38.3 KB)

”Funny” enough all the splits work, when I split the Polycurve on only one of those points.
Any help would be appreciated.
Thanks,
GG

I believe the issue is with how Dynamo is handling the PolyCurve behind the scenes. Curves will split in any “direction”, but PolyCurves have to split in order. This makes me think the SplitByPoints node is converting to Curves in the background for the split and then having issues maintaining order or relationship once it’s converted back.

The workaround is simple though. You just need to provide the points in order (start to end) along the PolyCurve. This ensures that after each split, the remaining PolyCurve is still valid for the next point. Convert the point to a parameter location (ParameterAtPoint) and then sort the points (SortByKey).

@solamour @achintya_bhat
Am I close here? Is this something that can be improved/fixed?

3 Likes

@Aparajit_Pratap would you please be able to provide some insight here?

I typically only use Curve.SplityByParameter, partially as that allows sorting the parameters input. Sorting the points by List.SortByKey or List.SortByFunction also works. I recall having to write this as a Python and then C# function once for a generative design effort…

4 Likes

Yeah, that’s a simpler fix.

1 Like

Yes, that’s working, thanks, @jacob.small and @Nick_Boyts ! :slight_smile: