Okay, this is a better version. With the green lines, I tried to implement how curves might work. But working that out in detail would need a lot of experimenting, and since I have right now no need for a pipe, I leave that to you, Manikus.

I am quite sure that it can be done.