krishnax12/watchy-eink-smartwatch
Unfinished prototype (not production-ready): 4 native DRC errors, 2 display-flex intersections, and missing antenna radiator copper remain
- Version
- 1.2.7
- License
- MIT
- Stars
- 1
scripts/render-pcb.ts
import { Resvg } from "@resvg/resvg-js";
import type { AnyCircuitElement } from "circuit-json";
import { convertCircuitJsonToPcbSvg } from "circuit-to-svg";
const circuitPath = process.argv[2] ?? "dist/index/circuit.json";
const outputPrefix = process.argv[3] ?? "dist/index/pcb";
const circuit: AnyCircuitElement[] = await Bun.file(circuitPath).json();
for (const layer of ["top", "bottom"] as const) {
const svg = convertCircuitJsonToPcbSvg(circuit, {
layer,
width: 1400,
height: 1800,
shouldDrawErrors: true,
shouldDrawRatsNest: true,
});
await Bun.write(`${outputPrefix}-${layer}.svg`, svg);
await Bun.write(
`${outputPrefix}-${layer}.png`,
new Resvg(svg).render().asPng(),
);
}