# 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 `Group`appeared on the scene in this caseâ€¦

1 Like