Divide line at points

Hello,
I have a line (curve) that intersects a surface (brep). I determined the intersection points. But I now want to split the line at the point of intersection and no longer use the line outside the area. I tried it in the GH file, but unfortunately it doesn’t work the way I want. What’s wrong with this?
Thank you for your help.
Frank
Dachtragwerk.gh (57.9 KB)


Dachtragwerk.gh (56.3 KB)

If your brep was close, you could use “Trim with Brep” component…