---
name: fusion-export-molecule
description: Export a Fusion 360 Electronics design as an Adom molecule — orchestrates existing AdomBridge primitives to produce BRD, SCH, F3D, STEP, USDZ, and silkscreen PNGs (the molecule source bundle). Also covers Kitchen Sink export (adds Gerbers, BOM, CPL). Use when the user says "export molecule", "fusion export molecule", "export for hydrogen", "hydrogen export", "export kitchen sink", "fusion export", "export brd sch f3d", "export gerbers bom cpl", "fusion export all files", "export usdz", or "export step". For a KiCad design, see kicad-export-molecule.
---

# Fusion Export for Molecule

Export a Fusion 360 Electronics design as an Adom molecule — the STEP + board + silkscreen bundle the wiki/OCCT pipeline and the Hydrogen viewer consume — by orchestrating AdomBridge CLI primitives from the container.

**Prerequisite:** `adom-desktop` must be connected (`adom-desktop ping`) and Fusion must be running with the design open.

## Architecture

The export is **orchestrated from the container** using existing `adom-desktop fusion_*` primitives. No custom add-in commands or HelperJoe buttons are needed — each step calls a standard AdomBridge verb.

```
Container (skill orchestration)
  │
  ├── fusion_export_eagle_source  → BRD file
  ├── fusion_export_eagle_source  → SCH file (after switching to schematic)
  ├── fusion_show_3d_board        → switch to 3D view
  ├── fusion_export_f3d           → Fusion archive
  ├── fusion_export_step          → STEP 3D model
  ├── fusion_export_usdz          → AR/Hydrogen 3D model
  ├── fusion_take_silkscreen_screenshot → top silkscreen PNG
  ├── fusion_take_silkscreen_screenshot → bottom silkscreen PNG
  └── pull_file                   → copy all files to container
```

## Export the molecule — Step by Step

### Step 0: Open the board + verify state

**Open the `.fbrd` board file DIRECTLY — never the bare name or the `.fprj`.** A Fusion
electronics file that links to multiple designs (most "FRAME MOL" boards) pops a native
**"Select Electronics Design File" picker** when you open the project/bare name. That picker
is a **CEF/Chromium modal that cannot be driven headlessly** (keyboard doesn't reach its list;
screen-coord clicks are unreliable on multi-monitor/HiDPI). Targeting the `.fbrd` skips it
entirely and lands straight in PCB Editor (live-confirmed):

```bash
adom-desktop fusion_open_cloud_file '{"projectName":"Main","folderPath":"Molecules/COSMIIC","fileName":"PG4 FRAME MOL","fileExtension":"fbrd","recovery":"discard"}'
# → doc opens in PCB Editor, NO picker. (Omitting fileExtension may hit the multi-design picker.)
```

Then verify:
```bash
adom-desktop fusion_get_app_state '{}'
```
Ensure: Fusion running, `activeWorkspace` is `PCB Editor`, `isElectronics: true`.

If a "Select Electronics Design File" dialog DID appear (e.g. a `.fbrd` that itself links to
multiple designs), it can't be resolved headlessly today — pick on the desktop, or fall back to
CDP into the CEF dialog. `fusion_window_info` / the bridge's `blockingDialogs` will name it.

If already open but not in PCB Editor:
```bash
adom-desktop fusion_electron_run '{"command":"EDIT .brd"}'
```

### Step 1: Export BRD

```bash
adom-desktop fusion_export_eagle_source '{"outputPath":"C:/tmp/export/<name>.brd","format":"brd"}'
```

### Step 2: Export SCH

Switch to schematic, then export:
```bash
adom-desktop fusion_electron_run '{"command":"EDIT .s1"}'
sleep 2
adom-desktop fusion_export_eagle_source '{"outputPath":"C:/tmp/export/<name>.sch","format":"sch"}'
```

Switch back to board after:
```bash
adom-desktop fusion_electron_run '{"command":"EDIT .brd"}'
```

### Step 3: Switch to 3D view

```bash
adom-desktop fusion_show_3d_board '{}'
```

Wait for workspace to switch (5-10s). Verify:
```bash
adom-desktop fusion_get_app_state '{}'
# Expected: activeWorkspace: "Design" or "3D PCB"
```

### Step 4: Export F3D

```bash
adom-desktop fusion_export_f3d '{"outputPath":"C:/tmp/export/<name>.f3d"}'
```

### Step 5: Export STEP

```bash
adom-desktop fusion_export_step '{"outputPath":"C:/tmp/export/<name>.step"}'
```

### Step 6: Export USDZ

```bash
adom-desktop fusion_export_usdz '{"outputPath":"C:/tmp/export/<name>.usdz"}'
```

### Step 7: Capture silkscreen PNGs

```bash
adom-desktop fusion_take_silkscreen_screenshot '{"outputPath":"C:/tmp/export/<name>_silkscreen_top.png","layer":"top"}'
adom-desktop fusion_take_silkscreen_screenshot '{"outputPath":"C:/tmp/export/<name>_silkscreen_bottom.png","layer":"bottom"}'
```

These produce 2048x2048 transparent-background PNGs. Requires the 3D Design view (done in Step 3). Each capture takes ~3s (includes 1s render sleep).

### Step 8: Pull files to container

```bash
adom-desktop pull_file '{"filePaths":["C:/tmp/export/<name>.brd","C:/tmp/export/<name>.sch","C:/tmp/export/<name>.f3d","C:/tmp/export/<name>.step","C:/tmp/export/<name>.usdz","C:/tmp/export/<name>_silkscreen_top.png","C:/tmp/export/<name>_silkscreen_bottom.png"],"saveTo":"/tmp/export"}'
```

### Output files

| File | Format | Description |
|------|--------|-------------|
| `<name>.brd` | EAGLE board | PCB layout |
| `<name>.sch` | EAGLE schematic | Circuit schematic |
| `<name>.f3d` | Fusion archive | Full parametric 3D model |
| `<name>.step` | STEP | CAD interchange 3D model |
| `<name>.usdz` | USDZ | AR/Hydrogen 3D viewer |
| `<name>_silkscreen_top.png` | PNG | Top silkscreen render (transparent bg) |
| `<name>_silkscreen_bottom.png` | PNG | Bottom silkscreen render (transparent bg) |

## Kitchen Sink Export

For manufacturing files in addition to the Hydrogen export, add these steps after Step 7:

### Gerbers

Switch back to 2D board first:
```bash
adom-desktop fusion_electron_run '{"command":"EDIT .brd"}'
sleep 3
adom-desktop fusion_export_gerbers '{"outputPath":"C:/tmp/export/gerbers.zip"}'
```

### BOM

```bash
adom-desktop fusion_export_bom '{"outputPath":"C:/tmp/export/bom.csv"}'
```

### CPL

```bash
adom-desktop fusion_export_cpl '{"outputPath":"C:/tmp/export/cpl.csv"}'
```

## Saving Designs

The cloud save command:
```bash
adom-desktop fusion_execute_text_command '{"command":"Commands.Start PLM360SaveCommand"}'
```

This opens a Save dialog. Find and confirm it:
```bash
# Wait for dialog
sleep 5
# Press Enter to confirm (finds Save dialog automatically)
adom-desktop fusion_send_key '{"key":"enter"}'
```

## Caching Bug Workaround

After saving, exports may produce stale files. Workaround:
1. Close all project tabs: `adom-desktop fusion_close_document '{"save":false}'` (repeat)
2. Reopen the **board** (`.fbrd`, NOT `.fprj` — the project file triggers the multi-design picker): `adom-desktop fusion_open_cloud_file '{"projectName":"Main","fileName":"<name>","fileExtension":"fbrd","folderPath":"<path>"}'`
3. Switch to board view if needed: `adom-desktop fusion_electron_run '{"command":"EDIT .brd"}'`
4. Run the export steps above

## After Export — Hand off to molecule-publish

For a **molecule** (board with MP1-MP4 markers + machine pins), conversion,
packaging, and wiki publish are the **`molecule-publish`** skill's job
(EDA-agnostic; shared with the KiCad and Altium flows). Hand it the bundle:

- `<name>.step` + `<name>.brd` (board) + `<name>.sch` (schematic) + silk PNGs
- extras worth carrying: `<name>.f3d` (irreplaceable native archive),
  `<name>.usdz`, Kitchen Sink outputs (gerbers/BOM/CPL)
- `pin` size (medium|large) and the target slug/org

It runs the OCCT molecule-mode conversion with stats gates (`anchored`,
`footprint_applied`, `contact_z`, `warnings[]`), assembles the component
package, publishes via `adom-wiki`, and verifies `model_3d_path`. Do not
re-implement any of that here. **Never use Fusion's own GLB export for
molecules** — the only GLB in a molecule package is OCCT's.

(Plain chips/PCBs without markers: `molecule-publish` degrades gracefully —
or publish directly with just the STEP and let the wiki's plain conversion
make a viewer GLB.)

### Publish to Hydrogen (live project use)

Hydrogen is where molecules are used in actual projects. This stage is a
**handoff to the `adom-molecule-import` skill** (ships with
`adom/adom-molecule` — install via `adom-wiki pkg install adom/adom-molecule`).
Short form, after the wiki publish above:

```bash
adom-wiki repo clone <owner>/<slug> --dir /tmp/<slug>-import   # authenticated, private-safe
adom-molecule create --owner <hydrogen-owner> --name <name> \
    --glb <name>.glb --brd <name>.brd --no-optimize
```

`--no-optimize` reuses the OCCT-converted GLB — no Blender re-optimization,
no silkscreen needed at import. Only fall back to the legacy
`--usdz/--f3d` optimization path when no GLB exists (and expect the queue).
The molecule lands at `https://hydrogen.adom.inc/<username>/molecules/<name>`.

### Suggested prompt after export

After the export completes, tell the user:

> "All files exported to `<folder>`. Would you like me to:
> 1. **Publish to the Adom Wiki** — creates a molecule reference page with pin map, BOM, and assets
> 2. **Upload to Hydrogen** — makes it available in your Hydrogen projects at `hydrogen.adom.inc/<user>/molecules/<name>`
> 3. **Both**
> 4. **Skip** — just keep the files locally"

## Important Notes

- **Focus stealing:** Steps 3 and 7 switch Fusion workspaces, which steals desktop focus. Warn the user.
- **3D view required for Steps 4-7.** If `fusion_show_3d_board` fails, the user may need to run "Push to 3D PCB" manually from the Design tab.
- **Silkscreen capture** requires the 3D Design view, not PCB Editor. Always do Steps 4-7 after Step 3.
- **pull_file from Google Drive paths** may produce empty files. Use shell_execute + base64 as a workaround if the output folder is on Google Drive.
- **Shell execute needs approval** on the Adom Desktop app for each new script.
- **adom-molecule CLI** installs from the wiki: `adom-wiki pkg install adom/adom-molecule` (also lays down the `adom-molecule-import` skill).

## Related

- `kicad-export-molecule` — same job from KiCad
- `altium-export-molecule` — same job from Altium (via KiCad's importer)
- `adom-molecule-import` — the Hydrogen import half (this skill's final stage)
