← Commit history

v1.9.22: two-doc view activation

John Lauer ·bd4abfe6d4 ·1mo ago ·parent d4268fd
4 files changed +50−6
BRIDGE_VERSION+1−1
@@ -1 +1 @@-1.9.21\ No newline at end of file+1.9.22\ No newline at end of file
adom-bridge-fusion-manifest.json+4−4
@@ -1,10 +1,10 @@ {     "manifest_version": 1,     "name": "fusion360",-    "version": "1.9.21",-    "url": "https://wiki.adom.inc/download/adom/fusion-bridge/1.9.21/adom-bridge-fusion-v1.9.21.zip",-    "sha256": "be152ecff1067ca2676be2084cccff429b2c21dfc58ebcc29af6f7449420d6ee",-    "size": 365481,+    "version": "1.9.22",+    "url": "https://wiki.adom.inc/download/adom/fusion-bridge/1.9.22/adom-bridge-fusion-v1.9.22.zip",+    "sha256": "6693bdbce8b4ee9cd34a4e43f19745bb5da964db57c8c302971ab1018aa7ac13",+    "size": 366094,     "verbPrefixes": [         "fusion_"     ],
bridge.json+1−1
@@ -2,7 +2,7 @@   "manifest_version": 1,   "name": "fusion360",   "displayName": "Autodesk Fusion 360",-  "version": "1.9.21",+  "version": "1.9.22",   "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.",
server.py+44
@@ -5997,6 +5997,27 @@ def _mtp_generate(lib_name, ex, part_name):     return sch, brd  +_TEST_PROJECT: dict = {}+++def _test_project_activate(kind):+    """Activate the test project's sch or brd DOCUMENT (newDesignFromLocal re-open =+    activate). Returns True when the doc is confirmed active."""+    import time as _t+    if not _TEST_PROJECT:+        return False+    path = _TEST_PROJECT.get(kind)+    if not path:+        return False+    _proxy_to_addin("execute_text_command", {"command": "Document.newDesignFromLocal %s" % path}, timeout=60)+    for _ in range(6):+        _t.sleep(2)+        st = _proxy_to_addin("get_app_state", {}, timeout=10)+        if _TEST_PROJECT["docBase"] in str((st.get("data") or {}).get("activeDocument", "")).lower():+            return True+    return False++ def _orchestrate_make_test_project(args: dict) -> dict:     """Generate + import a minimal test project around a library part. @@ -6056,6 +6077,9 @@ def _orchestrate_make_test_project(args: dict) -> dict:                     "error": "%s open failed: %s" % (label, str(r.get("error"))[:150]),                     "data": {"steps": steps}}         _t.sleep(2)+    global _TEST_PROJECT+    _TEST_PROJECT = {"sch": sch_path, "brd": brd_path,+                     "docBase": base.lower()}     out = {"success": True, "schPath": sch_path, "brdPath": brd_path,            "deviceset": deviceset, "steps": steps,            "circuit": "R1 (330, generated 0603) in series with %s; VCC/GND stubs" % deviceset,@@ -6633,6 +6657,26 @@ def dispatch_command(command: str, args: dict, caller_identity: dict = None) ->      # Orchestrated multi-step commands (handled at bridge level)     if command in _OPEN_WITH_SCREENSHOT:+        # Test-project layout (make_test_project): the "views" are two DOCUMENTS, not+        # one design's internal views. Activate the right document first, then the+        # normal flow proceeds (for 2D the board editor already IS the 2D view).+        if _TEST_PROJECT and command in ("show_schematic", "show_2d_board", "show_3d_board"):+            try:+                st = _proxy_to_addin("get_app_state", {}, timeout=10)+                active = str((st.get("data") or {}).get("activeDocument", "")).lower()+            except Exception:+                active = ""+            if _TEST_PROJECT["docBase"] in active:+                kind = "sch" if command == "show_schematic" else "brd"+                _test_project_activate(kind)+                if command in ("show_schematic", "show_2d_board"):+                    shot = _handle_screenshot_fusion({}, {})+                    return {"success": True, "view": command.replace("show_", ""),+                            "document": _TEST_PROJECT["docBase"],+                            "screenshot": shot.get("savedTo"),+                            "_hint": "Test-project layout: the %s DOCUMENT is now active (its editor IS this view)." % kind}+                # 3D board: with the board doc active, fall through to the normal+                # show_3d_board machinery which switches the board editor to 3D.         return _handle_open_with_screenshot(fusion_info, args, command)     if command == "open_lbr":         return _orchestrate_open_lbr(args)