ShiboSoftwareDev/MSP-EXP430FR2433

This code defines a 4 MHz surface-mount quartz crystal resonator with 15pF load capacitance and ground pin configuration, including PCB footprint and 3D model details.

Version
1.0.1
License
unset
Stars
0

scripts/export-latest-gerbers.mjs

import { mkdir, readFile, writeFile } from "node:fs/promises"
import {
  convertSoupToExcellonDrillCommandLayers,
  convertSoupToGerberCommands,
  stringifyExcellonDrill,
  stringifyGerberCommandLayers,
} from "circuit-json-to-gerber"

const inputPath = process.argv[2] ?? "dist/index/circuit.json"
const outputDirectory = process.argv[3] ?? "fabrication/gerbers"
const circuitJson = JSON.parse(await readFile(inputPath, "utf8"))

const gerberLayers = stringifyGerberCommandLayers(
  convertSoupToGerberCommands(circuitJson),
)
const drillLayers = convertSoupToExcellonDrillCommandLayers({ circuitJson })

await mkdir(outputDirectory, { recursive: true })

for (const [filename, contents] of Object.entries(gerberLayers)) {
  await writeFile(`${outputDirectory}/${filename}.gbr`, contents)
}

for (const [filename, commands] of Object.entries(drillLayers)) {
  await writeFile(
    `${outputDirectory}/${filename}`,
    stringifyExcellonDrill(commands),
  )
}

console.log(
  `Exported ${Object.keys(gerberLayers).length} Gerber and ${Object.keys(drillLayers).length} drill layers to ${outputDirectory}`,
)