main
John Lauer
Adopt native-reviewed marked IC models and retain shared catalog repairs with inspection clip
d7a7dc9
"""Show an isolated library-review board for recording, without replacing the project board."""
from pathlib import Path
import json,subprocess,zipfile,base64,shutil
root=Path(__file__).resolve().parents[1];out=root/'checkpoints/marked-ic-review';remote='C:/Users/john/adom-projects/adom-custom-electronic-load/review/marked-ic-candidate'
def call(v,a,label):
p=subprocess.run(['adom-bridge','--target','AdomLapper','--ai-thread','adom-custom-load',v,json.dumps(a)],capture_output=True,text=True);d=json.loads(p.stdout);(out/(label+'.json')).write_text(json.dumps(d,indent=2)+'\n');assert p.returncode==0 and d.get('success',d.get('ok',True)) and not d.get('errors') and d.get('exitCode',0)==0,d;return d
# Candidate already contains all selected models.
zpath=out/'viewer-inputs.zip'
with zipfile.ZipFile(zpath,'w',zipfile.ZIP_DEFLATED) as z:
for p in [out/'marked-ic-candidate.kicad_pcb',out/'marked-ic-candidate.kicad_pro',out/'marked-ic-candidate.kicad_dru',out/'fp-lib-table']+list((out/'lib').rglob('*.kicad_mod'))+list((out/'3d').glob('*.step')):z.write(p,p.relative_to(out))
call('send_files',{'filePaths':[str(zpath)],'dest':remote+'/','reason':'Prepare isolated library candidate for requested engineering video'},'viewer-send')
script=f"$ErrorActionPreference='Stop'\nExpand-Archive -LiteralPath '{remote}/viewer-inputs.zip' -DestinationPath '{remote}' -Force\n"
call('run_script',{'interpreter':'powershell','scriptB64':base64.b64encode(script.encode()).decode(),'reason':'Unpack task-owned review assets without changing project board'},'viewer-unpack')
r=call('kicad_open_board',{'filePath':remote+'/marked-ic-candidate.kicad_pcb','foreground':False},'viewer-open');print(json.dumps({k:v for k,v in r.items() if k!='output'})[:4200])