seveibar/pd-dual-stepper-controller

Bottom-side PCB silkscreen artwork consisting of embedded mirrored TS Circuit SVG logos, with via-clearance-aware lower-board placement.

Version
0.1.0
License
unset
Stars
0

scripts/render-pcb.ts

import { readFileSync, writeFileSync } from "node:fs";
import { convertCircuitJsonToPcbSvg } from "circuit-to-svg";
import { Resvg } from "@resvg/resvg-js";
const json = JSON.parse(readFileSync(process.argv[2] ?? "dist/index/circuit.json", "utf8"));
for (const layer of ["top", "inner1", "inner2", "bottom"] as const) {
  const svg = convertCircuitJsonToPcbSvg(json, {
    layer, width: 1400, matchBoardAspectRatio: true,
    shouldDrawErrors: true, showErrorsInTextOverlay: true,
  });
  writeFileSync(`dist/pcb-${layer}.svg`, svg);
  writeFileSync(`dist/pcb-${layer}.png`, new Resvg(svg).render().asPng());
}