Split curves

I have crazy problem spliting lines or curves. I need to split multiple lines and curves at their intersection points. I need a solution which works for variety of angles between the lines. I need to keep all the lines in their respective branches also. Nothing I have read or tried has achieved this result so far. The only thing which works is creating a surface and them spliting it and extracting the lines this way. However this takes so much computational time that for very large files it takes up to 10 min. Same data could be split in Rhino in seconds.

Split Curves.gh (40.9 KB)

This does the trick, but I can’t seem to sort my curves back into their coresponding branches or better still… keep the tree structure as it is.

Split Curves_v2.gh (46.4 KB)

Like this?

Split Curves_v2_re.gh (52.8 KB)

2 Likes

Damn… yes! Ok, I have no idea how to sort the data like this. Very nice trick. I need to study this method very well. HS_Kim for the win!

Then why there is a problem here?
Maybe the best option is to somehow make this without flattening the tree. But I have zero idea how to do that…

ShatterMultiple_re.gh (14.9 KB)

Actually, I found a fix. I just need to move the initial geometry on a given vector, pass it trough the solution and then move it in back in th eopposite direction and all works like charm. Thank you again!

Can you explain why grouping the result does the trick when we unflatten the tree? I can’t understand the logic behind it.

When if you are to use Unflatten Tree, The item counts between Input “T” and guide input “G” should be identical…
That’s why the Groupappeared on the scene in this case…

1 Like