Is there a way to make the pipes rectangular on Rhino?

Mesh pipe from Grasshopper Mesh tools lets you rotate the 4-sided mesh pipe…

Well, the problem is that 3D curves can be oriented and twist any direction. So it’s difficult to determine which direction the rectangular profile will orient itself to the rail curve at the curve start/end.