hrithik18k/open-ring-flex

A flexible wearable PCB integrating inductive battery charging, BLE control with SPI flash and 32 MHz crystal, SAM L10 capacitive touch/wear sensing, haptic MOSFET drive with a large capacitor bank, RF antenna matching, and SWD programming/test connectors.

Version
1.0.4
License
CC-BY-NC-SA-4.0
Stars
0

scripts/extract-netlist.ts

import { readFileSync, writeFileSync } from "node:fs"
// Input is the JSON representation emitted by altiumts parseAltiumFile.
// Supply the extracted binary-board JSON explicitly; never use a machine-specific path.
const input = process.argv[2]
if (!input) throw new Error("Usage: bun scripts/extract-netlist.ts <parsed-altium-pcb.json>")
const d = JSON.parse(readFileSync(input, "utf8"))
const nets = d.nets.map((net: any, i: number) => ({
  name: net.NAME,
  pins: d.pads.filter((pad: any) => +pad.NET === i && +pad.COMPONENT !== 65535)
    .map((pad: any) => ({ref: d.components[+pad.COMPONENT].SOURCEDESIGNATOR, pin: pad.NAME})),
}))
writeFileSync("source-data/original-netlist.json", JSON.stringify(nets, null, 2))