Projecting to the first intersecting surface

Hi, I was wondering if there was a way to limit projecting to the first intersecting surface. Let’s say I want to project a curve onto a cube, how would I ensure to limit the projection onto the first surface value instead of having to input the same onto Grasshopper?

This question belongs here: