How to "Flatten" a line along a solid

I have a cyan curve line (flat from side view, curve from top view) along a solid of irregular shape.

I need to somehow flatten the line so it follows the surface of the solid as shown in pink line.

Please help!