pixalynx/usbc-led-switch

A single-sided USB-C–powered LED light board with a latching pushbutton, 100 Ω current-limiting resistor, white 5730 SMD LED, and dual 5.1 kΩ USB-C CC pull-down resistors.

Version
0.0.1
License
unset
Stars
0

scripts/export-makera.sh

#!/usr/bin/env bash
# Export the files MakeraCAM needs into fab/gerbers-makera/:
#   F_Cu.gbr        copper (top), pour fractured to dark polarity only (scripts/flatten_gerber.py)
#   Edge_Cuts.gbr   board outline
#   holes_pth.drl   USB-C shell legs (1.3 / 1.1 mm) and switch-tab anchor holes (1.0 mm)
#   holes_npth.drl  USB-C locating pegs (0.8 mm)
# Builds in a temp dir and copies finished files only, so a running `tsci dev` never sees files vanish.
set -euo pipefail
cd "$(dirname "$0")/.."

tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT

npx tsci export index.circuit.tsx -f gerbers -o "$tmp/gerbers.zip" >/dev/null
unzip -q "$tmp/gerbers.zip" -d "$tmp/g"
python3 scripts/flatten_gerber.py "$tmp/g/F_Cu.gbr" "$tmp/F_Cu.gbr"

out=fab/gerbers-makera
mkdir -p "$out"
cp "$tmp/F_Cu.gbr" "$out/F_Cu.gbr"
cp "$tmp/g/Edge_Cuts.gbr" "$out/Edge_Cuts.gbr"
cp "$(ls "$tmp"/g/drill-*.drl | head -1)" "$out/holes_pth.drl"
cp "$tmp/g/drill_npth.drl" "$out/holes_npth.drl"

npx tsci export index.circuit.tsx -f pcb-png -o "$tmp/pcb.png" >/dev/null
cp "$tmp/pcb.png" fab/pcb-preview.png
npx tsci export index.circuit.tsx -f schematic-svg -o "$tmp/schematic.svg" >/dev/null
cp "$tmp/schematic.svg" fab/schematic.svg

ls -l "$out" fab/pcb-preview.png fab/schematic.svg