The3DG

Knits & fabric · Test cube 3

Cable knit

Two strands twisting round each other in columns, with purl ridges between.

Presented by SpoolYarn comes on a spool too. I feel very at home here.
× 1.00
1.4 mm
135°
  • Prints well with a 0.4 mm nozzle.

25 mm, with your size and depth. Prints upright, no supports. About 4 MB.

Good for

Big, chunky pieces: lamp shades, vases, pencil cups.

Print notes

The purl ridges between the cables are the finest part: they set how small it can go.

  • Depth 0.4 to 1.5 mm for a 0.4 mm nozzle (as written: 1.4 mm).
  • Best on walls, printed upright. On a flat top, use thin layers (0.12 mm or less).
  • Fade it out over the bottom 3 mm so the first layers are flat and stick to the plate.
  • Not printed yet: these notes come from the geometry. The test cube will tell us more.

The formula

The real code this page runs: give it a point (U mm across, V mm up) and it returns the height there, in mm. Push the surface out by that much and the texture is real geometry.

function cableKnit(U: number, V: number, w = 14.0, P = 16.0, amp = 1.4) {
  const c = Math.floor(U / w);
  const s = U - (c + 0.5) * w;
  let h = 0;
  for (const ph of [0, Math.PI]) {
    const x = 0.22 * w * Math.sin((2 * Math.PI * V) / P + ph);
    const twist = 0.85 + 0.15 * Math.cos((2 * Math.PI * V) / P + ph);
    h = Math.max(h, amp * dome(((s - x) / (0.22 * w)) ** 2) * twist);
  }
  return Math.max(h, 0.5 * amp * dome(((Math.abs(s) - 0.47 * w) / (0.05 * w)) ** 2)); // purl ridges
}
The helpers it uses (dome, clamp)
/** A round bump: 1 in the middle (r2 = 0), 0 at the edge (r2 = 1). */
function dome(r2: number) {
  return Math.sqrt(clamp(1 - r2, 0, 1));
}
function clamp(x: number, lo: number, hi: number) {
  return Math.min(Math.max(x, lo), hi);
}

Printed

Test cube 3 is waiting for the printer. Its photo goes here.