Example shows how to create a parametric Octahedron shape.
//Code for octahedron using circles of very small diameters (in liue of points) as top/bottom points:

function build() {

    //create octahedron solid with specified sideLength

    //get variables from parameters

	params.sideLength = 20; //Or define sideLength from the Parameter's dialog
    var sideLength = params.sideLength;
    var squareWire = square(sideLength);
    //height of single pyramid in octahedron
    var singleHeight = Math.sqrt(Math.pow(sideLength,2)/2);
    var bottomCircle = cadlib.circle({x:0, y:-singleHeight, z:0},{x:0,y:1,z:0},0.001);
    var topCircle = cadlib.circle({x:0, y:singleHeight, z:0},{x:0,y:1,z:0},0.001);

    //Create a loft
    var s = cadlib.loft([cadlib.wire(bottomCircle),squareWire,cadlib.wire(topCircle)]);

    return s;
function square(sideLength){
    //create square wire centered on origin
    //Using Path object
    var path = new cadlib.Path(true);
    var halfLength = sideLength/2;

    path.start(halfLength, 0, halfLength).zlineTo(-sideLength).xlineTo(-sideLength).zlineTo(sideLength);
    //Important to close the path
    return path.wire();