ShiboSoftwareDev/msp-exp430fr5994

This code defines and renders electronic components such as a 4MHz ceramic resonator and various microcontroller chips with their physical pin layouts footprints, 3D models, and associated metadata.

Version
1.0.0
License
unset
Stars
0

render-artifacts.ts

import { readFileSync, writeFileSync } from "node:fs"
import { Resvg } from "@resvg/resvg-js"
import { convertCircuitJsonToStackedSchematicSheetsSvg } from "circuit-to-svg"

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

const stackedSchematic = convertCircuitJsonToStackedSchematicSheetsSvg(
  circuitJson,
)
writeFileSync("dist/schematic-stacked.svg", stackedSchematic)

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