Components / Mechanisms
Proven

Sliding spring latch

A thumb-slide latch that snaps shut by itself and springs back to locked.

A flat slider lives inside the lid against a side wall. A ribbed thumb pad plugs into it through a window in the wall. A hook hangs out of the lid's closing face, passes through a slot in the mating part and catches under its edge. A small compression spring pushes the slider back to locked, and the sloped underside of the hook lets the lid snap shut without touching the pad.

Proven: Printed and fitted with the real hardware.Latch test cut from a laptop lid and deck, printed in PLA: slides, springs back and the lid snaps shut. Proven at the default sizes only.
3D model: Sliding spring latchLoading 3D view
lid cornerdecksliderthumb padspring

Make it

Choose the sizes and download the part. It is built when you ask, with the same code shown below. Nothing to install.

Use it in code

typescript
import { ready, SlideLatch, checks } from "partkit";
await ready();

const L = new SlideLatch();            // proven sizes; pass { travel: 5 } to change one
lid = lid.fuse(L.lidAdd()).cut(L.lidCut());
deck = deck.cut(L.deckSlot());
bezel = bezel.cut(L.bezelCut());

for (const shift of [0, L.s.travel]) {  // locked, slid open
  const [slider, pad] = L.parts(shift);
  if (checks.overlap(slider, lid) > 0) throw new Error("slider hits the lid");
}
console.log(L.selfCheck().toString());

What you print

  • .slider(): the plate with its hook, printed flat on its side
  • .padPart(): the thumb pad with its tenon

Hardware

  • One compression spring per latch, about 5.5 mm diameter x 17.5 mm long (7/32 in x 11/16 in)

Functions

CallWhat it gives you
new SlideLatch(sizes?)The latch with its proven sizes. Pass only the sizes you want to change.
.parts(shift)[slider, pad] slid by shift mm toward unlock, for checks through the travel.
.lidAdd() / .lidCut()Guide rib and spring seat to add to the lid; pad window to cut from its wall.
.bezelCut()Notch so a bezel can drop on over the hook after the latch is in.
.deckSlot()Slot for the hook in the mating part, with a small lead-in for the ramp.
.selfCheck()Runs every fit check for these sizes on a demo lid and returns a report.

Frame. Right-hand latch; mirror it for the left. x = 0 is the outside face of the lid's side wall and the inside is at x < 0. y runs along the wall with y = 0 at the middle of the thumb pad; -y is the unlock direction. z is through the lid's thickness with the closing face at faceZ.

Sizes

Millimetres. These defaults are the sizes that were printed; other values are untested.

NameDefaultMeaning
wallT4Lid side wall thickness
plateT3.6Slider plate thickness
plateGap0.3Gap between slider and wall
plateY(-15, 15)Slider plate along the wall (y0, y1)
plateZ(-3.3, 11.7)Slider plate through the lid (z0, z1)
travel4Slide distance to unlock
pad(-8, 8, 0.2, 7.8)Thumb pad (y0, y1, z0, z1)
tenon(-5, 5, 1.5, 6.5)Pad's tenon through the slider (y0, y1, z0, z1)
leg(-3, 3)Hook leg along the wall (y0, y1)
tooth2.5Hook tooth length
toothH3Hook tooth height
faceZ-15The lid's closing face
skinT3Thickness of the skin the hook catches under
roofZ12.5The lid's inside ceiling
seatY-30Face of the spring seat
seatEndY-34.5Inside face of the lid's end wall
springR2.8Spring radius plus clearance
springZ4Spring axis height
bezelZ(-16, -3)Bezel thickness range (z0, z1)

Check before you print

  • Slider and pad clear the lid, locked and slid open
  • Locked: lifting the lid 1 mm makes the hook collide with the deck (it holds)
  • Slid open: the hook lifts out freely
  • The bezel can drop on over the hook
  • Spring pocket: 15 mm locked, 11 mm slid open

Learned the hard way

  • Measure the actual spring you have instead of trusting a catalogue size.
  • Leave posts and anything else that is not part of the mechanism out of the test piece.

Open it in Fusion 360

The scene above as a STEP file: real solid bodies, each part its own named component, in position. In Fusion 360 use File, Open, then Open from my computer. It also opens in FreeCAD, SolidWorks and Onshape. It carries the shapes, not the sizes you can change; for different sizes, use Make it above or change them in code.

Source: ts/src/latch.ts
typescript
/** Sliding lid latch with a spring return. PROVEN at the default sizes.
 *  Frame (right-hand latch; mirror for the left): x = 0 is the OUTSIDE face of the lid's side wall, inside is x < 0.
 *  y runs along the wall, y = 0 at the middle of the thumb pad, -y is the unlock direction.
 *  z is through the lid's thickness: closing face at faceZ, inside ceiling at roofZ. */
import { box, ycyl, prismYZ, moved, type Solid } from "./geom";
import { Report, overlap, pathClear, solids } from "./checks";

export interface SlideLatchSizes {
  wallT: number; plateT: number; plateGap: number; plateY: [number, number]; plateZ: [number, number]; travel: number;
  pad: [number, number, number, number]; tenon: [number, number, number, number]; leg: [number, number];
  tooth: number; toothH: number; faceZ: number; skinT: number; roofZ: number; seatY: number; seatEndY: number;
  springR: number; springZ: number; bezelZ: [number, number];
}

export const PROVEN_SIZES: SlideLatchSizes = {
  wallT: 4.0, plateT: 3.6, plateGap: 0.3, plateY: [-15, 15], plateZ: [-3.3, 11.7], travel: 4.0,
  pad: [-8, 8, 0.2, 7.8], tenon: [-5, 5, 1.5, 6.5], leg: [-3, 3], tooth: 2.5, toothH: 3.0, faceZ: -15, skinT: 3.0,
  roofZ: 12.5, seatY: -30, seatEndY: -34.5, springR: 2.8, springZ: 4.0, bezelZ: [-16, -3],
};

export class SlideLatch {
  readonly s: SlideLatchSizes;
  constructor(sizes: Partial<SlideLatchSizes> = {}) {
    this.s = { ...PROVEN_SIZES, ...sizes };
  }
  get x0() { return -this.s.wallT - this.s.plateGap - this.s.plateT; }
  get x1() { return -this.s.wallT - this.s.plateGap; }
  get underZ() { return this.s.faceZ - this.s.skinT - 0.3; }
  get springX() { return -this.s.wallT - this.s.plateGap - this.s.springR; }

  /** [slider, pad], slid by shift mm toward unlock (0 .. travel). */
  parts(shift = 0): [Solid, Solid] {
    const s = this.s, x0 = this.x0, x1 = this.x1;
    const [y0, y1] = s.plateY, [z0, z1] = s.plateZ, ly = s.leg[1], u = this.underZ;
    const plate = box(x0, x1, y0, y1, z0, z1);
    const leg = box(x0, x1, s.leg[0], s.leg[1], u - s.toothH, z0);
    const tooth = prismYZ([[ly, u], [ly + s.tooth, u], [ly + s.tooth, u - 0.4], [ly, u - s.toothH]], x0, x1);
    const peg = ycyl(1.8, this.springX, s.springZ, y0 - 3.0, y0).intersect(box(x0, x1, y0 - 4, y0, -5, 15));
    const [ty0, ty1, tz0, tz1] = s.tenon;
    const slider = plate.fuse(leg).fuse(tooth).fuse(peg).cut(box(x0 - 1, x1 + 1, ty0 - 0.1, ty1 + 0.1, tz0 - 0.1, tz1 + 0.1));
    const [py0, py1, pz0, pz1] = s.pad;
    let pad = box(x1, 0, py0, py1, pz0, pz1).fuse(box(x0, x1, ty0, ty1, tz0, tz1));
    for (const yr of [py0 + 3.5, (py0 + py1) / 2, py1 - 3.5]) pad = pad.fuse(box(-0.1, 0.8, yr - 0.7, yr + 0.7, pz0, pz1));
    return shift === 0 ? [slider, pad] : [moved(slider, 0, -shift, 0), moved(pad, 0, -shift, 0)];
  }
  slider() { return this.parts()[0]; }
  padPart() { return this.parts()[1]; }

  /** Add to the lid: guide rib beside the slider, and the spring seat with its peg. */
  lidAdd(): Solid {
    const s = this.s, x0 = this.x0, [y0, y1] = s.plateY;
    const xs = this.springX - s.springR - 0.4;
    return box(x0 - 2.6, x0 - 0.2, y0 - 0.2, y1 + 2, 2.0, s.roofZ)
      .fuse(box(xs - 2.4, xs, s.seatY - 0.5, y0 + 2.0, 0.5, s.roofZ))
      .fuse(box(xs - 2.4, -s.wallT + 0.5, s.seatEndY, s.seatY, -2.0, s.roofZ))
      .fuse(ycyl(1.8, this.springX, s.springZ, s.seatY, s.seatY + 4.0));
  }
  /** Cut from the lid: window in the side wall for the thumb pad. */
  lidCut(): Solid {
    const s = this.s, [py0, py1, pz0, pz1] = s.pad;
    return box(-s.wallT - 1, 1, py0 - s.travel - 0.2, py1 + 0.2, pz0 - 0.2, pz1 + 0.2);
  }
  /** Cut from the bezel: notch its edge so it can drop on over the hook. */
  bezelCut(): Solid {
    const s = this.s;
    return box(this.x0 - 0.7, 0, s.leg[0] - s.travel - 0.6, s.leg[1] + s.tooth + 0.6, s.bezelZ[0], s.bezelZ[1]);
  }
  /** Cut from the deck, in the LID's frame with the lid closed: the slot the hook goes through. */
  deckSlot(): Solid {
    const s = this.s, y0 = s.leg[0] - s.travel - 1.6, y1 = s.leg[1] + 0.3;
    return box(this.x0 - 0.5, this.x1 + 0.5, y0, y1, s.faceZ - s.skinT - 1, s.faceZ + 1).fuse(
      box(this.x0 - 0.5, this.x1 + 0.5, y1 - 0.1, y1 + 0.7, s.faceZ - 0.7, s.faceZ + 1),
    );
  }
  springPocketLen(shift = 0) { return this.s.plateY[0] - shift - this.s.seatY; }
  /** A plain lid corner, deck and bezel with this latch applied: for pictures, examples and selfCheck(). */
  demoHost(depth = 40, length = 34): { lid: Solid; deck: Solid; bezel: Solid } {
    const s = this.s, xIn = -depth, y0 = s.seatEndY - s.wallT, y1 = length;
    const lid = box(xIn, 0, y0, y1, s.faceZ, s.roofZ + 2.5)
      .cut(box(xIn - 1, -s.wallT, s.seatEndY, y1 + 1, s.faceZ - 1, s.roofZ))
      .fuse(this.lidAdd())
      .cut(this.lidCut());
    const deck = box(xIn, 0, y0, y1, s.faceZ - s.skinT, s.faceZ).cut(this.deckSlot());
    const bezel = box(xIn, -s.wallT - 0.25, s.seatEndY + 0.25, y1, s.bezelZ[0] + 1, s.bezelZ[1] - 0.8).cut(this.bezelCut());
    return { lid, deck, bezel };
  }

  /** Run the latch's fit checks on demoHost(). Passing does NOT make new sizes proven: print a coupon. */
  selfCheck(): Report {
    const { lid, deck, bezel } = this.demoHost();
    const r = new Report();
    for (const [shift, tag] of [[0, "locked"], [this.s.travel, "slid open"]] as [number, string][]) {
      const [sl, pad] = this.parts(shift);
      r.check(`slider vs lid, ${tag}`, sl, lid);
      r.check(`pad vs lid, ${tag}`, pad, lid);
      r.check(`hook vs deck, ${tag}`, sl, deck);
      r.check(`slider vs bezel, ${tag}`, sl, bezel);
    }
    const [locked] = this.parts(0);
    const held = overlap(moved(locked, 0, 0, 1), deck);
    r.rows.push({ name: "locked: hook holds when the lid is lifted 1 mm (wants > 0.5)", value: held, ok: held > 0.5 });
    const [open] = this.parts(this.s.travel);
    r.add("slid open: hook lifts out freely", Math.max(...[0.5, 1, 2, 4, 8].map((dz) => overlap(moved(open, 0, 0, dz), deck))));
    r.add("bezel drops on over the hook", pathClear(bezel, [0, 0, -1], [0, 2, 5, 10, 20], [locked]));
    r.add("lid is one piece (extra solids)", solids(lid) - 1);
    const free = this.springPocketLen(this.s.travel);
    r.rows.push({ name: `spring pocket slid open is ${free.toFixed(1)} mm (wants >= 8)`, value: free, ok: free >= 8 });
    return r;
  }

}

View this module on GitHub