I'm interested in polygonal spirals and after reading Filling Space with Pursuit Polygons, I was curious if I could extend the program to create twisted pyramids as 3D-objects. My goal is something like this picture: 
although I would like to be able to vary parameters like shape of the chords from base to top (straight, concave or convex).
I already tried to draw objects like this in AutoCAD, but the process was rather tedious and I'm not yet knowledgeable enough in programming to do something like that from scratch. Here are some of my attempts:
I would also like to know if my red pyramid model would also be possible to be modelled with a script like that:
My approach to this model was different to the other two: instead of just connecting the corners with a point on the edge of the square the next level up to create the 4 lines winding up in a spiral and end up with a wire model, I tried to make a solid model by connecting the point of the next level up with all the adjacent corners below.

Thank you in advance!
Edit: I'm not asking you to write that code for me, I'm interested whether a script to create a polygon spiral can be used to create a 3D object with a simple extension to it.







MeshRegionorPolyhedron. – thorimur Apr 02 '21 at 23:47