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
Preserve BQ independent routing, narration and native copper-retention evidence
a4b7711
1mo ago
"""Native opening tour of the preserved hand-routed reference. No copper mutations."""
import sys,json,time
from pathlib import Path
sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
from call import call
from live_panel import LivePanel
ROOT=Path(__file__).resolve().parent;TAKE=ROOT/(sys.argv[1] if len(sys.argv)>1 else 'reference-tour-03');TAKE.mkdir(exist_ok=False);log=[]
DOCUMENT=sys.argv[2] if len(sys.argv)>2 else 'bq25792-hand-routed-reference'
def invoke(v,a):
t=time.time();r=call(v,a,script_transport=v=='fusion_routing_state');log.append({'verb':v,'args':a,'start':t,'end':time.time(),'result':r});(TAKE/'calls.json').write_text(json.dumps(log,indent=2)+'\n')
if not r.get('success'):raise RuntimeError(str(r))
return r
s=invoke('fusion_routing_state',{'expectDocument':DOCUMENT});assert s['segmentCount']==587 and s['viaCount']==88;(TAKE/'before.json').write_text(json.dumps(s,indent=2)+'\n')
w=invoke('desktop_list_windows',{})['windows'];main=next(w for w in w if w['image']=='Fusion360.exe' and w['owner']==0)
windows=invoke('desktop_list_windows',{})['windows'];palette=next(w for w in windows if w['image']=='Fusion360.exe' and w['title']=='ADOM')
panel=LivePanel(invoke,s['documentName'],TAKE/'panel-events.jsonl',palette['hwnd'])
panel.update(status='Adonis hand-routed reference',detail='Codex Astra in Adom Hydrogen / four-layer BQ25792',connection='BQ25792 charger / 109 components / 50 nets',plan='Four copper layers / 14 Adom machine pins',checks='Original wiki source preserved.\nImported baseline: 1611 errors / 14 warnings.',event='Opening tour',percent=0)
def view(cmd):
source=(ROOT.parents[2]/'rust/bridge/src/routing_script.py').read_text()
script='exec('+repr(source)+')\neditor_identity(app,'+repr(DOCUMENT)+')\napp.executeTextCommand('+repr('Electron.run '+cmd)+")\napp.executeTextCommand('Electron.ImmediateRepaint /full')\nresult={'viewUpdated':True}"
invoke('fusion_run_modeling_script',{'expectDocument':s['documentName'],'script':script})
view('DISPLAY NONE; DISPLAY 1 17 18 20 21; WINDOW (-1mm -1mm) (52mm 28mm);')
records=[]
try:
for name,hwnd in [('board',main['hwnd']),('panel',palette['hwnd'])]:
r=invoke('desktop_record_window_start',{'hwnd':hwnd,'fps':30,'audio':False,'maxDurationMs':120000,'reason':'Record the original hand-routed BQ25792 board tour'});records.append((name,r));(TAKE/(name+'-start.json')).write_text(json.dumps(r,indent=2)+'\n')
time.sleep(3)
for title,cmd,detail in [
('Top copper: power stage','DISPLAY NONE; DISPLAY 1 17 18 20 21; WINDOW (26mm 7mm) (46mm 22mm);','Charger IC, inductor and nearby capacitors'),
('Bottom copper','DISPLAY NONE; DISPLAY 16 17 18 20 22; WINDOW (-1mm -1mm) (52mm 28mm);','Hand-routed bottom traces and power copper'),
('Inner layer 2','DISPLAY NONE; DISPLAY 2 17 18 20; WINDOW (-1mm -1mm) (52mm 28mm);','Original internal copper layer'),
('Original board overview','DISPLAY NONE; DISPLAY 1 16 17 18 20 21; WINDOW (-1mm -1mm) (52mm 28mm);','Next: independent routing on an isolated stripped copy')]:
panel.update(status=title,plan=detail,event='Navigate original reference');view(cmd);time.sleep(3)
after=invoke('fusion_routing_state',{'expectDocument':s['documentName']});assert after['segments']==s['segments'] and after['vias']==s['vias'];(TAKE/'after.json').write_text(json.dumps(after,indent=2)+'\n')
finally:
paths=[]
for name,r in records:
stop=invoke('desktop_record_window_stop',{'recordingId':r['recordingId']});(TAKE/(name+'-stop.json')).write_text(json.dumps(stop,indent=2)+'\n');paths.append(stop['path'])
if paths:invoke('pull_file',{'filePaths':paths,'saveTo':str(TAKE)})
print('Reference tour recorded; copper unchanged',flush=True)