怎么绘制管状正方形?
1、先来画一个正方形:
连结四条线段。
Graphics3D[
Line[{{1, 0, 0}, {0, 1, 0}, {-1, 0, 0}, {0, -1, 0}, {1, 0, 0}}]]

2、把线段变成管。
Graphics3D[
Tube[{{1, 0, 0}, {0, 1, 0}, {-1, 0, 0}, {0, -1, 0}, {1, 0, 0}}]]

3、或者,还可以写为:
Graphics3D[
Line[{{1, 0, 0}, {0, 1, 0}, {-1, 0, 0}, {0, -1, 0}, {1, 0, 0}}]] /. Line[pts_] -> Tube[pts]

4、限定管子的粗细程度:
Graphics3D[
Line[{{1, 0, 0}, {0, 1, 0}, {-1, 0, 0}, {0, -1, 0}, {1, 0, 0}}]] /. Line[pts_] -> Tube[pts,0.1]

5、还可以这样:
Graphics3D[
Tube[{{1, 0, 0}, {0, 1, 0}, {-1, 0, 0}, {0, -1, 0}, {1, 0, 0}},0.3]]

6、改变拐角处的接口样式:
Graphics3D[{JoinForm["Miter"],
Tube[{{1, 0, 0}, {0, 1, 0}, {-1, 0, 0}, {0, -1, 0}, {1, 0, 0}}, 0.1]}]

7、改变颜色,实现渐变色:
Graphics3D[{JoinForm["Miter"],
Tube[{{1, 0, 0}, {0, 1, 0}, {-1, 0, 0}, {0, -1, 0}, {1, 0, 0}}, 0.1,
VertexColors -> {Red, Green, Pink, Blue, Red}]}]
