I have some horizontal 2D polygons with different z (elevation), different shapes and different number of vertices. I’m going to construct a 3d object from this polygons (contours), such that each 2d polygon is the boundary of 3d object at that elevation. How can I do that?

Sounds like you don’t want to change the vertex coordinates of these polygons. In that case you have to apply translations to each polygon, which would look something like -

I think what they require is a way to build triangles that would form the “vertical sides” of the 3D shape. i.e. imagine the simple case of two 2D polygons (squares). These are stacked on top of each other each at a different height (Y), but I presume parallel to each other i.e. the Y coord is the same for each vertex in each polygon.

So need a method to generate the triangles that connect the bottom polygon to the polygon above. In this simple case, if the 2 polygons were the same orientation and size it would form a box.

I think that’s what they want…but I’ve no idea how to solve it