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/export-dual.ts

import { readFileSync, writeFileSync } from "node:fs";
const mode = process.argv[2] ?? "routed";
const pcb=JSON.parse(readFileSync(`dist/dual/${mode}.json`,"utf8"));
const schematic=JSON.parse(readFileSync("dist/dual/schematic.json","utf8"));
const names = (j:any[])=>j.filter(e=>e.type==="source_component").map(e=>[e.source_component_id,e.name]);
if(JSON.stringify(names(pcb))!==JSON.stringify(names(schematic)))throw Error("Schematic and PCB component IDs differ; rebuild both from the same source.");
writeFileSync("dist/dual/circuit.json",JSON.stringify([...pcb,...schematic.filter((e:any)=>e.type.startsWith("schematic_"))],null,2));
console.log("Combined PCB and schematic JSON exported.");