Skip to content

Pour Funnel With Strainer ​

Pour Funnel With Strainer, rendered in the brepjs playground
Mechanical · 152 lines▶ Run it in the playground

A 160 mm polypropylene pour funnel in use: rolled rim, hang tab, anti-airlock ribs, a two-step spout and a removable strainer, seated in the threaded neck of a canister and opened by a boolean cut. The funnel diameters, the material, the catalogue weights and the S 60/61 neck thread are published figures: the thread is a true helix of 6 mm pitch. The kernel measures the volume of the funnel and the strainer: 58 g of polypropylene against about 65 g in the catalogue. The wall, the spout, the ribs, the strainer pattern, the canister and the liquid are a display model.

Code ​

This is the full program. The playground runs it in your browser without a change.

ts
import { box, clone, compound, cut, cutAll, cylinder, extrude, fuse, fuseAll, line, loft, measureVolume, polygon, revolve, rotate, torus, translate, unwrap, wire } from 'brepjs/quick';
import { color } from 'brepjs/playground';

// Pour funnel with a removable strainer, in use in the threaded neck of a canister. In cutaway.
// The axis is Z, the top of the canister is at z = 0, and the units are millimetres.
// The funnel diameters, the material, the weights and the neck thread are published figures. The rest is a display model.
interface FunnelParams {
  size?: 160 | 235; // diameter of the bowl
  cutaway?: number; // degrees opened toward +X (0 = closed)
  pouring?: boolean; // false shows the funnel dry
}

type P2 = [number, number]; // [r, z]
type P3 = [number, number, number];
type Shape = ReturnType<typeof cylinder>;

// Kernel shapes live in WASM memory. Every temporary goes through own(). freeing() runs a build and then frees them all.
const owned: { delete(): void }[] = [];
const own = <T extends { delete(): void }>(s: T): T => {
  owned.push(s);
  return s;
};
const freeing = <T,>(build: () => T): T => { try { return build(); } finally { owned.splice(0).forEach((s) => s.delete()); } }; // also when the build throws

// ---- published figures
const CATALOGUE_G = { 160: 65, 235: 216 }; // polypropylene funnel with a removable strainer, by bowl diameter
const POLYPROPYLENE = 0.905e-3; // grams per cubic millimetre
const NECK = { crest: 30, core: 27, pitch: 6 }; // S 60/61 canister thread: 60 mm outside, 54 mm core, 6 mm pitch, right-hand

// ---- display model
const WALL = 1.6;
const SLOPE = 45; // degrees between the bowl wall and the axis
const SPOUT = { bore: 9.5, step: 28, tipBore: 6, length: 60 }; // two-step spout
const RIB = { count: 6, height: 3, thick: 2, run: 26 }; // anti-airlock ribs keep a gap open in the neck
const STRAINER = { radius: 24, plate: 1.6, hole: 1.8, grid: 6, post: 2.5 };
const TAB = { reach: 28, width: 22, thick: 2.4, hole: 4.5 };
const CAN = { wall: 2.5, neck: 24, depth: 62, radius: 62 }; // only the top of a round canister, around the neck
const POOL = 20; // liquid depth over the strainer
const TOOTH = { root: 2, crest: 0.8, turns: 2, sections: 12 }; // half widths of the neck thread, its turns and the loft sections in a turn

// A closed profile in the (r, z) half-plane, revolved about Z.
const lathe = (pts: P2[], angle = 2 * Math.PI): Shape => {
  const profile = own(unwrap(polygon(pts.map(([r, z]): P3 => [r, 0, z]))));
  return unwrap(revolve(profile, { axis: [0, 0, 1], angle })) as Shape;
};

// The neck thread: one helical tooth about Z from z0 up, right-hand. A cap screws down on it by one pitch for each turn.
// The loft is smooth. The tooth is built only outside the cutaway, which is centred on +X: one piece for each turn.
const neckThread = (z0: number, cutaway: number): Shape[] => {
  const root = NECK.core / 0.998; // a hair clear of the neck
  const piece = (from: number, to: number): Shape => {
    const n = Math.max(2, Math.round(((to - from) / 360) * TOOTH.sections));
    const sections = Array.from({ length: n + 1 }, (_, j) => {
      const turn = (from + ((to - from) * j) / n) / 360;
      const a = 2 * Math.PI * turn;
      const z = z0 + NECK.pitch * turn;
      const at = (r: number, dz: number): P3 => [r * Math.cos(a), r * Math.sin(a), z + dz];
      const pts = [at(root, -TOOTH.root), at(NECK.crest, -TOOTH.crest), at(NECK.crest, TOOTH.crest), at(root, TOOTH.root)];
      return own(unwrap(wire(pts.map((p, i) => own(line(p, pts[(i + 1) % 4]!))))));
    });
    return unwrap(loft(sections, { ruled: false })) as Shape;
  };
  if (cutaway <= 0) return [piece(0, 360 * TOOTH.turns)];
  return Array.from({ length: TOOTH.turns }, (_, k) => piece(360 * k + cutaway / 2, 360 * (k + 1) - cutaway / 2));
};

function pourFunnel({ size = 160, cutaway = 110, pouring = true }: FunnelParams = {}) {
  const tan = Math.tan((SLOPE * Math.PI) / 180);
  const skin = WALL / Math.cos((SLOPE * Math.PI) / 180); // radial thickness of the bowl wall
  const R = size / 2;
  const H = (R - SPOUT.bore) / tan; // local z = 0 is where the bowl meets the spout
  const ro = SPOUT.bore + skin;
  const tip = -SPOUT.length;

  // ---- funnel: revolved shell, rolled rim, hang tab and ribs, fused into one moulding
  const shell = own(lathe([
    [SPOUT.tipBore, tip], [SPOUT.tipBore + WALL, tip], [SPOUT.tipBore + WALL, -SPOUT.step - 5.6], [ro, -SPOUT.step], [ro, 0], [R + skin, H],
    [R, H], [SPOUT.bore, 0], [SPOUT.bore, -SPOUT.step], [SPOUT.tipBore, -SPOUT.step - 5],
  ]));
  const roll = own(torus(R + skin / 2 + 0.8, 2, { at: [0, 0, H] }));
  const tabX = -(R + TAB.reach);
  const plate = own(box(TAB.reach, TAB.width, TAB.thick, { at: [-(R + TAB.reach / 2), 0, H] }));
  const round = own(cylinder(TAB.width / 2, TAB.thick, { at: [tabX, 0, H - TAB.thick / 2] }));
  const corner = RIB.height * Math.tan(((90 - SLOPE) * Math.PI) / 360); // where the two outer edges of a rib meet
  const ribFace = own(unwrap(polygon(([
    [ro - 0.5, -24], [ro + RIB.height, -20], [ro + RIB.height, corner], [ro + RIB.height + RIB.run * tan, corner + RIB.run],
    [ro - 0.5 + (RIB.run + 6) * tan, RIB.run + 6], [ro - 0.5, 0],
  ] as P2[]).map(([r, z]): P3 => [r, -RIB.thick / 2, z]))));
  const rib = own(unwrap(extrude(ribFace, [0, RIB.thick, 0])) as Shape);
  const ribs = Array.from({ length: RIB.count }, (_, i) => own(rotate(rib, (360 * i) / RIB.count) as Shape));
  const moulding = own(unwrap(fuseAll([shell, roll, plate, round, ...ribs])) as Shape);
  const funnel = own(unwrap(cut(moulding, own(cylinder(TAB.hole, TAB.thick + 2, { at: [tabX, 0, H - TAB.thick / 2 - 1] })))) as Shape);

  // ---- strainer: a disc with a bevelled edge that sits on the bowl wall, a hole pattern and a centre post
  const st = STRAINER;
  const zs = (st.radius - SPOUT.bore) / tan;
  const disc = own(lathe([[0, zs], [st.radius, zs], [st.radius + st.plate * tan, zs + st.plate], [st.post, zs + st.plate], [st.post, zs + 7], [0, zs + 7]]));
  const holes: Shape[] = [];
  for (let i = -4; i <= 4; i++) {
    for (let j = -4; j <= 4; j++) {
      const x = (i + j / 2) * st.grid;
      const y = j * st.grid * 0.866;
      const d = Math.hypot(x, y);
      if (d > st.post + st.hole + 1 && d < st.radius - st.hole - 1.5) holes.push(own(cylinder(st.hole, st.plate + 2, { at: [x, y, zs - 1] })));
    }
  }
  const strainer = own(unwrap(cutAll(disc, holes)) as Shape);
  const grams = (unwrap(measureVolume(funnel)) + unwrap(measureVolume(strainer))) * POLYPROPYLENE;

  // ---- canister top with its threaded neck. A rib meets the inside edge of the neck, so the funnel sits on its ribs.
  const c = CAN;
  const neckIn = NECK.core - 2;
  const seat = c.neck - (neckIn - (ro + RIB.height - corner)) / tan; // lifts local z = 0 to this height
  const outside = own(cylinder(c.radius, c.depth, { at: [0, 0, -c.depth] }));
  const inside = own(cylinder(c.radius - c.wall, c.depth, { at: [0, 0, -c.depth - c.wall] }));
  const mouth = own(cylinder(neckIn, c.wall + 2, { at: [0, 0, -c.wall - 1] }));
  const neck = own(lathe([[neckIn, -c.wall], [neckIn, c.neck], [NECK.core, c.neck], [NECK.core, 3], [NECK.core + 4, 0], [NECK.core + 4, -c.wall]]));
  const thread = neckThread(c.neck - 5 - TOOTH.turns * NECK.pitch, cutaway).map(own); // ends 5 mm under the lip
  const can = own(unwrap(fuse(own(unwrap(cutAll(outside, [inside, mouth])) as Shape), neck)) as Shape);

  // ---- liquid: a stream into the bowl, a pool over the strainer, and the flow down the spout into the canister
  const zp = zs + st.plate;
  const level = zp + POOL;
  const pool = own(lathe([[st.post, zp], [st.radius + st.plate * tan, zp], [SPOUT.bore + level * tan, level], [0, level], [0, zs + 7], [st.post, zs + 7]]));
  const drain = own(lathe([[0, -c.depth - seat], [SPOUT.tipBore, -c.depth - seat], [SPOUT.tipBore, -SPOUT.step - 5], [SPOUT.bore, -SPOUT.step], [SPOUT.bore, 0], [st.radius, zs], [0, zs]]));
  const stream = own(cylinder(4, H - level + 70, { at: [-(SPOUT.bore + level * tan) * 0.55, 0, level] }));

  // Cutaway: a wedge about Z, centred on +X. The strainer and the stream stay whole.
  const sweep = (Math.max(cutaway, 1) * Math.PI) / 180;
  const wedge = own(rotate(own(lathe([[0, -200], [400, -200], [400, 500], [0, 500]], sweep)), -cutaway / 2) as Shape);
  const open = (part: Shape): Shape => (cutaway > 0 ? (unwrap(cut(part, wedge)) as Shape) : (unwrap(clone(part)) as Shape));
  const lifted = (part: Shape): Shape => translate(part, [0, 0, seat]) as Shape;

  return {
    funnel: lifted(own(open(funnel))),
    strainer: lifted(strainer),
    can: compound([own(open(can)), ...thread]) as Shape,
    liquid: pouring ? [compound([own(lifted(own(open(pool)))), own(lifted(own(open(drain)))), own(lifted(stream))]) as Shape] : [],
    grams,
    catalogue: CATALOGUE_G[size],
  };
}

const part = freeing(() => pourFunnel());
console.log('Funnel and strainer: ' + part.grams.toFixed(0) + ' g from the kernel volume. The catalogue has about ' + part.catalogue + ' g.');

export default [
  color(part.funnel, '#12b5b0'),
  color(part.strainer, '#d3a956'),
  color(part.can, '#f5f2ea'),
  ...part.liquid.map((l) => color(l, '#ff5a1f')),
];

Functions used ​

box clone compound cut cutAll cylinder extrude fuse fuseAll line loft measureVolume polygon revolve rotate torus translate unwrap wire color

▶ Run Pour Funnel With Strainer in the playground

Released under the Apache 2.0 License.