Tuesday, June 18, 2019

Blendering a remixed Treasure Puzzle Box

A friend wanted a puzzle box that could hold one thousand crisp US dollar bills.

The first step was to figure out how much space would be necessary, which gets messy with imperial measurements. 1000 bills stacked on each other - 4.3"? What is that on a ruler? I added 5%, as a safety. (4.5 inches became 115mm.) 2.61" by 6.14" were converted to mm, then rounded to 70mm by 160 mm. Then I created a "cash-block" in a Blender file, designed as a testing metric. Similar to software engineering, if you come up with your tests beforehand, you can test to the challenge. (Otherwise, it is similar to writing a question to an answer you have written down already.)

The next step was finding an initial puzzle box. I chose this steampunk version from Thingiverse, and imported the stl files into the Blender file. Obviously, it's not big enough internally to hold the money. Using the MeasureIt plugin, I mapped out the existing internal measurements, in order to do casual scaling of the object on the appropriate x/y/z axis (130% x 120% x 244%). It wasn't necessary for the box, but I wanted to keep the same scale for the other parts.

With that said, there are issues. The steampunk gears decorations on the side stretched more on the z-axis, as did the compass rose. No good — so I switched to wireframe mode, the edit...selecting all of the gear & compass vertices on the outside of the box, and deleted them. Then I rebuilt the faces. A simple box. But...no decorations. To deal with that, I imported another copy of the base box stl into the project.

You'll notice a vertical measurement of 134.99mm. I added more overall space for the lock mechanism, as well as a plate for the locks to rest on — don't want to damage the dollar bills when the locks turn.
With the "old" version of box, I went into wireframe (z), and edit mode. Once again, selecting all of the vertices of a single gear. It'll pick up any of the faces as well, which is inconvenient for the spaces between the gear teeth. Oh well. With the vertices selected, "p" lets you separate by selection. Switch to object mode, select your new gear object, go back into edit mode. Using face select, I chose all of the ugly, not-needed faces between the gear teeth, and "x" to delete those faces.

The import process isn't always clean. Most of the time, you can ignore the cleanup. It will sometimes cause issues with edge select, selected an edge while holding down shift-alt (OSX). If you do have awkward faces/edges, you merge vertices to a "corner of a plane" vertex, using alt-m and then merging to the last one selected.

If you look at the two horizontal lines, there should just be one face (or two faces, if you have a diagonal line, like the faces above the selection. It probably wasn't designed this way...just a function of importing an stl file.
Getting back to the gear as a whole, let's assume the edge select with shift-alt selected the back edge of the gear. I (e)xtruded those edges by 2 to thicken it, then use "f" to fill in a face for those edges. As a best practice, try to merge only solid piece to another solid piece. (Either by using control-j to join, or boolean>union — I prefer Boolean>Union.)

As I finished each gear, I dropped them into a new collection just for gears (a feature of Blender 2.8).

The compass rose turned out to be...problematic. I wonder how much of it was from the STL, vs. how I took it apart in Blender.



You can see how the faces behind the star work, instead of the separate faces connecting between the spokes. When I saw all of those weird lines, I knew from experience that those faces would need to be cleaned up.

I deleted all of the bad faces, rebuilt them by hand. For each of the 8 face areas between the compass rose spikes, grabbing the vertices in edit mode with the (c)ircular select tool, then making a (f)ace.

There were also some non-manifold faces/edges on the back of the 4 tips, as well as edges/faces BEYOND the other faces already cleaned up. Those non-manifold pieces were just deleted. (Sample selections as viewed from the back of the compass rose.)

You can see the top tip highlighted - it had multiple edges that needed to be cleaned up as well, where it touched the back ring. I would guess this was a function of the software made the original remix.

After those were done, from the back side, I selected the outside edge and the tip edges, and made that a (f)ace. (Everything was now manifold - no air gaps.) I made the whole thing thicker, and recessed the separate faces between the compass spokes. I was a bit concerned that the detail might get lost, with a larger puzzle box...and it make it easier to Boolean>Union with the box.




I made the compass rose and gears 160% bigger on the x-axis and z-axis to match the box's ends, and 120% thicker on the y-axis to make it similar in look. They were put into their own collection.

The final box — the hinges stick straight out, but the rest of the box is accurate.