← Commit history

demo: fusion card uses fusion_list_library + has3d (bridge 1.9.100 owns name resolution); client XML parsing removed

John Lauer ·96fb479448 ·2mo ago ·parent a17086d
1 file changed +38−5
web-control-demo.html+38−5
@@ -1929,6 +1929,24 @@ for (const w of mine) {     });   } +  // fusion-bridge 1.9.100 owns name resolution now: it resolves near-misses+  // itself (CL21B104KBCNFNC -> CL21B104KBCNFN), returns available[]/closestMatches[]+  // when it cannot, and exposes fusion_list_library. So the .lbr XML parsing this+  // used to do is DELETED - that was me reimplementing what the bridge can see.+  // What remains is asking the library what it holds, which is a one-call read.+  function resolveLbrNames(c) {+    return postVerb("fusion_list_library", { libraryPath: PART.lbrPath }).then(function (r) {+      var j = (r.j && (r.j.data || r.j)) || {};+      var sy = j.symbols || [], pk = j.packages || [], ds = j.devicesets || [];+      PART.fusionSymbol    = sy.length ? sy[0] : PART.name;+      PART.fusionPackage   = pk.length ? pk[0] : null;+      PART.fusionDeviceset = ds.length ? ds[0] : PART.name;+      PART.fusionHas3d     = j.has3d === true;+      clog(c, "  library holds: " + sy.length + " symbol(s), " + pk.length + " package(s), 3D bound: " + PART.fusionHas3d);+      if (!PART.fusionPackage) clog(c, "  this library contains NO package - a footprint cannot be shown for this part");+    }, function () { clog(c, "  (fusion_list_library unavailable - falling back to the file stem)"); });+  }+   function showFusionLibraryProof(c) {     c.btn.disabled = true;     cardLog(c.card).textContent = "";@@ -1940,16 +1958,31 @@ for (const w of mine) {     startSurfaceProgress(c, "fusion_show_library");     var results = [];     stageFusionPart(c).then(function () {-      clog(c, "Opening the library " + PART.name + ".lbr ...");-      return postVerb("fusion_show_library", { libraryPath: PART.lbrPath });+      return resolveLbrNames(c).then(function () {+        // Bind the STEP as REAL 3D first. Without this the library has no+        // package3d and Fusion renders a grey "Placeholder" slab - which counted+        // as a captured 3D artifact and is exactly the false pass John caught.+        if (PART.fusionHas3d) { clog(c, "3D already bound - skipping the bind"); return; }+        clog(c, "Binding the STEP as real 3D (fusion_bind_library_3d) ...");+        return postVerb("fusion_bind_library_3d", { libraryPath: PART.lbrPath, stepPath: PART.stepPath })+          .then(function (b) {+            var bj = b.j || {};+            if (bj.bound || bj.wip_urn) clog(c, "  bound: " + (bj.wip_urn || "yes"));+            else clog(c, "  3D bind did NOT report a binding: " + (bj.error || bj.errorCode || ("HTTP " + b.s)));+            PART.fusionBound = !!(bj.bound || bj.wip_urn);+          }, function () { clog(c, "  3D bind call failed"); });+      }).then(function () {+        clog(c, "Opening the library " + PART.name + ".lbr ...");+        return postVerb("fusion_show_library", { libraryPath: PART.lbrPath });+      });     }).then(function () {       var steps = [         { cmd: "fusion_show_symbol", label: "symbol",-          args: function () { return { name: PART.name, libraryPath: PART.lbrPath }; } },+          args: function () { return { name: PART.fusionSymbol || PART.name, libraryPath: PART.lbrPath }; } },         { cmd: "fusion_show_footprint", label: "footprint",-          args: function () { return { name: PART.name, libraryPath: PART.lbrPath }; } },+          args: function () { return { name: PART.fusionPackage || PART.name, libraryPath: PART.lbrPath }; } },         { cmd: "fusion_show_3d_package", label: "3D package",-          args: function () { return { name: PART.name, libraryPath: PART.lbrPath, stepPath: PART.stepPath }; } }+          args: function () { return { name: PART.fusionPackage || PART.name, libraryPath: PART.lbrPath, stepPath: PART.stepPath }; } }       ];       return steps.reduce(function (chain, st) {         return chain.then(function () {