Does this help?
Think of the tube as a set of edges. The cross section at each vertex is created on the mitre angle between the two edges.
For example, if you want a 45 degree end on the tube, you would create a 90 degree angle between the last two edges.
tube 4,4,51, !m, n, mask
0,0,0, !profile points (all sharp edges) …
w,0,0,
w,h,0,
0,h,0, !end of profile points
-1,0,0,0, !path points (a ‘lead in’ edge starts at - 1,0,0; angles all zero) …
0,0,0,0,
a,0,0,0,
a,1,0,0 !end of path points (the ‘tail out’ edge ends at a,1,0 - that is at 90 degrees to the previous edge, so forms a 45 degree angle)