From 2e433fcd0d1afadd8ab786dd30d7d4546bdee43d Mon Sep 17 00:00:00 2001 From: Louis Date: Wed, 11 Nov 2026 10:08:41 +0100 Subject: hw-toolchain: placer, routers and KiCad helpers for agent-driven hardware work Rust placer (simulated annealing) and negotiated-congestion router for 2-layer KiCad boards, pnr.sh to place, route, DRC-check and install candidates, Python KiCad helpers, repo conventions (AGENTS.md) and the tool documentation under knowledge/. Konnect (KiCad MCP, AGPL) as a submodule. Co-Authored-By: Claude Opus 5.5 --- tools/kicad_env.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tools/kicad_env.sh (limited to 'tools/kicad_env.sh') diff --git a/tools/kicad_env.sh b/tools/kicad_env.sh new file mode 100644 index 0000000..f4947f0 --- /dev/null +++ b/tools/kicad_env.sh @@ -0,0 +1,22 @@ +# Sourced by the shell scripts in tools/: sets KPY (a Python that can `import pcbnew`) and +# KC (kicad-cli). Set either in the environment to override the detection. +# +# KICAD_PYTHON=/usr/bin/python3 KICAD_CLI=/usr/bin/kicad-cli sh tools/pnr.sh run board_dir + +_mac=/Applications/KiCad/KiCad.app/Contents +if [ -z "$KICAD_PYTHON" ]; then + if [ -x "$_mac/Frameworks/Python.framework/Versions/Current/bin/python3" ]; then + KICAD_PYTHON=$_mac/Frameworks/Python.framework/Versions/Current/bin/python3 + elif [ -x "$_mac/Frameworks/Python.framework/Versions/3.9/bin/python3" ]; then + KICAD_PYTHON=$_mac/Frameworks/Python.framework/Versions/3.9/bin/python3 + else + KICAD_PYTHON=python3 # Linux: the system Python has pcbnew when KiCad is installed from packages + fi +fi +if [ -z "$KICAD_CLI" ]; then + if command -v kicad-cli >/dev/null 2>&1; then KICAD_CLI=kicad-cli + else KICAD_CLI=$_mac/MacOS/kicad-cli; fi +fi +KPY=$KICAD_PYTHON +KC=$KICAD_CLI +export KPY KC -- cgit v1.3