Search code examples
openscad

polyhedron in openSCAD yields "No top level geometry to render"


I do not get why this polyhedron gives me a "no top level geometry to render" error. All triangles are correctly oriented, "thrown-together"-view shows only yellow outside faces. This is my code:

top_width=39;
bottom_width=51;
col_offset=6;
length=160;
height=40;
rows=10;
cols=40;
top_row_width=top_width/rows;
bottom_row_width=bottom_width/rows;
col_length=length/cols;
walls=0.4;

box();

module box(){
    polyhedron(
        points=[
            [ // point 0
                0,
                0,
                height
            ],[ // point 1
                length,
                0,
                height
            ],[ // point
                length,
                top_width,
                height
            ],[ // point 3
                0,
                top_width,
                height
            ],[ // point 4
                0,  
                0+col_offset,
                0
            ],[ // point 5
                length,
                0+col_offset,
                0
            ],[ // point 6
                length,
                bottom_width+col_offset,
                0
            ],[ // 7
                0,
                bottom_width+col_offset,
                0
            ]
        ],
        triangles=[
            [3,1,0],
            [3,2,1],
            [4,5,6],
            [4,6,7],
            [7,2,3],
            [6,2,7],
            [4,3,0],
            [4,7,3],
            [1,2,5],
            [1,2,5],
            [2,6,5],
            [0,1,5],
            [0,5,4]
        ]       
    );
}

Any hint is very appreciated, thanks in advance!


Solution

  • Well I'm baffled too. Latest version of OpenSCAD supports faces in place of triangles:

    faces = [ [0,3,2,1], [0,1,5,4], [1,2,6,5], [2,3,7,6], [0,4,7,3], [4,5,6,7] ]

    and that renders OK.

    You might try asking on the OpenSCAD forum http://forum.openscad.org/ which is more active than here.