How to square the pipe

hi all

i have prepared lines (red ones on the left) for making a structure shown in light blue on the right (that one is done in rhino only).

The structure in the middle is done by lunchbox 2D Truss component, where lines are just manually multiplied.
lunchbox (4.8 KB)

i know that making such a thing is easier if i want to have pipes. But i would appreciate if anybody shares how to make that in grasshopper what i’ve shown done in rhino (polysurfaces shown in light blue)

thanks in advance

Try this
square (13.3 KB)