← Commit history

demo: address the footprint by the name install_footprint registered, not the file stem

John Lauer ·774d120e48 ·2mo ago ·parent 57c4f7c
1 file changed +12−3
web-control-demo.html+12−3
@@ -1583,6 +1583,15 @@ for (const w of mine) {         return postVerb("kicad_install_footprint", { filePath: paths[1], model: { filePath: paths[2] }, quietInstall: true });       }).then(function (r) {         if (!(r.s === 200 && r.j && r.j.success)) throw stageFail("kicad_install_footprint: " + ((r.j && r.j.error) || r.s));+        // Same trap as the symbol, one level down: install_footprint registers+        // under the name INSIDE the .kicad_mod when the caller passes only a+        // filePath - tja1051t-3-118 lands as "SOIC127P600X175-8N". Asking for the+        // file stem then finds nothing, which the bridge now reports honestly as+        // existsInLibrary:false. It hands back the registered name, so use it.+        if (r.j.footprintName) {+          PART.kicadFootprintName = r.j.footprintName;+          if (PART.kicadFootprintName !== PART.name) clog(c, "  footprint registered as '" + PART.kicadFootprintName + "' (not '" + PART.name + "')");+        }         clog(c, "  installed footprint; the bridge wired the 3D model reference (0.9.108 model arg)");       });     });@@ -1623,8 +1632,8 @@ for (const w of mine) {   // kicad-bridge #26 closed via the Win32 menu tier in 0.9.99).   [     { label: function () { return "Symbol (" + PART.name + ")"; }, cmd: "kicad_show_symbol", args: function () { return { symbolName: PART.kicadSymbolName || PART.name, libraryName: PART.kicadLib }; }, stage: stageKicadPart, pick: "symbol editor", note: "installs the part from its wiki page, then shows JUST the symbol" },-    { label: function () { return "Footprint (" + PART.name + ")"; }, cmd: "kicad_show_footprint", args: function () { return { footprintName: PART.name, library: PART.kicadLib }; }, stage: stageKicadPart, pick: "footprint editor", note: "just the land pattern: pads + courtyard" },-    { label: function () { return "3D chip (" + PART.name + ")"; }, cmd: "kicad_show_3d_chip", args: function () { return { footprintName: PART.name, library: PART.kicadLib }; }, stage: stageKicadPart, pick: "3d viewer", note: "the part's STEP model on its footprint" },+    { label: function () { return "Footprint (" + PART.name + ")"; }, cmd: "kicad_show_footprint", args: function () { return { footprintName: PART.kicadFootprintName || PART.name, library: PART.kicadLib }; }, stage: stageKicadPart, pick: "footprint editor", note: "just the land pattern: pads + courtyard" },+    { label: function () { return "3D chip (" + PART.name + ")"; }, cmd: "kicad_show_3d_chip", args: function () { return { footprintName: PART.kicadFootprintName || PART.name, library: PART.kicadLib }; }, stage: stageKicadPart, pick: "3d viewer", note: "the part's STEP model on its footprint" },     { label: function () { return "Library (" + PART.name + " in '" + PART.kicadLib + "')"; }, cmd: "kicad_show_library", args: function () { return { libraryName: PART.kicadLib }; }, stage: stageKicadPart, pick: "symbol editor", note: "browses the library TREE - by design this verb loads NO part (kicad_show_library: \"no part loaded\"), so the editor window keeps showing whichever symbol was already open. A leftover name in the shot below is that, not this part." },     { label: function () { return "Schematic (just the " + PART.name + ")"; }, cmd: "kicad_show_schematic", args: function () { return { filePath: (PART.kicadProject || {}).schPath }; }, stage: stageKicadProject, pick: "schematic editor", note: "the generated single-component schematic (kicad_make_part_project)" },     { label: "2D board (part placed, tight edge cuts)", cmd: "kicad_show_2d_board", args: function () { return { filePath: (PART.kicadProject || {}).pcbPath }; }, stage: stageKicadProject, pick: "pcb editor", note: "the part-dominant board" },@@ -1664,7 +1673,7 @@ for (const w of mine) {         // honest cost is that those two surfaces open but go unverified.         verifyName: function () {           return (s.cmd === "kicad_show_symbol")    ? (PART.kicadSymbolName || PART.name)-               : (s.cmd === "kicad_show_footprint") ? PART.name+               : (s.cmd === "kicad_show_footprint") ? (PART.kicadFootprintName || PART.name)                : null;         },         onShown: function () { KICAD_SHOWN = PART.name; }