A column that starts as circular and changes to rectangle.
<O T="Project" N="Rectangle to Circle">
<!-- A beam with cross-section starts as a circle and becomes a rectangle at the other end -->
<!-- Provide the length of the beam along with the dimensions at each end:
* radius of circle at one end and
* width and height of the rectangle at the other end -->
<!-- SegmentCount controls the discretization of the 3D view (MUST be multiple of 4) -->
<O T="Group">
<P T="Num" N="EndUserInputFields" V="1" />
<P T="Expr" N="BeamLength" V="100" />
<P T="Num" N="CircleRadius" V="10" />
<P T="Num" N="RectangleWidth" V="20" />
<P T="Num" N="RectangleHeight" V="20" />
<P T="Num" N="SegmentCount" V="256" />
</O>
<!-- we need a volume, we do not want the extrusion line, hence DrawBorder:0 -->
<O T="Volume">
<P T="Num" N="DrawBorder" V="0" />
<!-- first end of the volume is a circle, orient the circle so
that it aligns with the points of the rectangle specified next.
Also, make sure that the number of points for the both surfaces match.
We control the number of points for circles with Segments parameter. -->
<O T="Circle" RZ="0.785398163 + 1.57079633">
<P T="Expr" N="Radius" V="CircleRadius" />
<P T="Expr" N="Segments" V="SegmentCount" />
</O>
<!-- the other surface is rectangle. because we want to match the number of points
with circle, we will draw each edge of the rectangle separately.
We will use PointCountPerEdge many points to draw each edge of the rectangle. -->
<O T="Surface">
<P T="Expr" N="PointCountPerEdge" V="SegmentCount/4" />
<!-- defining the points for the edge
from (-RectangleHeight/2, -RectangleWidth/2) to (RectangleHeight/2, -RectangleWidth/2) -->
<O T="Repeat">
<P T="Num" N="S" V="0" />
<P T="Expr" N="E" V="PointCountPerEdge" />
<P T="Expr" N="I" V="1" />
<P T="Text" N="CTRL" V="pi" />
<P T="Num" N="pi" V="0" />
<O T="Point" X="(-RectangleHeight/2) + (RectangleHeight * pi / PointCountPerEdge)" Y="-RectangleWidth/2" Z="BeamLength" />
</O>
<!-- defining the points for the edge
from (RectangleHeight/2, -RectangleWidth/2) to (RectangleHeight/2, RectangleWidth/2) -->
<O T="Repeat">
<P T="Num" N="S" V="1" />
<P T="Expr" N="E" V="PointCountPerEdge" />
<P T="Expr" N="I" V="1" />
<P T="Text" N="CTRL" V="pi" />
<P T="Num" N="pi" V="0" />
<O T="Point" X="RectangleHeight/2" Y="(-RectangleWidth/2) + (RectangleWidth * pi / PointCountPerEdge)" Z="BeamLength" />
</O>
<!-- defining the points for the edge
from (RectangleHeight/2, RectangleWidth/2) to (-RectangleHeight/2, RectangleWidth/2) -->
<O T="Repeat">
<P T="Expr" N="S" V="PointCountPerEdge-1" />
<P T="Expr" N="E" V="0" />
<P T="Expr" N="I" V="-1" />
<P T="Text" N="CTRL" V="pi" />
<P T="Num" N="pi" V="0" />
<O T="Point" X="(-RectangleHeight/2) + (RectangleHeight * pi / PointCountPerEdge)" Y="RectangleWidth/2" Z="BeamLength" />
</O>
<!-- defining the points for the edge
from (-RectangleHeight/2, RectangleWidth/2) to (-RectangleHeight/2, -RectangleWidth/2) -->
<O T="Repeat">
<P T="Expr" N="S" V="PointCountPerEdge-1" />
<P T="Expr" N="E" V="0" />
<P T="Expr" N="I" V="-1" />
<P T="Text" N="CTRL" V="pi" />
<P T="Num" N="pi" V="0" />
<O T="Point" X="-RectangleHeight/2" Y="(-RectangleWidth/2) + (RectangleWidth * pi / PointCountPerEdge)" Z="BeamLength" />
</O>
</O>
</O>
</O>