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
"""Compose real native window captures; retain edit provenance and honest captions."""
import json,subprocess,sys,math
from pathlib import Path
ROOT=Path(__file__).resolve().parent
sys.path.insert(0,str(ROOT.parent/'crossbar'))
from render_crossbar import HEADER,stamp
OUT=ROOT/'video';OUT.mkdir(exist_ok=True)
def probe(p):return json.loads(subprocess.check_output(['ffprobe','-v','error','-show_streams','-of','json',str(p)]))['streams'][0]
def run(args):subprocess.run(['ffmpeg','-hide_banner','-loglevel','error','-threads','4',*args],check=True)
for speed in [3,1]:
phases=[];cursor=0
specs=[('reference-tour-06',[[1,10],[23,27],[40,44],[58,61]],1,'Adonis original: 109 components / 50 nets / 4 layers / 587 segments / 88 vias'),('strip-take-02',[[4.4,7.4],[20.6,23.5]],1,'RIPUP on all four layers: traces and vias removed. Clean input also removes 38 old pours.')]
specs.append(('live-take-02',[[1,3]],1,'Clean starting copy: 0 traces / 0 vias / 0 pours. Original pad placements and netlist retained.'))
for n in ['02','03','06','05']:
d=ROOT/('live-take-'+n);specs.append((d.name,json.loads((d/'motion.json').read_text())['intervals'],speed,'Astra-calculated paths: native LINE +0 and VIA via fusion_run_modeling_script'))
d=ROOT/'live-take-05';b=next(d.glob('window-8916576-*.mp4'));dur=float(probe(b)['duration']);specs.append((d.name,[[dur-5,dur-1]],1,'Native check: 0 airwires / 0 warnings / 0 new errors / 1 unchanged placement error'))
for i,(name,intervals,rate,caption) in enumerate(specs):
d=ROOT/name;b=next(d.glob('window-8916576-*.mp4'));p=next(x for x in d.glob('window-*.mp4') if x!=b);bi,pi=probe(b),probe(p)
starts=[x['start'] for x in json.loads((d/'calls.json').read_text()) if x['verb']=='desktop_record_window_start'];off=round((starts[1]-starts[0])*30)
ranges=[]
for a,z in intervals:
lo=max(off,round(a*30));hi=min(int(bi['nb_frames']),int(pi['nb_frames'])+off,round(z*30))
if hi>lo:ranges.append([lo,hi])
frames=sum(z-a for a,z in ranges);duration=math.ceil(frames/rate)/30
def select(offset):return "select='"+'+'.join(f'gte(n,{a-offset})*lt(n,{z-offset})' for a,z in ranges)+f"',setpts=N/(30*TB)/{rate},fps=30"
ph=min(645,pi['height']);f=f'[0:v]{select(0)},crop=1970:1440:0:100,scale=1350:900:force_original_aspect_ratio=decrease,pad=1350:900:(ow-iw)/2:(oh-ih)/2:color=0x0a0f13,setsar=1[b];[1:v]{select(off)},crop=570:{ph}:0:0,pad=570:900:0:0:color=0x0a0f13,setsar=1[p];[b][p]hstack=shortest=1,pad=1920:1080:0:110:color=0x0a0f13[v]'
key='empty' if i==2 else str(i if i<2 else i-1)
dest=OUT/f'phase-{speed}-{key}.mp4'
if not dest.exists():run(['-i',str(b),'-i',str(p),'-filter_complex_threads','2','-filter_complex',f,'-map','[v]','-an','-c:v','libx264','-threads','4','-preset','fast','-crf','18','-pix_fmt','yuv420p','-y',str(dest)])
actual=float(probe(dest)['duration']);phases.append(dict(source=name,board=str(b),palette=str(p),offsetFrames=off,frameRangesEndExclusive=ranges,speed=rate,start=cursor,end=cursor+actual,caption=caption,file=str(dest)));cursor+=actual;print(speed,i,actual,flush=True)
duration=cursor+5;events=[]
def txt(a,b,s):events.append(f'Dialogue: 0,{stamp(a)},{stamp(b)},Main,,0,0,0,,{s}')
txt(0,duration,r'{\an7\pos(30,20)\fs36\b1\c&H00E5CF65&}CODEX ASTRA IN ADOM HYDROGEN / BQ25792 IN FUSION')
txt(0,duration,r'{\an7\pos(30,70)\fs25}Original preserved. Paths calculated before capture, from pads and nets. No external router.')
txt(0,duration,r'{\an7\pos(1370,780)\fs25\c&H00E5CF65&}COMPARISON CONDITIONS')
txt(0,duration,r'{\an7\pos(1370,822)\fs23}DRC comparison copies disable the\Nsource all-object same-net clearance rule.\NDifferent-net clearance rules preserved.\NPower / thermal review remains.\NRecorded in verified takes; waits removed.')
for x in phases:
txt(x['start'],x['end'],r'{\an2\pos(960,1055)\fs28}'+x['caption'])
txt(x['start'],x['end'],r'{\an9\pos(1890,70)\fs26\b1}'+str(x['speed'])+'x playback')
txt(phases[-1]['start'],duration,r'{\an7\pos(30,955)\fs29\b1\c&H00E5CF65&}50 nets connected / 612 native segments / 60 vias / 0 pours')
txt(cursor,duration,r'{\an2\pos(960,1055)\fs28}Native DRC: 0 new errors. One placement error already existed before routing.')
ass=OUT/f'fusion-bq25792-astra-{speed}x.ass';ass.write_text(HEADER+'\n'.join(events)+'\n')
listing=OUT/f'concat-{speed}.txt';listing.write_text(''.join("file '"+x['file']+"'\n" for x in phases))
dest=OUT/f'fusion-bq25792-astra-{speed}x.mp4'
run(['-f','concat','-safe','0','-i',str(listing),'-vf',f'tpad=stop_mode=clone:stop_duration=5,ass={ass}','-an','-c:v','libx264','-threads','4','-preset','fast','-crf','20','-pix_fmt','yuv420p','-movflags','+faststart','-y',str(dest)])
(OUT/f'fusion-bq25792-astra-{speed}x.edit.json').write_text(json.dumps({'phases':phases,'finalHold':5,'duration':duration,'note':'Take06 recaptures primitives342..502 from verified checkpoint after take04 recorder corruption; all geometry independently planned before capture.'},indent=2))
print(dest,flush=True)