原理图/PCB 已在 EasyEDA 里做到 12 页跨页 0 漏接,固件刚完成骨架包 A1。 这次是把已有的一切一次性纳入版本控制,没有改动任何设计内容。 纳入: - 设计与需求文档、PROGRESS.md、小米8 参考原理图 PDF 与追脚脚本 - .claude/ 下的 EasyEDA 桥接工具链与几何/网表缓存(eda-parts.json、 pcb-parts.json、pcb-pads.json、p2-ch1.json 等,是重画各页的唯一事实来源) - 117 张验证截图(本项目所有方向问题都是靠人眼看截图发现的,属于证据不是垃圾) - firmware/ 的 A1 骨架与 site/ 文档站源码 .gitignore 排除:构建产物(firmware/build、host/build、sdkconfig)、 site/node_modules、__pycache__、桥接日志 _bridge.log、脚本自标的 *.stale。 .gitattributes 默认 `* -text`:现有 .py/.json 大多是 CRLF,原样存, 不让 git 重写行尾。唯一例外是 *.sh 强制 LF —— 带 \r 的 shell 脚本 bash 跑不了。 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QYuExfgyYa6DzRRcUso8M8
79 行
2.9 KiB
Python
79 行
2.9 KiB
Python
# -*- coding: utf-8 -*-
|
||
u"""下板 PCB1:拆掉全部铜(导线 / 过孔 / 铺铜边框),只留板框、定位孔与元件。
|
||
|
||
2026-09-06 两板拆分之后,板上那 5813 条线 / 1208 个孔全是**单板时代**自动布线的结果,
|
||
网络表已经换过(删 70 件 / 加 17 件),布局也整块重排 —— 一条都留不得。
|
||
|
||
⚠️ 保留:layer 11 板框、layer 12 的 M3 焊盘、丝印。
|
||
用法: /c/Python314/python .claude/pcb1_clear.py [--push]
|
||
"""
|
||
import json, os, sys
|
||
|
||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||
sys.path.insert(0, HERE)
|
||
from eda import run
|
||
|
||
PCB = '7e9415a16a909c51'
|
||
COPPER = (1, 2, 15, 16)
|
||
|
||
|
||
def call(body, timeout=600):
|
||
r = run("await eda.dmt_EditorControl.openDocument('%s');"
|
||
"await new Promise(r=>setTimeout(r,1500));" % PCB + body, timeout=timeout)
|
||
if not r.get('success'):
|
||
sys.exit(json.dumps(r, ensure_ascii=False)[:600])
|
||
return r['result']
|
||
|
||
|
||
COUNT = """
|
||
const L = {}, out = {vias: 0, pours: 0, polylines: {}};
|
||
for (const l of await eda.pcb_PrimitiveLine.getAll()) L[l.layer] = (L[l.layer] || 0) + 1;
|
||
out.lines = L;
|
||
out.vias = (await eda.pcb_PrimitiveVia.getAll()).length;
|
||
out.pours = (await eda.pcb_PrimitivePour.getAll()).length;
|
||
for (const p of await eda.pcb_PrimitivePolyline.getAll())
|
||
out.polylines[p.layer] = (out.polylines[p.layer] || 0) + 1;
|
||
out.fills = (await eda.pcb_PrimitiveFill.getAll()).length;
|
||
return out;
|
||
"""
|
||
|
||
|
||
def show(tag):
|
||
r = call(COUNT)
|
||
print(u'%s 导线 %s / 过孔 %d / 铺铜边框 %d / 多段线 %s / 填充 %d'
|
||
% (tag, r['lines'], r['vias'], r['pours'], r['polylines'], r['fills']))
|
||
return r
|
||
|
||
|
||
def wipe():
|
||
total = {'lines': 0, 'vias': 0, 'pours': 0}
|
||
for _ in range(30): # 一次删太多会超时,分批删到删不动为止
|
||
r = call("""
|
||
const COPPER = %s;
|
||
let nl = 0, nv = 0, np = 0;
|
||
for (const l of await eda.pcb_PrimitiveLine.getAll()) {
|
||
if (COPPER.includes(l.layer) && nl < 1500) { await eda.pcb_PrimitiveLine.delete(l.primitiveId); nl++; }
|
||
}
|
||
for (const v of await eda.pcb_PrimitiveVia.getAll()) {
|
||
if (nv < 800) { await eda.pcb_PrimitiveVia.delete(v.primitiveId); nv++; }
|
||
}
|
||
for (const p of await eda.pcb_PrimitivePour.getAll()) { await eda.pcb_PrimitivePour.delete(p.primitiveId); np++; }
|
||
return {nl, nv, np};
|
||
""" % json.dumps(list(COPPER)))
|
||
for k, v in (('lines', r['nl']), ('vias', r['nv']), ('pours', r['np'])):
|
||
total[k] += v
|
||
print(u' 删 导线 %d / 过孔 %d / 铺铜 %d' % (r['nl'], r['nv'], r['np']))
|
||
if r['nl'] == 0 and r['nv'] == 0 and r['np'] == 0:
|
||
break
|
||
call("await eda.pcb_Document.save(); return 1;")
|
||
print(u'共删 导线 %(lines)d / 过孔 %(vias)d / 铺铜边框 %(pours)d' % total)
|
||
|
||
|
||
if __name__ == '__main__':
|
||
show(u'拆之前:')
|
||
if '--push' in sys.argv:
|
||
wipe()
|
||
show(u'拆之后:')
|
||
else:
|
||
print(u'(只统计。要真的拆加 --push)')
|