L2 · PAI-150

Tolerances: the band a part must live in

Assign tolerances to ≥2 critical dimensions and predict how tightening or loosening each changes cost and fit — reaching a functioning fit at the lowest cost.

01
Challenge

Try this first — before any explanation.

Make the bracket's bore accept a Ø11.98–12.00 dowel pin as cheaply as you can. Type a tolerance band on the bore (D1) — a ± value or asymmetric +x/−y — then Run Fit Check across 200 simulated parts. Enter something absurdly tight and cost explodes; loose and pins jam or rattle. Both are the intended productive failure.

The Bench

The twin's fit/cost model in numpy: worst-case clearance for the fit verdict, cost ∝ 1/band, total = mean of per-dimension multipliers. Edit your bands and run.

clear[1]: return 'FAIL_LOOSE', round(max_c,3)\n return 'PASS', (round(min_c,3), round(max_c,3))\n\ndef relative_cost(band): return round((0.10 / max(band,1e-4)), 3)\ndef total_cost(bands): return round(sum(relative_cost(b) for b in bands)/len(bands), 3)","label":"1 — Functional windows + cost model"},{"code":"# Express each band as (low, high) absolute limits in mm.\nbore = (12.010, 12.090) # EDIT band = high-low\nslot = ( 7.980, 8.060) # EDIT\nbore_band = round(bore[1]-bore[0], 3)\nslot_band = round(slot[1]-slot[0], 3)\nbv = fit_verdict(bore[0], bore[1], PIN_MIN, PIN_MAX, BORE_CLEAR)\nsv = fit_verdict(slot[0], slot[1], RIB_MIN, RIB_MAX, SLOT_CLEAR)\nprint(f'bore band={bore_band} -> {bv} cost {relative_cost(bore_band)}x')\nprint(f'slot band={slot_band} -> {sv} cost {relative_cost(slot_band)}x')\nprint('total cost:', total_cost([bore_band, slot_band]), 'x')","label":"2 — Your tolerance bands (EDIT)"},{"code":"np.random.seed(311)\ndef sample_fit(low, high, mate_min, mate_max, clear, n=200):\n dia = np.random.uniform(low, high, n)\n mate = np.random.uniform(mate_min, mate_max, n)\n clr = dia - mate\n return float(np.mean((clr >= clear[0]) & (clr <= clear[1])))\nbore_pass = sample_fit(*bore, PIN_MIN, PIN_MAX, BORE_CLEAR)\nslot_pass = sample_fit(*slot, RIB_MIN, RIB_MAX, SLOT_CLEAR)\nprint(f'bore parts that fit: {bore_pass:.1%} slot: {slot_pass:.1%}')","label":"3 — 200-part Monte-Carlo fit check (seed M3L1=311)"},{"code":"problems = []\nif bv[0] != 'PASS':\n problems.append(f'D1 {bv[0]} — {\"raise the lower limit\" if bv[0]==\"FAIL_TIGHT\" else \"lower the upper limit (loosest passing band = 0.080)\"}.')\nif sv[0] != 'PASS':\n problems.append(f'D3 {sv[0]} — adjust the slot band toward the -0.010..0.110 mm transition window.')\ntc = total_cost([bore_band, slot_band])\nif tc > 1.40:\n problems.append(f'Fit works but total cost {tc}x > 1.40 — each band can open to 0.080 mm (1.25x each); widen toward there.')\n\nif bv[0]=='PASS' and sv[0]=='PASS' and tc <= 1.40:\n print(f'PASS - bore & slot both fit all 200 parts at total cost {tc}x <= 1.40. '\n 'You set a function-driven, cost-aware tolerance - not over-tightened.')\nelse:\n print('FAIL - ' + ' '.join(problems[:2]))","label":"4 — Autograder (seed M3L1, cost gate 1.40x)"}],"intro":"The twin's fit/cost model in numpy: worst-case clearance for the fit verdict, cost ∝ 1/band, total = mean of per-dimension multipliers. Edit your bands and run.","key":"manufacturing/tolerances-the-band-a-part-must-live-in","kind":"python","title":"Tolerances: the band a part must live in"}">
PYTHON · NUMPY · IN-BROWSER

Tolerances: the band a part must live in

The twin's fit/cost model in numpy: worst-case clearance for the fit verdict, cost ∝ 1/band, total = mean of per-dimension multipliers. Edit your bands and run.

02
Model

The idea, built visually.

Your CAD model says 12.000 — but to how many zeros? No machine makes exactly twelve. A real dimension isn't a number, it's a band: the tolerance. And the band isn't arbitrary — it comes from function. This bore's job is to accept this pin: too small and it won't go, too big and it rattles.

Now the trap: tighter feels safer, but tightness costs money — slower cuts, finer tools, more inspection, more scrap — and cost climbs steeply as the band shrinks. So the right answer is the loosest band that still functions. Tighter than that, you're burning money for precision the part never needed.

▣ Stage animation: A single 12.000 line splits into a shaded band; a pin slides in when the band fits, collides when too small; a cost dial climbs 1.4× … 3.8× as the band narrows toward a hairline, with the sweet spot highlighted where function meets lowest cost.

03
Guided practice

Build it up, step by step.

  1. Step A (worked): bore 12.00 +0.05/+0.02 → band 0.03, PASS but cost 3.33× (over-tight).
  2. Step B (fade): widen to keep PASS and drop cost — bore 12.010 +0.080/−0.000 → band 0.080, cost 1.25×; the 0.080 band is both cheapest and loosest (push wider and it fails loose — the band has a ceiling).
  3. Step C (independent): tolerance the slot D3 (transition fit on a 7.95–7.99 rib) from scratch and predict that halving the bore band doesn't change the slot's cost.
04
Feedback

How the Bench grades your run.

PASS WHEN Bore D1 and slot D3 both PASS (every sampled part functions) AND total relative cost ≤ 1.40× (mean of per-dimension multipliers), on the locked seed.

  • FAIL_TIGHT on D1 — smallest bore is only 0.005 mm over the largest pin; the pin can jam. Raise the bore's lower limit by ≥0.005 mm.
  • FAIL_LOOSE on D1 — largest bore gives 0.130 mm clearance, past the 0.110 mm limit. Lower the upper limit (loosest passing band is 0.080 mm).
  • Fit works, but total cost is 2.17× — your 0.03 mm bore band (3.33×) is tighter than function needs. Each band can open to 0.080 mm; widen toward there.
  • D3 has no band — an untoleranced critical dimension can't be quoted or inspected. Assign a band yielding −0.010 to +0.110 mm clearance on the rib.
05
Retrieve & space

Bring back what you've already mastered.

  • From M1 (DFM): which earlier choice — wall, draft, or fillet — most affects whether a tight bore is even machinable? → fillet/edge access & rigidity.
  • From M2: to hold a tighter bore band, which way do feed and depth move, and what does it cost? → lower feed / lighter finishing pass → more time.
  • Within 3.1: 'Loosest band that still ____ = lowest cost' → functions.
06
Mastery gate

What you must demonstrate to advance.

On a fresh seed with different pin measurements, tolerance both bore and slot so all 200 sampled parts function AND total relative cost ≤ 1.40×, with a correct prediction of how halving one band moves cost. Unlocks 3.2.

07
Project

How this feeds your build.

Feeds the M5 capstone: the bore and slot tolerances here become the LSL/USL spec limits the M5 line must hit at yield — this lesson defines the target band everything downstream must repeatably hit.