DEV Community

Cover image for Building a Tool Drawer Shadow Foam & Milwaukee Packout DXF/G-Code Engine in TypeScript (Finger Scallops & Foam-Web DRC)
CutPath CAD
CutPath CAD

Posted on

Building a Tool Drawer Shadow Foam & Milwaukee Packout DXF/G-Code Engine in TypeScript (Finger Scallops & Foam-Web DRC)

Milling 2-tone Kaizen polyethylene foam or laser-cutting 15 mm cross-linked EVA for tool drawers looks deceptively simple until you actually clamp a $78 4×8 ft sheet to your spoilboard.

Three geometry problems ruin most DIY shadow foam DXFs:

  1. Rectangular foam blanks don't fit real cases. A Milwaukee Packout (48-22-8424 / 48-22-8430) has 45-degree molded corner rib chamfers and front latch indents. A Festool Systainer³ M has a centered 64 × 16 mm front T-LOC latch boss. Cutting a plain square blank makes the foam buckle upward in the corners.
  2. Overlapping finger-pull circles break CAM pocketing. Makers often drop two Ø22 mm circles onto the sides of an M18 battery rectangle in Inkscape or Fusion 360 and forget to boolean-union them. SheetCam, VCarve, and LightBurn either double-cut the interior chord or refuse to offset the self-intersecting loop.
  3. Thin foam walls tear within two weeks. A 4 mm bridge between two deep 57 mm Kaizen pockets rips the first time you pull a 5.0Ah battery out.

We built a pure TypeScript, zero-dependency browser CAD/CAM engine for CutPath CAD's Free Tool Drawer Shadow Foam & Packout DXF Generator that solves all three analytically—and outputs strict AC1009 AutoCAD R12 DXF, 1:1 LightBurn SVG, and ready-to-run multi-pass CNC pocketing G-code.

1. Analytical Single-Contour Finger-Lift Scallops (Zero Boolean Dependencies)

Instead of running a heavyweight polygon-clipping library to union circular thumb notches onto tool pockets, we walk each pocket boundary analytically in counter-clockwise (CCW) order:

function buildNotchedRoundedRect(
  x: number,
  y: number,
  w: number,
  h: number,
  cornerR: number,
  notchMode: 'lr' | 'tb' | 'none',
  notchDia: number
): Point2D[] {
  const r = clamp(cornerR, 1.5, Math.min(w, h) * 0.42);
  const nr = clamp(notchDia / 2, 5, 16);
  const hasLR = notchMode === 'lr' && h > 2 * r + 2 * nr + 4;
  const hasTB = notchMode === 'tb' && w > 2 * r + 2 * nr + 4;
  const cx = x + w / 2;
  const cy = y + h / 2;
  const pts: Point2D[] = [];

  // Bottom edge (with optional outward -Y thumb scallop)
  pts.push({ x: x + r, y });
  if (hasTB) addArc(pts, cx, y, nr, Math.PI, Math.PI * 2, 14);
  pts.push({ x: x + w - r, y });

  // Bottom-right fillet -> Right edge (+X scallop) -> Top-right fillet -> ...
  addArc(pts, x + w - r, y + r, r, -Math.PI / 2, 0, 8);
  if (hasLR) addArc(pts, x + w, cy, nr, -Math.PI / 2, Math.PI / 2, 14);
  // ...remaining edges & fillets
  return ensureCCW(pts);
}
Enter fullscreen mode Exit fullscreen mode

Because each semicircular scallop (Ø20–22 mm) is emitted inline as a continuous sequence of vertices protruding outward into the surrounding foam, the resulting pocket is guaranteed to be a single closed, non-self-intersecting CCW loop (0 open paths, 0 duplicate chords). The same parametric approach extends cleanly to teardrop 3/8" ratchets, L-jaw 6" digital calipers, and tapered Knipex Cobra plier pockets.

2. Exact Case Contours & Press-Fit Tolerance Math

Closed-cell Kaizen PE and XLPE foams compress slightly around rigid tools. Cutting a pocket at exact nominal tool dimensions lets sockets and M18 batteries rattle when you carry a Packout vertically.

We apply an explicit fitOffsetMm (-0.5 mm per side for 57 mm Kaizen with a 1/4" upcut foam mill; -0.25 mm for 15 mm cross-linked EVA on a 60–100W CO2 laser) before emitting geometry, and pair it with exact interior case silhouettes:

Case / Drawer Profile Interior Dimensions Special Perimeter Features
Milwaukee Packout Standard (48-22-8424 / 8430) 476 × 356 mm (18.75" × 14.0") 4× 45° corner rib bevels (18 mm) + front latch relief
Milwaukee Packout Compact (48-22-8435) 356 × 228 mm (14.0" × 9.0") 4× 45° corner rib bevels (14 mm) + front latch relief
Milwaukee Packout 3-Drawer (48-22-8443) 413 × 317 mm (16.25" × 12.5") R10 mm drop-in drawer liner corners
Harbor Freight US General 5-Drawer Cart 686 × 470 mm (27.0" × 18.5") Full-width mechanic top/bottom drawer (R10 mm)
Festool Systainer³ M (M 137 / M 187) 380 × 280 mm (15.0" × 11.0") Centered 64 × 16 mm front T-LOC latch cutout recess

3. Exact Edge-to-Edge Foam-Web Fabrication DRC

Before exporting DXF or G-code, every pocket contour is checked against both the outer tray boundary (accounting for corner bevels and T-LOC recesses via point-in-polygon + segment distance) and every other pocket loop:

  • Outer Tray Border Margin: Flags any pocket or finger-lift scallop encroaching on the outer rim or crossing a Packout corner bevel.
  • Pocket-to-Pocket Foam Web: Measures the exact minimum edge-to-edge Euclidean distance between every pair of cavities (targeting >= 9.5 mm in 57 mm Kaizen so walls resist finger tear-out).
  • Endmill / Laser Kerf Fit: Confirms the narrowest slot clears the chosen 1/4" (6.35 mm) or 1/8" (3.175 mm) foam upcut bit or CO2 laser kerf.
  • Bottom Contrast Backing Floor: Ensures CNC router blind pockets preserve >= 6 mm of contrasting bottom backing foam.

4. Direct Multi-Pass CNC Foam Pocketing G-Code + 3D Backplot

Most CNC router foam failures come from running hardwood speeds (24,000 RPM at 60 IPM), which melts polyethylene into gummy strings around the cutter. Our G-code emitter targets GRBL/Shapeoko, Onefinity, MASSO, and Mach3 using true high-feed climb-cut parameters (220 IPM @ 16,000 RPM, 12.7 mm Z-stepdown), cuts all interior tool pockets FIRST while the foam blank remains rigidly held, and cuts the outer tray contour LAST.

You can inspect all 3 Z-passes and 7,500+ motion blocks live in 3D isometric via our free Online 3D G-Code Viewer in one click—or nest a 12-tray shop fleet onto a full 4×8 ft Kaizen blank (~$6.50/tray) in WB-04 Sheet Nesting.

Try It Free (No Sign-Up Required)

Top comments (0)