---
name: fp3d-viewer
description: Use when the user asks to "show footprint pads in 3D", "show me the pad geometry", "visualize footprint pads", "show Fp3dView", "3D pad view", "show land pattern", "show pad dimensions in 3D", or wants an interactive 3D view of a KiCad footprint's pad copper geometry with outlines, labels, measurements, and land pattern overlay in the Gallia Viewer.
---

# Fp3dView — Footprint Pad 3D Viewer

Display KiCad `.kicad_mod` footprint pad geometry as interactive 3D copper pads in the Gallia Viewer (Hydrogen) using Babylon.js. Includes outlines, pad number/name labels, measurements panel, and a datasheet-style land pattern overlay with dimension annotations.

**Input**: A `.kicad_mod` footprint file (from the **footprint-creator** skill or KiCad library)
**Output**: Interactive 3D view in Gallia Viewer with toolbar toggles

## Quick Start — CLI

```bash
node /home/adom/gallia/viewer/fp-to-3d.js <path-to-.kicad_mod>
```

Self-test mode (auto-cycles all toggles every 3s):
```bash
node /home/adom/gallia/viewer/fp-to-3d.js <path> --test
```

## Pad Data Structure

Each pad extracted from `.kicad_mod` has:

```javascript
{
  number: "1",
  name:   "L1",
  mountType: "smd",
  shape: "roundrect",
  x: -2.475, y: -1.905,
  w: 1.95, h: 0.6,
  rotation: 0,
  rratio: 0.25,
  property: "pad_prop_heatsink"
}
```

## Auto-Naming Convention

| Group | Naming | Sort Order |
|-------|--------|------------|
| Left side | L1, L2, L3, L4 | Top to bottom |
| Right side | R1, R2, R3, R4 | Bottom to top (IC convention) |
| Top row | T1, T2, ... | Left to right |
| Bottom row | B1, B2, ... | Right to left |
| Exposed pad | EP | By pad_prop_heatsink |
| Center pads | C, C1, C2 | By position |

## Message API

```javascript
iframe.contentWindow.postMessage({ type: 'fp3d_toggle', name: 'landpattern' }, '*');
// names: 'outlines', 'numbers', 'names', 'mesh2d', 'copper', 'ground', 'axes', 'dims', 'landpattern'
```

## File Location

```
/home/adom/gallia/viewer/fp-to-3d.js
```
