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.
← Commit history
Update 103 file(s)
9 files changed
+309−38
BRIDGE_VERSION+1−1@@ -1 +1 @@-1.9.315+1.9.316
adom-bridge-fusion-manifest.json+4−4@@ -1,10 +1,10 @@ { "manifest_version": 1, "name": "fusion360",- "version": "1.9.315",- "url": "https://wiki.adom.inc/download/adom/fusion-bridge/1.9.315/adom-bridge-fusion-v1.9.315.zip",- "sha256": "2743689adc299a92ca843d25c35b77eeb93d9fce353d53ae6ded36f9fc0e397d",- "size": 595389,+ "version": "1.9.316",+ "url": "https://wiki.adom.inc/download/adom/fusion-bridge/1.9.316/adom-bridge-fusion-v1.9.316.zip",+ "sha256": "6685722a65e6bff6d922555b2a9f8f51839ce0cc96438a6d893f722841327515",+ "size": 598469, "verbPrefixes": [ "fusion_" ],
bridge.json+1−1@@ -2,7 +2,7 @@ "manifest_version": 1, "name": "fusion360", "displayName": "Autodesk Fusion 360",- "version": "1.9.315",+ "version": "1.9.316", "description": "Drive Autodesk Fusion 360 from the cloud: launch Fusion, electronics board layout, design rules, exports (STEP/IGES/STL/3MF/USDZ/OBJ/DXF/DWG/Gerbers/BOM/CPL), fast APS server-indexed cloud search plus browse/recent/file-info/versions, cloud file download/upload and folder creation, and in-app parametric modeling (fusion_run_modeling_script). Never-charge: APS calls are capped to the free tier.", "homepage": "https://wiki.adom.inc/adom/fusion-bridge", "author": "Adom Inc.",
dashboard/Cargo.lock+1−1@@ -4,7 +4,7 @@ version = 4 [[package]] name = "fusion-dashboard"-version = "1.9.315"+version = "1.9.316" dependencies = [ "serde_json", ]
dashboard/Cargo.toml+1−1@@ -1,6 +1,6 @@ [package] name = "fusion-dashboard"-version = "1.9.315"+version = "1.9.316" edition = "2021" [dependencies]
install.sh+1−1@@ -21,7 +21,7 @@ echo "Installed fusion-bridge skills: $(ls "$PKG_DIR/skills" 2>/dev/null | tr '\ # binary (the three-artifact pattern: bridge zip -> ab, THIS pkg -> container skills + # this download, page media -> wiki). Per the wiki's PKG_VS_RELEASE policy, binaries are # platform-tagged RELEASE assets, never tarball content - the installer fetches them.-DASH_VERSION="1.9.315"+DASH_VERSION="1.9.316" DASH_URL="https://wiki.adom.inc/download/adom/fusion-bridge/${DASH_VERSION}/fusion-dashboard" DEST="" if [ -w /usr/local/bin ]; then DEST=/usr/local/bin
package.json+1−1@@ -1,6 +1,6 @@ { "slug": "fusion-bridge",- "version": "1.9.315",+ "version": "1.9.316", "type": "app", "description": "This package installs the bridge's SKILLS into your container so your AI knows how to drive it; Adom Bridge loads the bridge runtime itself from the release zip.", "dependencies": {
page.json+11−8@@ -1,6 +1,6 @@ { "slug": "fusion-bridge",- "version": "1.9.315",+ "version": "1.9.316", "type": "app", "description": "This package installs the bridge's SKILLS into your container so your AI knows how to drive it; Adom Bridge loads the bridge runtime itself from the release zip.", "dependencies": {@@ -11,6 +11,10 @@ "uninstall": "./uninstall.sh" }, "tags": [+ "ab",+ "bridge",+ "fusion",+ "desktop-app", "fusion360", "autodesk", "cad",@@ -75,7 +79,10 @@ "build a basic parts library", "add a 3d model to a component", "make a fusion 360 library with 3d",- "set up the fusion bridge"+ "set up the fusion bridge",+ "fusion dashboard",+ "fusion status page",+ "open the fusion launch page" ], "discovery_pitch": "Use the Adom Bridge Fusion 360 bridge when the user wants to DRIVE Autodesk Fusion 360 from the cloud: open/search their team's Fusion cloud designs, lay out a PCB or do electronics, export STEP/IGES/STL/Gerbers/BOM, or build a component library with real rendering 3D. It runs Fusion on the user's own machine via Adom Bridge. NOT for web/browser/login/form-filling (that's the native-browser extension) and NOT for KiCad (that's the kicad bridge).", "brief": "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.",@@ -104,9 +111,5 @@ "label": "Part volume", "prompt": "How much material does each printed part in this assembly use?" }- ],- "author": {- "name": "John Lauer",- "email": "[email protected]"- }-}+ ]+}
server.py+288−20@@ -2827,6 +2827,11 @@ COMMAND_HANDLERS = { # Fusion's own error/warning toasts (the CEF overlays no window enumeration can see). "managed_library_create": lambda fi, args: _handle_managed_library_create(fi, args), "web_signin": lambda fi, args: _handle_web_signin(fi, args),+ "managed_library_push": lambda fi, args: _handle_managed_library_push(fi, args),+ "managed_library_pull": lambda fi, args: _handle_managed_library_pull(fi, args),+ "managed_library_link": lambda fi, args: _handle_managed_library_link(fi, args),+ "managed_library_unlink": lambda fi, args: _handle_managed_library_unlink(fi, args),+ "library_manager": lambda fi, args: _handle_library_manager(fi, args), "alerts": lambda fi, args: { "success": True, "alerts": _fusion_alerts(float(args.get("sinceSec", 300))),@@ -15645,6 +15650,38 @@ _RIBBON_FRAC = { } +def _window_dpi_scale(hwnd) -> float:+ """Physical px per DIP for a window, straight from Win32 (GetDpiForWindow / 96).++ This is the piece that makes ribbon driving portable: the SAME control measured 296 DIP on+ ConfRoomROG (4K, scale 2.0 -> 592 px) and on AdomLapper (scale 1.5 -> 444 px). Reading the+ scale from a screenshot coordMap failed inside the bridge (the shape differs from the CLI's),+ and window-rect fractions do NOT port. Ask Windows instead."""+ try:+ import ctypes+ u = ctypes.windll.user32+ try:+ u.GetDpiForWindow.restype = ctypes.c_uint+ u.GetDpiForWindow.argtypes = [ctypes.wintypes.HWND]+ dpi = int(u.GetDpiForWindow(ctypes.wintypes.HWND(int(hwnd))))+ if dpi > 0:+ return dpi / 96.0+ except Exception:+ pass+ # Windows 8.1 fallback: per-monitor DPI+ try:+ sh = ctypes.windll.shcore+ mon = u.MonitorFromWindow(ctypes.wintypes.HWND(int(hwnd)), 2) # NEAREST+ x = ctypes.c_uint(); y = ctypes.c_uint()+ if sh.GetDpiForMonitor(mon, 0, ctypes.byref(x), ctypes.byref(y)) == 0 and x.value:+ return x.value / 96.0+ except Exception:+ pass+ except Exception:+ pass+ return 1.0++ def _find_key(obj, key, depth=0): """First value for `key` anywhere in a nested ab response (the shape varies by verb).""" if depth > 6:@@ -15740,6 +15777,65 @@ def _wait_for_dialog(title_substr: str, timeout_s: float = 20.0): _AUTODESK_SIGNIN_HOST = "signin.autodesk.com" +# The LIBRARY.IO ribbon in DIP, measured once on ConfRoomROG and portable by construction+# (see _window_dpi_scale). The menu items sit under the group in the order Fusion lists them.+_LIBIO_DIP = {+ "manage_tab": (296, 64),+ "group": (455, 126),+ "item0": (466, 148), # Push changes to library.io+ "item1": (466, 169), # Link to managed library / Pull (when already managed)+ "item2": (466, 190), # Unlink (unmanaged: nothing) / Link+ "item3": (466, 211), # Unlink (when already managed)+ "open_icon": (352, 103), # OPEN icon - its default action is Open Library Manager+}+++def _fusion_hwnd_rect():+ """(hwnd, rect, scale) for Fusion's main window, or None."""+ win = _fusion_main_window()+ if not win or not win.get("hwnd"):+ return None+ win["dpiScale"] = _window_dpi_scale(win["hwnd"])+ return win+++def _ribbon_click(win, key, why, popup=False):+ """Click a LIBRARY.IO ribbon target. Re-foregrounds Fusion in the SAME call (John,+ 2026-09-01: "you always have to re-foreground the window the moment you are going to click+ anything cuz the user is constantly alt-tabbing away"), except for a popup item, where+ refocusing would dismiss the menu - that one goes through the raw mouse verb."""+ scale = float(win.get("dpiScale") or 1.0)+ rect = win.get("rect") or {}+ x = int(rect.get("left", 0) + _LIBIO_DIP[key][0] * scale)+ y = int(rect.get("top", 0) + _LIBIO_DIP[key][1] * scale)+ if popup:+ _ad_call("desktop_mouse_click", {"x": x, "y": y, "reason": why}, timeout=25)+ else:+ _ad_call("desktop_click", {"hwnd": win["hwnd"], "x": x, "y": y, "cursor": False,+ "reason": why}, timeout=25)+ return {"step": key, "at": [x, y], "scale": scale}+++def _libio_menu(win, item_key, why, steps):+ """MANAGE tab -> LIBRARY.IO group -> one menu item."""+ import time as _t+ steps.append(_ribbon_click(win, "manage_tab", "open the library editor's MANAGE tab"))+ _t.sleep(1.4)+ steps.append(_ribbon_click(win, "group", "open the LIBRARY.IO command group"))+ _t.sleep(1.4)+ steps.append(_ribbon_click(win, item_key, why, popup=True))+ _t.sleep(2.0)+++def _library_in_front(expect_library=True):+ """(ok, doc, workspace) for the document Fusion actually has in front."""+ st = _proxy_to_addin("get_app_state", {}, timeout=10) or {}+ d = st.get("data") or {}+ doc = str(d.get("activeDocument") or ""); ws = str(d.get("activeWorkspace") or "")+ ok = ("librar" in ws.lower()) if expect_library else True+ return ok, doc, ws++ def _handle_web_signin(fusion_info: dict, args: dict) -> dict: """Sign a pup window into an Autodesk web surface, via Google SSO by default. @@ -15821,6 +15917,196 @@ def _handle_web_signin(fusion_info: dict, args: dict) -> dict: "portal and Autodesk Account are now drivable for this user."} +def _managed_precheck(require_hub=True):+ """Shared precondition for every managed-library verb: a LIBRARY is in front, and (when the+ action needs it) that library lives in a Fusion Hub. Returns (err, ctx)."""+ ok, doc, ws = _library_in_front()+ if not ok:+ return ({"success": False, "errorCode": "not_a_library",+ "error": "The document in front is %r in the %s workspace, not a library."+ % (doc, ws or "unknown"),+ "_hint": "fusion_open_lbr {lbrPath} first - it lands the library editor in front "+ "and verifies it, which activate_document alone does NOT."}, None)+ win = _fusion_hwnd_rect()+ if not win:+ return ({"success": False, "errorCode": "no_fusion_window",+ "error": "Could not locate Fusion's main window."}, None)+ ctx = {"doc": doc, "ws": ws, "win": win}+ if require_hub:+ want = doc.replace("*", "").strip()+ hub = _proxy_to_addin("run_modeling_script", {"script": (+ "import adsk.core\n"+ "app=adsk.core.Application.get()\n"+ "want=%r\n"+ "found=None\n"+ "for i in range(app.documents.count):\n"+ " dd=app.documents.item(i)\n"+ " if (dd.name or '').replace('*','').strip()==want: found=dd; break\n"+ "df=None\n"+ "if found is not None:\n"+ " try: df=found.dataFile\n"+ " except Exception: df=None\n"+ "result={'name':(found.name if found else None),'inHub': df is not None}\n" % want)},+ timeout=30) or {}+ res = ((hub.get("data") or {}).get("result")) or {}+ ctx["inHub"] = bool(res.get("inHub"))+ if not res.get("inHub"):+ return ({"success": False, "errorCode": "not_in_hub",+ "error": "Library %r is not saved in a Fusion Hub." % (res.get("name") or doc),+ "remedyVerb": "fusion_save_to_cloud",+ "_hint": "fusion_save_to_cloud {name, projectName, folderPath} first; a real "+ "library save returns a fileId ending in .flbr."}, None)+ return (None, ctx)+++def _handle_managed_library_push(fusion_info: dict, args: dict) -> dict:+ """Push a NEW VERSION of an already-linked managed library to library.io."""+ err, ctx = _managed_precheck()+ if err:+ return err+ steps = []+ _libio_menu(ctx["win"], "item0", "Push changes to library.io", steps)+ dlg = _wait_for_dialog("Managed Library", 25)+ if dlg: # an unlinked library answers with the Create dialog instead+ return {"success": False, "errorCode": "not_linked_yet", "steps": steps,+ "dialog": dlg.get("title"),+ "_hint": "This library is not linked yet - Fusion offered Create Managed Library. "+ "Call fusion_managed_library_create instead (it completes that dialog)."}+ alerts = _fusion_alerts(120)+ return {"success": not alerts, "library": ctx["doc"], "steps": steps, "alerts": alerts,+ "_hint": "A new version was pushed to the managed library." if not alerts else+ "Fusion raised an alert - read alerts[] and treat this as failed."}+++def _handle_managed_library_pull(fusion_info: dict, args: dict) -> dict:+ """Pull the newest version FROM library.io into this linked library."""+ err, ctx = _managed_precheck(require_hub=False)+ if err:+ return err+ steps = []+ _libio_menu(ctx["win"], "item1", "Pull changes from the managed library on library.io", steps)+ alerts = _fusion_alerts(120)+ return {"success": not alerts, "library": ctx["doc"], "steps": steps, "alerts": alerts,+ "_hint": "Pull requested. On an UNLINKED library this menu slot is Link instead - "+ "check alerts[] and fusion_managed_library_status." if not alerts else+ "Fusion raised an alert - read alerts[]."}+++def _handle_managed_library_unlink(fusion_info: dict, args: dict) -> dict:+ """Unlink this library from its managed library on library.io."""+ err, ctx = _managed_precheck(require_hub=False)+ if err:+ return err+ steps = []+ _libio_menu(ctx["win"], "item3", "Unlink from the managed library on library.io", steps)+ alerts = _fusion_alerts(120)+ return {"success": not alerts, "library": ctx["doc"], "steps": steps, "alerts": alerts}+++def _handle_managed_library_link(fusion_info: dict, args: dict) -> dict:+ """Link this library to an EXISTING managed library. With no `name`, returns the picker's+ contents so a caller can choose; with `name`, selects that row and confirms."""+ err, ctx = _managed_precheck(require_hub=False)+ if err:+ return err+ import time as _t+ steps = []+ _libio_menu(ctx["win"], "item2", "Link to a managed library on library.io", steps)+ dlg = _wait_for_dialog("Select Managed Library", 25)+ if not dlg:+ return {"success": False, "errorCode": "picker_missing", "steps": steps,+ "alerts": _fusion_alerts(120),+ "_hint": "The Select Managed Library picker never appeared. On an ALREADY-LINKED "+ "library this menu slot is Unlink - check fusion_managed_library_status."}+ tree = _ad_call("desktop_ui_tree", {"hwnd": dlg.get("hwnd"), "maxDepth": 8,+ "maxNodes": 400}, timeout=90) or {}+ names = []++ def _walk(n, d=0):+ if d > 8 or not isinstance(n, dict):+ return+ nm = (n.get("name") or "").strip()+ if nm and len(nm) < 80:+ names.append({"name": nm, "center": [(n.get("rect") or {}).get("centerX"),+ (n.get("rect") or {}).get("centerY")]})+ for c in (n.get("children") or []):+ _walk(c, d + 1)+ _walk(tree.get("root") or {})+ want = (args.get("name") or "").strip()+ if not want:+ _ad_call("desktop_ui_click", {"hwnd": dlg.get("hwnd"), "name": "Cancel",+ "reason": "close the picker after listing it"}, timeout=30)+ return {"success": True, "listedOnly": True, "steps": steps,+ "managedLibraries": [n["name"] for n in names][:80],+ "_hint": "Pass name:<one of these> to link. The list is what THIS Autodesk "+ "account can reach - a managed library owned by another account does not "+ "appear unless its managed folder is shared."}+ hit = next((n for n in names if n["name"].lower() == want.lower()), None)+ if not hit or not (hit["center"] or [None])[0]:+ _ad_call("desktop_ui_click", {"hwnd": dlg.get("hwnd"), "name": "Cancel",+ "reason": "close the picker; requested library not listed"}, timeout=30)+ return {"success": False, "errorCode": "not_listed", "steps": steps,+ "managedLibraries": [n["name"] for n in names][:80],+ "error": "%r is not in this account's managed-library list." % want}+ _ad_call("desktop_click", {"x": int(hit["center"][0]), "y": int(hit["center"][1]),+ "cursor": False, "reason": "select %s in the picker" % want}, timeout=25)+ _t.sleep(1)+ ok = _ad_call("desktop_ui_click", {"hwnd": dlg.get("hwnd"), "name": "OK",+ "reason": "confirm the managed-library link"}, timeout=30) or {}+ steps.append({"step": "confirm", "ok": bool(ok.get("success"))})+ return {"success": True, "linkedTo": want, "steps": steps, "alerts": _fusion_alerts(120)}+++def _handle_library_manager(fusion_info: dict, args: dict) -> dict:+ """Open Library Manager and read one of its three tabs.++ tab: "hub" | "public" | "private" (default private - the library.io managed list).+ Returns the rows UIA exposes, which is how a caller SEES what this account can reach.+ """+ import time as _t+ ok, doc, ws = _library_in_front()+ if not ok:+ return {"success": False, "errorCode": "not_a_library",+ "error": "A library must be in front; the front document is %r (%s)." % (doc, ws),+ "_hint": "fusion_open_lbr {lbrPath} first."}+ win = _fusion_hwnd_rect()+ steps = [_ribbon_click(win, "manage_tab", "open the MANAGE tab")]+ _t.sleep(1.2)+ steps.append(_ribbon_click(win, "open_icon", "open Library Manager (the OPEN icon's default action)"))+ _t.sleep(9)+ dlg = _wait_for_dialog("Library Manager", 30)+ if not dlg:+ return {"success": False, "errorCode": "library_manager_missing", "steps": steps,+ "alerts": _fusion_alerts(120)}+ tab = (args.get("tab") or "private").lower()+ label = {"hub": "Hub Libraries", "public": "Public Libraries",+ "private": "Private Libraries"}.get(tab, "Private Libraries")+ click = _ad_call("desktop_ui_click", {"hwnd": dlg.get("hwnd"), "name": label,+ "reason": "switch Library Manager to %s" % label},+ timeout=40) or {}+ steps.append({"step": "tab", "label": label, "ok": bool(click.get("success"))})+ _t.sleep(12) # library.io fetches are slow; Library Manager can even show Not Responding+ tree = _ad_call("desktop_ui_tree", {"hwnd": dlg.get("hwnd"), "maxDepth": 10,+ "maxNodes": 600}, timeout=120) or {}+ rows = []++ def _walk(n, d=0):+ if d > 10 or not isinstance(n, dict):+ return+ nm = (n.get("name") or "").strip()+ if nm and 1 < len(nm) < 80:+ rows.append(nm)+ for c in (n.get("children") or []):+ _walk(c, d + 1)+ _walk(tree.get("root") or {})+ return {"success": True, "tab": label, "hwnd": dlg.get("hwnd"), "steps": steps,+ "rows": rows[:200], "nodeCount": tree.get("nodeCount"),+ "_hint": ("Hub Libraries = libraries in the Fusion hub (what our bind chain produces, "+ "and what Autodesk recommends for sharing). Private Libraries = library.io "+ "managed libraries in folders THIS account belongs to. Public Libraries = "+ "library.io's public catalogue. Close it with fusion_close_window when done.")}++ def _handle_managed_library_create(fusion_info: dict, args: dict) -> dict: """Publish the library that is IN FRONT as a library.io managed library. @@ -15883,26 +16169,8 @@ def _handle_managed_library_create(fusion_info: dict, args: dict) -> dict: # exact (933,296 vs the 932,296 that works), where hand-rolled DIP math gave (283,51) and # window-fraction math (925,273). cursor:false matters too - the glowing cursor overlay # dismisses Fusion's Qt popup menus.- shot = _ad_call("desktop_screenshot_screen", {}, timeout=45) or {}- shot_id = _find_key(shot, "shotId")- steps.append({"step": "screenshot", "shotId": shot_id})-- def _click(key, why):- if shot_id:- _ad_call("desktop_click", {"space": "image", "shotId": shot_id,- "x": int(_RIBBON_IMG[key][0]), "y": int(_RIBBON_IMG[key][1]),- "cursor": False, "reason": why}, timeout=25)- steps.append({"step": key, "via": "image", "at": list(_RIBBON_IMG[key])})- else:- x, y = _frac_to_screen(_RIBBON_FRAC[key], win)- _ad_call("desktop_click", {"x": x, "y": y, "cursor": False, "reason": why}, timeout=25)- steps.append({"step": key, "via": "fraction-fallback", "at": [x, y]})-- _click("manage_tab", "open the library editor's MANAGE tab")- _t.sleep(1.5)- _click("libraryio_group", "open the LIBRARY.IO command group")- _t.sleep(1.5)- _click("push_item", "Push changes to library.io")+ win["dpiScale"] = _window_dpi_scale(win.get("hwnd"))+ _libio_menu(win, "item0", "Push changes to library.io", steps) dlg = _wait_for_dialog("Create Managed Library", 25) if not dlg: return {"success": False, "errorCode": "create_dialog_missing", "steps": steps,