@kirby,
I'll take a look at links in a bit.
@bigal
Imagine a serpentine pattern but toss in a rectangle (representing a floor drain, maintence pit, elevator, etc) in the middle of your layout so you need to either go around or on both sides while trying to maintain a total length of about 500 feet (you cannot go over 500 feet because that is what a spool of pipe is and you don't want to go too far under either. 500 feet of pipe is one loop.). ...This problem requires several different iterations to get the proper coverage and actual number of loops.
In my spreadsheet screenshot, I used 300 feet per loop because my loop counters are automated and I needed to look at my flows and pressure drops for the number of loops I wanted against pump selections (I was sort of working backwards from a total flow against a pump selection)
I have concept code that will generate a horizontal serpentine pattern in a rectangle already (drawing/calculating a back and forth pattern is easy). The hard part will be addressing the NO-FLY zones and whatnot. Layouts are fun for one or two loops but when you have 16 it's not fun anymore (it typically takes me about 3 days to layout and draft 16 loops and 4 zones. When the architect starts changing on you, is typically when your boss will ask a question like "why are you so far behind?!").