AnasSarkiz/ble-pedometer
This code defines and configures various electronic hardware components such as surface-mount resistors, crystals, diodes, transistors, connectors, and switches with their physical footprints, schematic symbols, and 3D CAD models for PCB assembly.
- Version
- 1.0.7
- License
- unset
- Stars
- 0
scripts/export-schematics.ts
import { Circuit } from "tscircuit"
import { renderSchematicSheetSvg } from "../lib/render-schematic-sheet-svg"
import Board from "../index.circuit"
const circuit = new Circuit()
// This command produces schematic review sheets only, never fabrication output.
circuit.pcbRoutingDisabled = true
circuit.add(Board())
await circuit.renderUntilSettled()
const circuitJson = circuit.getCircuitJson()
const sheets = circuitJson.filter((element) => element.type === "schematic_sheet")
for (const sheet of sheets) {
if (!sheet.name) throw new Error("Every review sheet must have a name")
const svg = renderSchematicSheetSvg(circuitJson, sheet.schematic_sheet_id)
const outputPath = `dist/schematics/${sheet.name}.svg`
await Bun.write(outputPath, svg)
console.log(`${sheet.name}: ${outputPath}`)
}