DEV Community

Agoes Jayanata
Agoes Jayanata

Posted on

Estimating Resin for Molds and Coasters in JavaScript: Volume, Density and Waste

Most volume calculators assume a box. Resin molds are rarely boxes: coasters have rounded corners, dice molds are cubes with pips, and silicone trays taper. While building a small resin estimator I ended up with three tiny functions that cover almost every craft mold. Here they are, with the reasoning behind each.

1. Regular shapes: compute volume, then convert to mass

Resin is sold by volume (ml, fl oz) but often mixed by weight. Keep everything in cubic centimetres internally and convert at the edges.

const shapes = {
  cylinder: ({ d, h }) => Math.PI * (d / 2) ** 2 * h,   // round coaster
  box: ({ l, w, h }) => l * w * h,                      // square coaster, bar mold
  roundedSquare: ({ s, r, h }) =>                       // square with corner radius r
    (s * s - (4 - Math.PI) * r * r) * h,
};

function resinNeeded(shape, dims, count = 1, wastePct = 10) {
  const cm3 = shapes[shape](dims) * count;               // 1 cm3 = 1 ml
  return cm3 * (1 + wastePct / 100);
}

// six 10 cm round coasters, 0.6 cm deep
resinNeeded('cylinder', { d: 10, h: 0.6 }, 6); // ≈ 311 ml
Enter fullscreen mode Exit fullscreen mode

Six 10 cm coasters at 6 mm need about 283 ml of resin before waste and roughly 311 ml after a 10% allowance for the cup and stir stick. That 10% is not decorative: resin clings to every surface it touches, and a mixing cup alone can hold back 5–10 ml.

2. Irregular molds: measure with water

For anything with pips, carvings or organic edges, geometry is a trap. The reliable method is water displacement, and it maps neatly to code:

// weigh the empty mold, fill with water, weigh again
function volumeFromWater(gramsEmpty, gramsFull) {
  return gramsFull - gramsEmpty;   // water ≈ 1 g/ml
}
Enter fullscreen mode Exit fullscreen mode

Dry the mold completely before pouring, since even a drop of water can cloud epoxy.

3. Volume to weight and to A/B parts

Epoxy densities usually fall between 1.08 and 1.15 g/ml. If your kit mixes 1:1 by volume but you measure on a scale, convert first:

function splitParts(totalMl, ratio = [1, 1], density = 1.1) {
  const sum = ratio[0] + ratio[1];
  const grams = totalMl * density;
  return {
    totalGrams: Math.round(grams),
    partA: Math.round((grams * ratio[0]) / sum),
    partB: Math.round((grams * ratio[1]) / sum),
  };
}

splitParts(311);           // { totalGrams: 342, partA: 171, partB: 171 }
splitParts(311, [2, 1]);   // 2:1 system
Enter fullscreen mode Exit fullscreen mode

One caveat: when a kit specifies 1:1 by volume, part A and part B often have slightly different densities, so the gram split is not exactly 50/50. Read the technical data sheet and use the by-weight ratio it lists if there is one.

4. Depth limits matter more than volume

The other mistake the calculator catches is pour depth. A coating resin poured 2 cm thick in a deep mold can overheat, yellow or crack. A simple guard:

function lifts(depthCm, maxPourCm) {
  return Math.ceil(depthCm / maxPourCm);
}
lifts(5, 2); // 3 separate pours
Enter fullscreen mode Exit fullscreen mode

Try the full versions

I put the finished logic, with unit switching and presets, into two free tools: a resin mold calculator for any shape or water-measured mold, and a resin coaster calculator that handles sets, rounded corners and waste.

The takeaway for anyone building estimators: keep the model small, give the user a measurement escape hatch (water displacement), and always show the waste allowance explicitly so it can be tuned. A calculator that hides its assumptions gets ignored the first time it is wrong.

Top comments (0)