How To Trim Cylinders To Top Surface?

Hey guys, does anyone have suggestion for trimming these cylinders to the top surface?

pipe to surface.gh (5.7 KB)

You’re Grasshopper file failed to upload. Click on the little pencil to edit your post and re-upload the file.

Whoops, fixed it. Thank you!

Have you tried the Split Brep command?
You would then need to check which of the resulting bodies is the one on top and work with the other one.

I tried that, however, there are some elements that aren’t covered by the roof so it doesn’t trim them and creates an error. If I use less cylinders, it works but it still leaves the cylinders extended above the surface.