app
SOLIDWORKS Bridge
Public Made by Adomby adom
Launch, model and quit SOLIDWORKS from any Adom container. Nothing is ever lost.
main
Drew Owens
0.9.0: bridge data moved out of the install cache (recovery survives updates), closed-in-place records, gates route thr…
5d02ca9
20d ago
#!/usr/bin/env python3
"""swx-live.py <verb> [json-args] [timeoutSeconds] - call the SOLIDWORKS bridge on adom_drew2 through adom-bridge verb routing (2026-09-30: ab hosts the bridge; loopback 24695 is dead)."""
import sys, json, subprocess
verb=sys.argv[1]; args=sys.argv[2] if len(sys.argv)>2 else '{}'; tmo=int(sys.argv[3]) if len(sys.argv)>3 else 120
try:
r=subprocess.run(['adom-bridge','--target','adom_drew2','--ai-thread','SolidWorks Bridge',verb,args], capture_output=True, text=True, timeout=tmo+60)
except subprocess.TimeoutExpired:
print('NO ANSWER: %s did not return within %ds' % (verb, tmo+60)); sys.exit(3)
t=r.stdout; i=t.find('{')
if i<0: print('RAW:', t[:300], '| stderr:', r.stderr[:300]); sys.exit(1)
try:
d=json.loads(t[i:])
except ValueError:
print('NOT JSON:', t[i:i+300]); sys.exit(1)
# adom-bridge wraps a routed reply as {"status":..,"result":{...}}; unwrap it, and
# leave anything else exactly as it came.
print(json.dumps(d['result'] if isinstance(d, dict) and isinstance(d.get('result'), dict) else d))