ShiboSoftwareDev/msp-exp430g2et

This circuit integrates a 4MHz crystal resonator, various resistors and capacitors for power management and filtering, a microcontroller (MSP430F5528), and multiple connectors and test points to enable USB communication, programming, and system monitoring with shielding and grounding.

Version
1.0.2
License
unset
Stars
0

render-artifacts.ts

PCBPCB preview for render-artifacts.ts
import { readFileSync, writeFileSync } from "node:fs"
import { Resvg } from "@resvg/resvg-js"
import {
  convertCircuitJsonToAssemblySvg,
  convertCircuitJsonToPcbSvg,
  convertCircuitJsonToStackedSchematicSheetsSvg,
} from "circuit-to-svg"

const circuitJson = JSON.parse(
  readFileSync("dist/index/circuit.json", "utf8"),
)

writeFileSync("dist/pcb.svg", convertCircuitJsonToPcbSvg(circuitJson))
writeFileSync(
  "dist/assembly.svg",
  convertCircuitJsonToAssemblySvg(circuitJson),
)
writeFileSync(
  "dist/schematic-stacked.svg",
  convertCircuitJsonToStackedSchematicSheetsSvg(circuitJson),
)

for (const artifact of ["pcb", "assembly", "schematic-stacked"]) {
  const png = new Resvg(readFileSync(`dist/${artifact}.svg`), {
    fitTo: { mode: "width", value: 2400 },
    background: "white",
  })
    .render()
    .asPng()
  writeFileSync(`dist/${artifact}.png`, png)
}