DEV Community

Cover image for Modelling a mimic chest dice box in Python: interlocking fangs and a filament hinge
Black
Black

Posted on

Modelling a mimic chest dice box in Python: interlocking fangs and a filament hinge

Mimic chest dice box render

Every tabletop group needs a mimic. I wanted a dice box that is one: a planked treasure chest where the gap between lid and base is a mouth full of fangs that actually close past each other, with a real hinge, eyes and a tongue inside. It prints as two parts, and the hinge pin is a scrap of 1.75 mm filament.

Here is how the geometry works, in Python with manifold3d.

1. Leave a gap for the mouth

The base walls stop at height H. The lid's rim starts at H + TZ. That 6 mm band between them is the "tooth zone": the base's fangs point up into it, the lid's fangs point down into it, and nothing else lives there.

W, D, H, T = 72.0, 52.0, 34.0, 3.0   # base size and wall
TZ = 6.0                              # tooth zone
PITCH = 6.0                           # tooth spacing
Enter fullscreen mode Exit fullscreen mode

2. A fang is a hull of two shapes

A flat bar at the root and a small ball at the tip, hulled together, gives a rounded fang that prints without supports. Flip it with a mirror for the top jaw:

def tooth(up, w=PITCH-0.7, h=TZ-0.2, t=2.2):
    base = Mf.cube([w, t, 0.4]).translate([-w/2, -t/2, 0])
    tip = Mf.sphere(0.7, 12).translate([0, 0, h-0.7])
    f = Mf.batch_hull([base, tip])
    return f if up else f.mirror([0, 0, 1])
Enter fullscreen mode Exit fullscreen mode

3. Interlocking is just a half-pitch offset

For the jaws to close, the top teeth must fall into the gaps of the bottom teeth. Each tooth is PITCH - 0.7 wide, so shifting the top row by PITCH/2 leaves 0.35 mm of air on each side of every fang:

def teeth(up, z):
    out = []; off = 0 if up else PITCH/2
    for x in np.arange(-W/2 + 5 + off, W/2 - 4, PITCH):          # front
        out.append(tooth(up).translate([x, -D/2 + T/2, z]))
    for y in np.arange(-D/2 + 5 + off, D/2 - 9, PITCH):          # sides
        for s in (-1, 1):
            out.append(tooth(up).rotate([0, 0, 90]).translate([s*(W/2 - T/2), y, z]))
    return Mf.batch_boolean(out, M3.OpType.Add)
Enter fullscreen mode Exit fullscreen mode

The rows stop short of the back wall, because that is where the hinge goes. batch_boolean unions all 30-odd teeth in one call, which is much faster than adding them one at a time.

4. A print-in-place-style hinge, printed apart

The hinge axis runs along the back edge, at the middle of the tooth zone. The lid gets three knuckles (both ends and the middle), the base gets the two in between. Each part also cuts a slightly bigger cylinder where the other part's knuckles go, so there is 0.5 mm of clearance:

segs = [(-W/2, -W/2+11), (-6, 6), (W/2-11, W/2)] if lid else \
       [(-W/2+11.4, -6.4), (6.4, W/2-11.4)]
knuckles = [Mf.cylinder(b-a, KN, KN, 40).rotate([0, 90, 0]).translate([a, AX[0], AX[1]])
            for a, b in segs]
Enter fullscreen mode Exit fullscreen mode

A 2 mm hole down the axis takes a length of filament as the pin. Putting the axis right at the tooth zone means the lid swings up and back without the fangs catching.

5. Wood, iron and a face

The rest is detail that sells it:

  • Planks: thin horizontal grooves every 8 mm, cut as hollow rectangular rings around the outside.
  • Iron straps: two bands with a row of rivets (small spheres) over the planks, on both lid and base.
  • Arched lid: a big cylinder intersected with a box gives the classic curved chest top. The radius comes from the chord and rise: R = ((D/2)**2 + SAG**2) / (2*SAG).
  • Eyes: two half-buried spheres on the front of the lid, each with a slot cut in for a slit pupil, and a hulled bar above each one as an angry brow that follows the arch.
  • Tongue: a chain of squashed spheres, hulled pair by pair, that lies on the floor and curls up at the front, with a groove down the middle. Your dice sit on it.

Result

72 x 52 mm, holds a full set of polyhedral dice. Two parts, both print without supports, plus a filament pin. Open it and the tongue is the first thing you see; close it and the fangs mesh.

The STL is on Cults3D: Mimic Chest Dice Box.

Other designs and early access: patreon.com/123black

Top comments (0)