Creating a solid with pipes in a single direction

Currently I am trying to create a program that inputs a surface and forms pipes along the y axis throughout the surface without intersecting, but I am not sure how to go about preventing the circles from intersecting. (8.6 KB)

Pipes.3dm (359.3 KB) (12.5 KB)