文件
phonerail/.claude/_poll_clean.py
T

15 行
647 B
Python

import time, sys
sys.path.insert(0,'.')
from eda import run
JS = """
const left={}; for (const l of await eda.pcb_PrimitiveLine.getAll()) { const L=l.getState_Layer(); if([1,2,15,16].includes(L)) left[L]=(left[L]||0)+1; }
return {lines:left, vias:(await eda.pcb_PrimitiveVia.getAll()).length, pours:(await eda.pcb_PrimitivePour.getAll()).length};
"""
prev=None
for i in range(40):
r=run(JS, timeout=60)
res=r.get('result'); print(time.strftime('%H:%M:%S'), res, flush=True)
if res and not res['lines'] and res['vias']==0 and res['pours']==0: print('CLEAN'); break
if res==prev: print('stalled'); break
prev=res; time.sleep(20)