Loop-while process

Hi everyone:

So basically I want to do a process step by step, I believe is some sort of loop, but not sure.
In this example I have 5 circles, they connect with a straight line, if I take a vertical line and get and angle, I’ll get a double, so I want to close this angle to be and integer number.

I can do that by using Math.Round and then some sums/subtraction, and the use basic formulas to get the extension for the line.

But I need to do a chain, first’s two circles and one group of lines, with the new lines I’ll get a new points and I’ll and then it will take the new points and do this process with the third circle/row, and keeps going until it finish.

I´ll attach the script.

Example Script.dyn (33.2 KB)