17 行
810 B
Python
17 行
810 B
Python
import sys, json, re
|
|
sys.argv.append('--pcb2'); sys.path.insert(0,'.')
|
|
import drc_read as D
|
|
r = D.call(D.JS_TREE % (D.PCB, u''))
|
|
tree = r['tree']
|
|
conn = tree.split(u'连接性错误',1)[1] if u'连接性错误' in tree else ''
|
|
print('CONN TREE:', conn[:600])
|
|
cats = re.findall(r'([^()\d][^()]*?) \((\d+)\)', conn)
|
|
for name, n in cats[:6]:
|
|
name=name.strip()
|
|
d = D.call(D.JS_DETAIL % json.dumps(u'%s (%s)' % (name, n), ensure_ascii=False))
|
|
txt = d.get('detail','').split(u'input::-webkit')[0]
|
|
rows = re.findall(r'(\d+)(间距错误|物理错误|制造错误|连接性错误)(.+?)(?=\d+(?:间距错误|物理错误|制造错误|连接性错误)|$)', txt)
|
|
print(u'── %s (%s) ──' % (name, n))
|
|
for idx, kind, body in rows[:25]:
|
|
print(u' %s. %s' % (idx, body.strip()[:160]))
|