Today we made a lot of little pyramids and a box. Why? Can’t tell you that right now, it’s for a friend and we’ll follow up later on this year with a reason.
Settings: As usual, MakerWare .3mm/low on a Replicator 2. We printed the pyramids three at a time at 80% and the box at 81% to add a little clearance that was missing in our first trial run. You could probably print more pyramids at a time but our build plate is a little warpy so we are currently trying to keep our prints small and near the center of the plate.
Technical notes: The OpenSCAD code is really simple; the only part to think about is how to find the height of a square-based pyramid with sides all of equal length. Get out your trigonometry hat: Given that the sides of the square are 30mm (based on our coordinates for those vertices in the code below), the Pythagorean theorem tells us that the diagonal of the base is 30*sqrt(2). Then the height of the pyramid is one leg of a right triangle whose other leg is length 30*sqrt(2)/2 (halfway across the diagonal) and whose hypotenuse is 30 (one of the slanted sides of the pyramid), so another application of the Pythagorean theorem gives us a height of 30/sqrt(2). Or you could just memorize that the height of an equilateral square pyramid is the side length divided by sqrt(2).
// mathgrrl packing problem
// module for square pyramid
// from OpenSCAD manual example
points= [[15,15,0], [15,-15,0], [-15,-15,0], [-15,15,0],
[0,0,30/sqrt(2)] // top point
triangles=[ [0,1,4],[1,2,4],[2,3,4],[3,0,4], // each triangle side
[1,0,3],[2,1,3] ] // two triangles for square base
// module for the box