3D Genius

By October 11, 2013 1 Comments

Building the impossible pyramid

impossiblepyramid01

 

Download this thingWe’ve all seen – and no doubt been impressed by – the drawings of an Impossible Cube, one of those optical illusions that continues to delight both adults and children. A few craftsmen have gone on to build such an object out of wood and, when photographed from the correct angle, it looks like a real manifestation of the impossible object.

Such an object would be hard to make on a 3D printer, since all those horizontal bars would require support which would then need to be painstakingly removed afterwards. But what we can make is an Impossible Pyramid, whose 60 degree angles can be printed perfectly.

I designed this pyramid using the free, open source software OpenSCAD, a 3D model-building app that works with numerical input rather than by dragging visual objects. I’ve covered the basics of working with OpenSCAD here, with further tutorials here and here; check these out, if you haven’t done so, to see just how easy it can be to create mathematically accurate designs that require only a basic knowledge of trigonometry.

 

1. Draw two spheres

If the sides of the triangle were made of rectangular bars, the corner joints would require complex calculation to get the angles right. It’s much easier to make a circular cross section, with spheres at the corner. We can begin by drawing those two spheres. The command sphere (5); draws a sphere of radius 5mm right at the origin; we can then use the translate command to move the starting point 100 mm along the X axis, to draw the second sphere.

The text at the side of the window shows how this works. As always in OpenSCAD, type the key F5 to draw the current state of the document. Until you do so, all you’ll see is the text:

pyramid01

 

2. Join the spheres

The next step is to join those two spheres together.We can do this using the hull command, which simply links the two objects into a single rod. As with all OpenSCAD commands, you need to place curly brackets { and } around the objects that are being affected; so here, the penultimate bracket terminates the translate command, and the last one terminates the hull command:

pyramid02

 

3. Make it a module

We could just repeat that instruction to build the rod every time we want to another one. But it’s much easier to define it as a new module, which we can call rod. We can do this by putting the words module rod () before the instructions, again with curly brackets around the instructions themselves.

Now, every time we want to draw a rod, we just need to use the command rod(); and it will appear automatically:

pyramid03

 

4. Add another side

We can add a second side by rotating the rod 60° about the z axis. All we need to do is use the command rotate ([0,0,60]) and then the rod(); command – remembering to put it in curly brackets, of course – and our second side appears:

pyramid04

 

5. The third side

The third side of the base triangle needs to have its origin moved, as well as being rotated. We can use the translate command to move it 100mm along the x axis, and then rotate it 120° and use the rod(); command again:

pyramid05

 

6. The top point of the pyramid

The next step requires a little knowledge of geometry. Remember all that stuff about sins, cosines and tangents you learned at school and never thought you’d need? Well, it finally comes in useful. It turns out we need to position the top of the pyramid exactly 50 mm along the x axis, 50 times sin 30° mm along the y axis, and 80 mm up the z axis – and if you want to work out the mathematics for yourself, be my guest.

Here’s how it looks:

pyramid06

 

7. The first sloping side

Now that we’ve got that top ball positioned, we can simply place another one at one of the corners and use the hull command once more to join the two together:

pyramid07

 

8. The other two sides

The two remaining sides of the pyramid can be created in the same way, first moving the bottom sphere to its new location (and we’ve already worked that out when creating the base), and then using the hull command to join it to a new top sphere:

pyramid08

 

9. Making the cutout

In order for the Impossible Pyramid to look truly impossible, we have to make a break part way along one of the rods. Now we can’t make it along one of the upper rods, or it would simply be unprintable; so we have to make the break in the base, and then turn the whole assembly around to view it afterwards.

To see where to make the break, we can start by spinning our view of the pyramid around in OpenSCAD so we’re viewing it from beneath:

pyramid09

 

10. The central cutout

The easiest place to put the cutout is in the middle. To subtract one object from another, use the difference command. This will build the first object encountered within the curly brackets, and delete all the objects found afterwards. We’ll start by making a cutout cube that’s 10 mm wide in the x dimension (the same width as the rods), but wider in the y and z dimensions so we can be sure it will remove all the rod:

pyramid10

11. Reduce the cutout

Although the 10 mm width of the cutout cube exactly matches the 10 mm width of the rods, we have to take perspective into consideration. The gap appears too big because it’s closer to us than the far rod. Reducing the width of the cube to 9 mm seems to solve the problem:

pyramid11

 

12. Slide the gap along

With the gap right in the middle, the photograph of the final object is always going to look a little unnatural. It will look better if the gap is slightly off to one side.

Unfortunately this involves changing not just the position but the angle of the gap as well, which means rotating that invisible cube. It might be possible to calculate this, but it would take a finer mathematical mind than mine. Trial and error, though, produced rotation angles of 5° on the y axis and 10° on the z axis, which produced this result:

pyramid12

 

13. Print it out!

The final step is to use the Compile and Render menu option in OpenSCAD to build the finished object, and then save it as an STL file. This can then be taken into your preferred slicing engine, saved as a GCode file, and then printed.

And here’s the result:

impossiblepyramid02

Of course, the illusion only works when viewed form exactly the right angle, and I’ve turned the pyramid on its side so that the gap (which was at the bottom while printing) is now at the side.

You can download the OpenSCAD file from which this was constructed here – or, if you only want to print one for yourself, you can download the finished STL file here.

Share it!
Posted in: Design, Technique

1 Comment on "Building the impossible pyramid"

Trackback | Comments RSS Feed

Inbound Links

  1. The Impossible Pyramid - Sense 3D Printer | March 19, 2014

Post a Comment