Pyramids with a flat top?

Hello!
I’m brand new to Dynamo and I’m trying to build rows and columns of pyramids that rest on a surface. Ideally, they would point outward with the surface normal.
I’ve searched for scripts and tutorials on pyramids, but none of them have a flat top.
Any suggestions on how to build this?

Many thanks from a new person!

Create two rectangles (upper & lower profile) and loft them into a solid.