app
Fusion - the Fusion 360 Bridge
Public Made by Adomby adom
Drive Autodesk Fusion 360 from the cloud via Adom Bridge: component libraries, IPC package generation, board layout, exports (STEP/Gerbers/BOM/CPL), fast APS cloud search, and parametric modeling.
master
John Lauer
Publish thermal bottleneck planner, accepted candidate, analysis and native recording scripts
0049da5
29d ago
import sys,json
from pathlib import Path
P=Path(__file__).resolve().parent;sys.path.insert(0,str(P.parent/'thermal'));from transport import call,execute,HOST_OUTPUT
name=sys.argv[1] if len(sys.argv)>1 else 'candidate-01';out=P/name;file=out/'bq25792-thermal-reroute.brd';doc='bq25792-thermal-reroute'
r=call('send_files',{'filePaths':[str(file)],'dest':HOST_OUTPUT+'/'+name,'reason':'Validate a separate thermal bottleneck routing candidate'});assert r.get('success'),r
r=call('fusion_open_board',{'filePath':r['destinationPaths'][0]});assert r.get('success'),r
try:
r=execute(doc,"app.executeTextCommand('Electron.run RATSNEST;')\ns=handle(app,{'expectDocument':target.name},'routing_state')\nresult=handle(app,{'expectDocument':target.name,'boardId':s['boardId'],'expectedRevision':s['revision']},'routing_drc')")
(out/'native-drc.json').write_text(json.dumps(r,indent=2));print(r['drc'],flush=True)
host=HOST_OUTPUT+'/'+name+'/filled.brd'
r=execute(doc,"root,b,m=snapshot(app,{'expectDocument':target.name})\nET.ElementTree(root).write("+repr(host)+",encoding='utf-8',xml_declaration=True)\napp.executeTextCommand("+repr('Document.CopyToDesktop '+host+'.fbrd')+")\nresult={'bytes':Path("+repr(host)+").stat().st_size}")
assert r['bytes']>100
r=call('pull_file',{'filePaths':[host],'saveTo':str(out)});assert r.get('success'),r
if not (out/'filled.brd').exists():
import shutil
shutil.copy2(Path('/mnt/c')/str(out).lstrip('/')/'filled.brd',out/'filled.brd')
finally:
r=call('fusion_close_document',{'name':doc,'save':False});assert r.get('success'),r