# -*- coding: utf-8 -*- u"""截 PCB 的图:python .claude/shot_pcb.py [pcbUuid]""" import base64, io, os, sys sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from eda import run out = sys.argv[1] uuid = sys.argv[2] if len(sys.argv) > 2 else '7e9415a16a909c51' JS = u""" const sleep=ms=>new Promise(r=>setTimeout(r,ms)); await eda.dmt_EditorControl.openDocument('%s'); await sleep(2000); await eda.dmt_EditorControl.zoomToAllPrimitives(); await sleep(2000); const img = await eda.dmt_EditorControl.getCurrentRenderedAreaImage(); const bytes = new Uint8Array(await new Response(img).arrayBuffer()); let s=''; for (let i=0;i