R2:底板 / 刀片布局布线脚本、快照、截图与规划文档更新(含外壳、打印件、布线归档)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
这个提交包含在:
zhou yang
2026-10-04 19:24:45 +08:00
共同撰写人 Claude Opus 5.5
父节点 cd01640c40
当前提交 cf7cc9cf90
共修改 759 个文件,包含 76962 行新增和 5299 行删除
+45
查看文件
@@ -0,0 +1,45 @@
#!/usr/bin/env python3
"""把 EasyEDA 工程的每一页原理图源码 dump 到 .claude/eda_src/。
源码是 EasyEDA Pro 的行式 DSL:每条记录 `{header}||{body}|`,换行分隔。
这是转 KiCad 的唯一权威输入,缓存 json 只作交叉校验。"""
import json, os, sys, time
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import eda
ROOT = os.path.dirname(os.path.abspath(__file__))
OUT = os.path.join(ROOT, "eda_src")
PARTS = json.load(open(os.path.join(ROOT, "eda-parts.json"), encoding="utf-8"))
JS = '''
await eda.dmt_EditorControl.openDocument("%s");
await new Promise(r=>setTimeout(r,1500));
const info = await eda.sch_Document?.getCurrentSchematicPageInfo?.();
const s = await eda.sys_FileManager.getDocumentSource();
return { uuid: info?.uuid ?? null, src: s };
'''
def main():
os.makedirs(OUT, exist_ok=True)
pages = PARTS["pages"]
manifest = {}
for name, uuid in pages.items():
r = eda.run(JS % uuid, timeout=180)
if not r.get("success"):
print(f" !! {name} 失败: {json.dumps(r, ensure_ascii=False)[:300]}")
sys.exit(1)
res = r["result"]
# 桥接打的是"当前打开的那一页",必须确认真的切过去了(skill §9l)
if res.get("uuid") and res["uuid"] != uuid:
print(f" !! {name} 切页没生效: 期望 {uuid} 实得 {res['uuid']}")
sys.exit(1)
src = res["src"]
path = os.path.join(OUT, f"{name}.esrc")
open(path, "w", encoding="utf-8", newline="").write(src)
manifest[name] = {"uuid": uuid, "bytes": len(src), "lines": src.count("\n") + 1}
print(f" {name:12s} {uuid} {len(src):>8,d} B {manifest[name]['lines']:>5,d} 行")
json.dump(manifest, open(os.path.join(OUT, "_manifest.json"), "w", encoding="utf-8"),
ensure_ascii=False, indent=1)
print(f"\n共 {len(manifest)} 页,{sum(m['bytes'] for m in manifest.values()):,d} B -> {OUT}")
if __name__ == "__main__":
main()