Hot to pipe in rectangular shape instead of circular?

Hello !
I am generating a script for the structure for an organically shaped roof element. I did the pipe of the curve but I want it in rectangular form instead of circular pipe sweeping through. below I have attached the GH file.
additionally it seems i did some mistake with th escript as the overall curves (piping ) dont join together nstead they are trimmed at the tip.
how do i make it clean and rectangular ?
rafters.gh (10.9 KB)

rafters.gh (14.5 KB)

It helps if you internalise data so we can use the same curves as you.