Files
SN-L00/hardware/kicad/scripts/route.sh
T
florian.berthold 1ae49dc1bb Add 8HP layout with fully automated routing pipeline
- Update PCB to 8HP format (40x100mm) with v2 component placement
- Add automated routing scripts (autoroute.py runs full pipeline headlessly)
- Update panel spec and SVG for 8HP dimensions
- Board routes in <1 second with 0 unconnected pads

Scripts:
- autoroute.py: Full CLI pipeline (place → export → route → import → DRC)
- autoroute_full.py: Same pipeline for KiCad scripting console
- place_8hp.py: Component placement only
- route.sh/freeroute.sh: Routing helpers
2026-01-23 07:59:50 +01:00

98 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
# Full routing and DRC workflow
# Usage: ./scripts/route.sh
#
# Prerequisites:
# 1. Run place_8hp.py in KiCad scripting console
# 2. Export DSN: File → Export → Specctra DSN
# 3. Save PCB
set -e
cd "$(dirname "$0")/.."
PCB_FILE="SN-L00.kicad_pcb"
DSN_FILE="SN-L00.dsn"
SES_FILE="SN-L00.ses"
DRC_FILE="DRC.rpt"
FREEROUTING_JAR="/tmp/freerouting.jar"
FREEROUTING_URL="https://github.com/freerouting/freerouting/releases/download/v2.0.1/freerouting-2.0.1.jar"
echo "============================================"
echo "SN-L00 Routing Pipeline"
echo "============================================"
# Check DSN exists
if [ ! -f "$DSN_FILE" ]; then
echo ""
echo "ERROR: $DSN_FILE not found!"
echo ""
echo "In KiCad:"
echo " 1. Run: exec(open('scripts/place_8hp.py').read())"
echo " 2. Save: Ctrl+S"
echo " 3. Export: File → Export → Specctra DSN"
echo ""
exit 1
fi
# Download Freerouting if needed
if [ ! -f "$FREEROUTING_JAR" ]; then
echo "[1/3] Downloading Freerouting..."
curl -L -o "$FREEROUTING_JAR" "$FREEROUTING_URL"
else
echo "[1/3] Freerouting ready"
fi
# Run Freerouting
echo "[2/3] Running Freerouting..."
java -jar "$FREEROUTING_JAR" \
-de "$DSN_FILE" \
-do "$SES_FILE" \
-mp 200 \
-mt 1 \
-oit 2>&1 | grep -E "(completed|INFO.*Auto|ERROR)" || true
if [ ! -f "$SES_FILE" ]; then
echo "ERROR: Routing failed - no SES file created"
exit 1
fi
echo "[3/3] Running DRC..."
echo ""
echo "============================================"
echo "In KiCad: File → Import → Specctra Session"
echo "Select: $SES_FILE"
echo "Then save (Ctrl+S)"
echo "============================================"
echo ""
echo "Waiting for you to import SES and save..."
read -p "Press Enter when done: "
# Run DRC from CLI
kicad-cli pcb drc \
--severity-all \
--units mm \
--schematic-parity \
-o "$DRC_FILE" \
"$PCB_FILE" 2>&1
echo ""
echo "============================================"
echo "DRC Results:"
echo "============================================"
grep -E "^(Found|\*\*)" "$DRC_FILE" || cat "$DRC_FILE"
echo ""
# Count errors vs warnings
ERRORS=$(grep -c "error$" "$DRC_FILE" 2>/dev/null || echo "0")
WARNINGS=$(grep -c "warning$" "$DRC_FILE" 2>/dev/null || echo "0")
echo "Summary: $ERRORS errors, $WARNINGS warnings"
if [ "$ERRORS" -eq 0 ]; then
echo ""
echo "✓ No DRC errors - ready for manufacturing!"
else
echo ""
echo "Fix errors and re-run: ./scripts/route.sh"
fi