# Mesh Repair Case Study — From Hollow-Shell Failure to Solid-Plate Fix

## Original Failure (Session: 2026-05-09)

Design: `hollow_box()` built as **outer shell + inner shell + edge bridges**.

**STL Repair result** (formware.co/onlinestlrepair):
```
24 Naked edges
2 Planar holes
41 Inverted normals
0 Non-Manifold edges
0 Duplicate faces
0 Degenerate faces
0 Disjoint shells
```

**Root cause:**
- Inner shell was a separate closed mesh with inverted normals.
- Bridges between outer and inner edges were quad patches that did not fully seal every seam.
- Where bridges missed a corner, edges had only one adjacent face → naked edges.
- Inner shell normals pointed inward, which some slicers/repair tools count as inverted.

## The Fix

Replaced `hollow_box()` with a **solid-plate construction**:

```
hollow_box(x,y,z, w,h,d, wall=t, floor=fl)
├── bottom plate:    box(x, y, z,               w, h, fl)
├── front wall:      box(x, y, z,               w, t, d)
├── back wall:       box(x, y+h-t, z,           w, t, d)
├── left wall:       box(x, y+t, z,             t, h-2t, d)
└── right wall:      box(x+w-t, y+t, z,         t, h-2t, d)
```

All five pieces are solid cuboids (fully manifold on their own). Overlapping at edges is harmless — the resulting mesh is a single watertight shell.

**After fix:**
- Facets dropped from 240 → 108
- Zero naked edges, zero holes, zero inverted normals
- No online repair needed

## General Principle

When a builder cannot do true boolean mesh subtraction (CSG), avoid:
- Two separate closed shells touching at edges
- Bridge patches between shells
- Inward-facing normals on inner cavities

Prefer:
- Solid plates that tile the desired volume
- Let overlaps create the wall thickness naturally
- Manifold by construction, not by repair

# Mesh Repair Case Study — From Hollow-Shell Failure to Solid-Plate Fix

## Original Failure (Session: 2026-05-09)

Design: `hollow_box()` built as **outer shell + inner shell + edge bridges**.

**STL Repair result** (formware.co/onlinestlrepair):
```
24 Naked edges
2 Planar holes
41 Inverted normals
0 Non-Manifold edges
0 Duplicate faces
0 Degenerate faces
0 Disjoint shells
```

**Root cause:**
- Inner shell was a separate closed mesh with inverted normals.
- Bridges between outer and inner edges were quad patches that did not fully seal every seam.
- Where bridges missed a corner, edges had only one adjacent face → naked edges.
- Inner shell normals pointed inward, which some slicers/repair tools count as inverted.

## The Fix

Replaced `hollow_box()` with a **solid-plate construction**:

```
hollow_box(x,y,z, w,h,d, wall=t, floor=fl)
├── bottom plate:    box(x, y, z,               w, h, fl)
├── front wall:      box(x, y, z,               w, t, d)
├── back wall:       box(x, y+h-t, z,           w, t, d)
├── left wall:       box(x, y+t, z,             t, h-2t, d)
└── right wall:      box(x+w-t, y+t, z,         t, h-2t, d)
```

All five pieces are solid cuboids (fully manifold on their own). Overlapping at edges is harmless — the resulting mesh is a single watertight shell.

**After fix:**
- Facets dropped from 240 → 108
- Zero naked edges, zero holes, zero inverted normals
- No online repair needed

## General Principle

When a builder cannot do true boolean mesh subtraction (CSG), avoid:
- Two separate closed shells touching at edges
- Bridge patches between shells
- Inward-facing normals on inner cavities

Prefer:
- Solid plates that tile the desired volume
- Let overlaps create the wall thickness naturally
- Manifold by construction, not by repair

## Applicability

This principle applies to any part designed with the `bambu-3d-design` stl_builder where the user needs:
- Hollow enclosures
- Walls with cutouts (use `wall_with_rect_hole()` — also 4-strip solid-plate build)
- Any shape where the naive approach would create separate shells

## Session Note: Rounded Pocket Design (Werkzeug-Box, 2026-05-09)

Grid-approximation was used to carve **half-circular grip pockets** into slot walls. Key learnings:
- **Two-resolution grid**: `1 mm` coarse everywhere, `0.2 mm` fine inside the pocket boundary only — keeps facets reasonable (~90 k total for this box).
- **Pocket depth**: Carved by using a shorter box (only up to `h_pocket = H - depth`) inside the circle, full height outside. Same cell test, different Z-height.
- **User feedback**: "Kreise müssen bisschen kleiner sein" — margin around the circle to the outer box wall is needed so the grid doesn't extend past the wall boundary.
- **Inside roundness**: blocky appearance → fixed by dropping fine step to `0.2 mm`.
