by adom
Let an AI (Claude, ChatGPT, Codex or any agent) run Altium Designer for you: create symbols and footprints, place parts (also from Altium 365), wire and annotate schematics, Update PCB, set the stack-up and rules, route, pour copper, add mounting holes and stitching vias, run ERC and DRC, and make Gerbers, BOMs and STEP. Free in Hydrogen; bring your own AI and Altium licence.
← Commit history
0.2.118 source: simulating leaves the design clean (copy sheets renamed _sim, bridge-written projects and simcfg saved)
12 files changed
+137−15
CHANGELOG.md+9@@ -1,5 +1,14 @@ # Changelog +## 0.2.118++- **Simulating no longer leaves your design asking to be saved** (reported by AI Flow). After `altium_sim_copy` and `altium_simulate`, closing Altium listed the original sheet and project as modified, though nothing in them had changed (the saved sheet was byte-for-byte the same). Three causes, each fixed:+ - Altium matches open documents by file name, and the copy's sheet had the design's name. The copy's sheets are now named `<name>_sim.SchDoc`; sheet symbols in a multi-sheet copy follow.+ - A project file the bridge writes is rewritten by Altium with its own settings and held as changed. `altium_build_schematic` now saves the project it writes (`projectSaved`), and `altium_sim_copy` saves the copy's.+ - `altium_simulate` writes the analysis into the project file and `.simcfg` with the project closed, and Altium held both as changed once reopened. It now saves them after the run. It refuses a project with unsaved changes before writing, so only what it wrote is saved.+- `altium_sim_copy` saves and closes any other simulation copy it made that Altium still holds (Altium reopens projects at launch), and lists them in `closedCopies`. Only folders with its own marker file are touched.+- Tested on Altium Designer 26.11.1 and Develop: drawing a design with `altium_build_schematic`, copying it with sources and a load, then running an AC and a transient on the copy left nothing to save. Altium closed without a prompt, and the AC result was unchanged (-2.9965 dB at 1585 Hz).+ ## 0.2.117 - **New verb `altium_sim_copy`: simulate a drawn design without touching it.** A schematic drawn for the board has no stimulus and no load, so it cannot simulate. `sim_copy` copies the project's sheets into `AdomSim\<project>` beside it and draws the sources and loads you name on the copy: voltage and current sources (DC, AC, sine, pulse, piecewise linear) and R, C, L loads, each joined to its nets (a net name, or `R1.2` for the net on a pin). It compiles the copy and reads the netlist back, so `checks` proves every pin landed on its net. Then `altium_simulate` runs the copy.
bridge-rs/src/main.rs+1−1@@ -89,7 +89,7 @@ use tiny_http::{Header, Method, Response, Server}; /// Attached to every failed reply (see the /command handler). const REPORT_ISSUES: &str = "If this looks like an altium-bridge BUG (not a refusal you expected), report it: check for a duplicate with `adom-wiki issue list adom/altium-bridge`, then `adom-wiki issue create adom/altium-bridge --title \"<verb>: <one-line symptom>\" --category bug-report --body \"<what you ran, what you expected, what happened, the VERBATIM response JSON (and errorShot if present), bridgeVersion, the Altium version from altium_status, the OS>\"`. A relay, routing, toast or lifecycle problem belongs on adom/adom-bridge instead. Reports from real machines are how this bridge gets correct: three different Altium builds behaved three different ways in one weekend."; -pub const BRIDGE_VERSION: &str = "0.2.117";+pub const BRIDGE_VERSION: &str = "0.2.118"; fn json_response(status: u16, body: &serde_json::Value) -> Response<std::io::Cursor<Vec<u8>>> { let data = serde_json::to_vec(body).unwrap_or_else(|_| b"{}".to_vec());
bridge-rs/src/routing.rs+4−1@@ -1807,7 +1807,10 @@ pub fn build_schematic(args: &Value) -> Value { } let compile_errors: Vec<Value> = c.get("data").and_then(|d| d.get("messages")).and_then(|m| m.as_array()).cloned().unwrap_or_default() .into_iter().filter(|m| m["class"].as_str().map(|k| k.to_lowercase().contains("error")).unwrap_or(false)).collect();- let mut out = json!({"success": mismatches.is_empty(), "sch": sch, "project": prj, "placed": bd["placed"], "wires": bd["wires"], "labels": bd["labels"],+ // Altium rewrites a project file the bridge wrote (its own settings added) and holds it as changed, so closing Altium+ // asked the user to save a design they never touched (AI Flow, 2026-12-01): saved here, it closes clean+ let project_saved = crate::surfaces::save(&json!({"filePath": prj})).get("success").and_then(|b| b.as_bool()) != Some(false);+ let mut out = json!({"success": mismatches.is_empty(), "sch": sch, "project": prj, "projectSaved": project_saved, "placed": bd["placed"], "wires": bd["wires"], "labels": bd["labels"], "pinsWithoutNet": bd["pinsWithoutNet"], "sheetMil": bd["sheetMil"], "nets": want.len(), "compiledNets": got.len(), "mismatches": mismatches, "compileErrors": compile_errors, "_hint": "The sheet is drawn and saved inside its project, compiled, and its netlist compared pin by pin with nets (pins of parts on the sheet only). mismatches[] names any net that differs. Parts without a symbol (board-only pads) stay off the sheet."});
bridge-rs/src/sim.rs+15@@ -527,6 +527,7 @@ pub fn simulate(args: &Value) -> Value { } let kind = match args.get("analysis").filter(|a| !a.is_null()) { Some(a) => match configure(&sheet, &prj, a, &probes, args.get("sweep"), args.get("temperatures"), args.get("monteCarlo")) { Ok(k) => Some(k), Err(e) => return e }, None => None }; let (sdf, nsx, _) = match run(&sheet, &prj) { Ok(x) => x, Err(e) => return e };+ if kind.is_some() { save_configured(&prj); } let missing_models = nsx.as_ref().map(|n| not_simulated(&sheet, n)).unwrap_or_default(); let Some(sdf) = sdf else { let empty = nsx.as_ref().map(|n| netlist_parts(&std::fs::read_to_string(n).unwrap_or_default()).0.is_empty()).unwrap_or(false);@@ -552,6 +553,20 @@ pub fn simulate(args: &Value) -> Value { "_hint": "AC signals are magnitude in dB with phase (degrees, unwrapped) beside them; points is a ceiling (the first, last and extreme points are kept). The full run is in results (Altium's .sdf): open it in Altium to see every wave."}) } +/// The project file and its .simcfg, which configure wrote with the project closed: Altium reopens them and holds them as+/// changed, so closing Altium asked to save them (AI Flow, 2026-12-01). configure refused unsaved changes before it wrote,+/// so saving now stores only what it wrote.+fn save_configured(prj: &Path) {+ let _ = crate::surfaces::save(&json!({"filePath": prj.to_string_lossy()}));+ let dir = prj.parent().unwrap_or(Path::new("."));+ for e in std::fs::read_dir(dir).into_iter().flatten().flatten() {+ if e.path().extension().map(|x| x.eq_ignore_ascii_case("simcfg")).unwrap_or(false) {+ // the agent's own save: altium_save opens only the document kinds it knows, and a .simcfg is not one+ let _ = crate::agent::call("save_doc", &[("path", e.path().to_string_lossy().replace('/', "\\"))], None, std::time::Duration::from_secs(60));+ }+ }+}+ /// altium_export_spice {schematic | filePath, outputPath?} pub fn export_spice(args: &Value) -> Value { if let Some(g) = crate::support::need_licensed() { return g; }
bridge-rs/src/simcopy.rs+50−5@@ -196,12 +196,22 @@ pub fn copy_project_text(text: &str, dir: &Path, sheets_rel: &[(String, String)] text } -/// Where a sheet goes in the copy: its path under the project folder kept, a sheet from elsewhere by its name.+/// Where a sheet goes in the copy: its path under the project folder kept, a sheet from elsewhere by its name, and+/// `_sim` added to its name (Main.SchDoc -> Main_sim.SchDoc). With the design's own name the copy's sheet shared a file+/// name with an open sheet of the design, and compiling the copy left the design's sheets asking to be saved (measured+/// 2026-12-01: Altium matches open documents by file name). pub fn rel_in_copy(prj_dir: &Path, sheet: &str) -> String { let r = crate::routing::rel_to(&prj_dir.to_string_lossy(), sheet);- if r.contains(':') || r.starts_with("..") || r.starts_with('\\') { Path::new(&sheet.replace('\\', "/")).file_name().map(|f| f.to_string_lossy().to_string()).unwrap_or(r) } else { r }+ let r = if r.contains(':') || r.starts_with("..") || r.starts_with('\\') { Path::new(&sheet.replace('\\', "/")).file_name().map(|f| f.to_string_lossy().to_string()).unwrap_or(r) } else { r };+ match r.rfind('.') {+ Some(i) if !r[i..].contains('\\') => format!("{}_sim{}", &r[..i], &r[i..]),+ _ => format!("{r}_sim"),+ } } +/// A path's file name, either separator.+fn base(p: &str) -> String { p.rsplit(['\\', '/']).next().unwrap_or(p).to_string() }+ const MARKER: &str = "adom-sim-copy.json"; /// The parts stand in one column, this far apart: a part spans 800 mil pin end to pin end and each pin's stub adds 200,@@ -226,6 +236,25 @@ fn clear_copy(dir: &Path, prj: &Path) -> Result<(), Value> { std::fs::remove_dir_all(dir).map_err(|e| fail("write_failed", format!("{}: {e} (a document of the copy may still be open)", dir.display()))) } +/// Close the other simulation copies this verb made that Altium still holds (it reopens projects at launch): their sheets+/// share names with this copy's when the designs did, and Altium then asked to save them at close (measured 2026-12-01).+/// Only folders with this verb's marker are touched; their documents are saved first.+fn close_other_copies(keep: &Path) -> Vec<String> {+ let d = agent::call("docs", &[], None, Duration::from_secs(30));+ let keep_s = keep.to_string_lossy().replace('/', "\\").to_ascii_lowercase();+ let mut closed = Vec::new();+ for x in d.pointer("/data/documents").and_then(|a| a.as_array()).cloned().unwrap_or_default() {+ let f = x["file"].as_str().unwrap_or("").to_string();+ if !f.to_ascii_lowercase().ends_with(".prjpcb") || f.eq_ignore_ascii_case(&keep_s) { continue; }+ let p = PathBuf::from(&f);+ if !p.parent().map(|d| d.join(MARKER).exists()).unwrap_or(false) { continue; }+ let (open, _) = crate::routing::project_members(&p);+ crate::routing::close_project_saved(&f, &open);+ closed.push(f);+ }+ closed+}+ /// altium_sim_copy {schematic, sources?, loads?, genericPassives? (true), copyDir?} pub fn sim_copy(args: &Value) -> Value { if let Some(g) = support::need_licensed() { return g; }@@ -242,6 +271,7 @@ pub fn sim_copy(args: &Value) -> Value { let copy_dir = s(args, "copyDir").map(|d| PathBuf::from(d.replace('/', "\\"))).unwrap_or_else(|| prj_dir.join("AdomSim").join(&stem)); let copy_prj = copy_dir.join(format!("{stem}_sim.PrjPcb")); if let Err(e) = clear_copy(©_dir, ©_prj) { return e; }+ let closed_copies = close_other_copies(©_prj); let text = match std::fs::read(&prj) { Ok(b) => String::from_utf8_lossy(&b).to_string(), Err(e) => return fail("file_not_found", format!("{}: {e}", prj.display())) }; let sheets = crate::bom::parse_project(&text, &prj_dir).sheets; let rels: Vec<(String, String)> = sheets.iter().map(|s| (s.clone(), rel_in_copy(&prj_dir, s))).collect();@@ -261,6 +291,18 @@ pub fn sim_copy(args: &Value) -> Value { let copy_prj_s = copy_prj.to_string_lossy().replace('/', "\\"); agent::call("open", &[("path", copy_prj_s.clone())], None, Duration::from_secs(120)); + // the copy's sheet symbols name the renamed sheets+ if rels.len() > 1 {+ let map: Vec<String> = rels.iter().map(|(src, rel)| format!("{}|{}", base(src), base(rel))).collect();+ for (_, rel) in &rels {+ let p = copy_dir.join(rel.replace('\\', "/")).to_string_lossy().replace('/', "\\");+ if let Some(e) = support::must_open(&p, 60) { return e; }+ let r = agent::call("sim_refs", &[], Some(&map.join("\n")), Duration::from_secs(60));+ let d = match sch::agent_data(&r) { Ok(d) => d, Err(e) => return e };+ if d["renamed"].as_i64().unwrap_or(0) > 0 { sch::maybe_save(&json!({}), &p); }+ }+ }+ // R, C and L with no model get Altium's generic one, on every sheet of the copy let mut passives: Vec<Value> = Vec::new(); if generic {@@ -339,11 +381,13 @@ pub fn sim_copy(args: &Value) -> Value { } } }+ // the copy's project file, written here, is saved by Altium once so it closes without asking+ let _ = crate::surfaces::save(&json!({"filePath": copy_prj_s})); let bad: Vec<&Value> = checks.iter().filter(|c| c["ok"] != json!(true)).collect(); let no_value: Vec<Value> = passives.iter().filter(|p| p["result"] == json!("no_value") || p["result"] == json!("not_two_pins")).cloned().collect(); json!({"success": bad.is_empty(), "errorCode": if bad.is_empty() { Value::Null } else { json!("not_connected") }, "copy": {"project": copy_prj_s, "schematic": target, "dir": copy_dir.to_string_lossy().replace('/', "\\")},- "parts": out_parts, "checks": checks, "genericPassives": passives, "passivesWithoutValue": no_value,+ "parts": out_parts, "checks": checks, "genericPassives": passives, "closedCopies": closed_copies, "passivesWithoutValue": no_value, "_hint": if bad.is_empty() { "The copy is ready: altium_simulate {schematic: copy.schematic, analysis: ...} runs it (probe nets by name; GND is SPICE's node 0). The design itself is untouched. Calling again rebuilds the copy from the design." } else {@@ -416,7 +460,8 @@ mod tests { assert!(t.contains("[Document1]\r\nDocumentPath=Main.SchDoc") && t.contains("[Document2]\r\nDocumentPath=Sub\\Power.SchDoc"), "{t}"); assert!(t.contains("[Document3]\r\nDocumentPath=C:") && t.contains("Parts.SchLib"), "{t}"); assert!(!t.contains("PcbDoc") && !t.contains("GeneratedDocument") && !t.contains("[Document4]"), "{t}");- assert_eq!(rel_in_copy(Path::new("C:\\p"), "C:\\p\\Sub\\Power.SchDoc"), "Sub\\Power.SchDoc");- assert_eq!(rel_in_copy(Path::new("C:\\p"), "D:\\shared\\Io.SchDoc"), "Io.SchDoc");+ assert_eq!(rel_in_copy(Path::new("C:\\p"), "C:\\p\\Sub\\Power.SchDoc"), "Sub\\Power_sim.SchDoc");+ assert_eq!(rel_in_copy(Path::new("C:\\p"), "D:\\shared\\Io.SchDoc"), "Io_sim.SchDoc");+ assert_eq!(base("Sub\\Power_sim.SchDoc"), "Power_sim.SchDoc"); } }
bridge-rs/src/verbs.rs+3−3@@ -157,8 +157,8 @@ fn describe() -> Value { json!({"libraryPath": "C:/lib/Diodes.SchLib", "symbolName": "1N4148WS", "modelPath": "C:/vendor/1N4148WS.lib"})), verb_doc("sim_copy", "Make a simulation copy of a design's sheets and put sources and loads on it, so a schematic drawn for the board (no stimulus, no load) simulates in Altium while the design stays untouched: voltage and current sources (DC, AC, sine, pulse, piecewise linear) and R, C, L loads, each joined to its nets, and Altium's generic model on every R, C and L that has none. The copy's netlist is read back to prove each source sits on its net.", json!({"schematic": "the .SchDoc to simulate (filePath works too); it must belong to a .PrjPcb beside it (required)", "sources": "[{type?: voltage|current (default voltage), plus: net or Ref.Pin (R1.2), minus?: net (default GND), dc?, ac?: magnitude | {magnitude, phase}, sin?: {offset?, amplitude, frequency, delay?, damping?, phase?} | pulse?: {initial?, pulsed, delay?, rise?, fall?, width, period} | pwl?: [[time, value], ...], designator?: V.../I... (default VSIM1, ISIM1, ...)}]: values are numbers or SPICE values (10k, 4.7u)", "loads": "[{type?: resistor|capacitor|inductor (default resistor), value, plus, minus?: GND, ic?, designator? (default RSIM1, CSIM1, ...)}]", "genericPassives": "bool, default true: every R, C and L of the copy with no simulation model gets Altium's generic one (its Value parameter, else its comment)", "copyDir": "folder for the copy (default AdomSim\\<project> beside the project); rebuilt on every call, and refused when it holds files this verb did not make"}),- json!({"copy": "{project, schematic, dir}: simulate copy.schematic", "parts": "[{designator, kind, subKind, plus, minus, spice: the SPICE element as Altium netlists it (VVSIM1 IN 0 DC 12: the prefix before the designator, GND as node 0), atMil}]", "checks": "[{pin, want, net, otherPins, ok}]: each source and load pin in the compiled netlist", "genericPassives": "[{designator, kind, value, from: value|comment, result: ok|has_model|no_value|not_two_pins}]", "passivesWithoutValue": "[the R, C, L that could not get a model]"}), 300,- "Then altium_simulate {schematic: copy.schematic, analysis, probes}: a dc analysis sweeps a source by its designator (VSIM1). Each source is a two-pin part to the right of the drawing whose SIM model's netlist line is the SPICE element itself, so the same line runs in ngspice for a comparison. Calling again rebuilds the copy from the design (edits made on the copy are lost).",+ json!({"copy": "{project, schematic, dir}: simulate copy.schematic (the sheets are renamed <name>_sim.SchDoc)", "closedCopies": "[other simulation copies this verb made that Altium still held, saved and closed]", "parts": "[{designator, kind, subKind, plus, minus, spice: the SPICE element as Altium netlists it (VVSIM1 IN 0 DC 12: the prefix before the designator, GND as node 0), atMil}]", "checks": "[{pin, want, net, otherPins, ok}]: each source and load pin in the compiled netlist", "genericPassives": "[{designator, kind, value, from: value|comment, result: ok|has_model|no_value|not_two_pins}]", "passivesWithoutValue": "[the R, C, L that could not get a model]"}), 300,+ "Then altium_simulate {schematic: copy.schematic, analysis, probes}: a dc analysis sweeps a source by its designator (VSIM1). The copy's sheets are named <name>_sim.SchDoc, so no open document shares a name with the design's and the design closes without asking to be saved. Each source is a two-pin part to the right of the drawing whose SIM model's netlist line is the SPICE element itself, so the same line runs in ngspice for a comparison. Calling again rebuilds the copy from the design (edits made on the copy are lost).", &["simulate", "export_spice", "add_sim_model", "netlist"], &["A net named only on another sheet (a hierarchical design) may not reach a label on this sheet: checks shows it; pass Ref.Pin (R1.2) instead.", "The design's unsaved changes are refused (unsaved_changes): the copy is made from the files.", "Parts with no simulation model other than R, C and L still stop the netlister: give them one with altium_add_sim_model."], json!({"schematic": "C:/proj/Buck.SchDoc", "sources": [{"plus": "VIN", "dc": 12}, {"plus": "EN", "pulse": {"pulsed": 5, "delay": "10u", "width": "1", "period": "2"}}], "loads": [{"plus": "VOUT", "value": 3.3}]})),@@ -639,7 +639,7 @@ fn describe() -> Value { &["set_design_rules", "read_rules", "routing_drc"], &["Needs the board current.", "One rule per call."], json!({"kind": "clearance", "name": "SW node", "scope1": "InNet('SW')", "scope2": "All", "gap": 0.3})), verb_doc("build_schematic", "Draw a design's schematic from its netlist with the project library's symbols, inside a new project (.PrjPcb with the board and libraries), compile it, and check its netlist pin by pin.", json!({"schPath": "string - the .SchDoc to write", "libraryPath": "string - the project .SchLib", "parts": "[{ref, symbol: LibReference in the SchLib, block?: column name (input, core, output...), comment?: value, footprint?: its footprint in pcbLibPath (the part's PCB model link)}]", "nets": "{net: [\"U1.3\", ...]} - pins of parts not on the sheet are ignored", "projectPath": "(optional) .PrjPcb, default beside the sheet", "pcbPath": "(optional) the board, listed in the project", "pcbLibPath": "(optional)", "title": "optional", "number": "optional", "revision": "optional", "drawnBy": "optional"}),- json!({"sch": "path", "project": "path", "placed": "int", "wires": "int", "labels": "int", "pinsWithoutNet": "ref.pin;...", "mismatches": "[{net, missing, extra}]", "compileErrors": "[..]"}), 900,+ json!({"projectSaved": "bool: the project file, which the bridge writes and Altium then holds as changed, saved so closing Altium does not ask", "sch": "path", "project": "path", "placed": "int", "wires": "int", "labels": "int", "pinsWithoutNet": "ref.pin;...", "mismatches": "[{net, missing, extra}]", "compileErrors": "[..]"}), 900, "One column per block, each part with a wire stub and a net label on every connected pin; designator above, value below; title block filled. The compiled netlist is the proof: success means it matches the given nets.", &["schematic_data", "compile", "build_board"], &["The SchLib must hold every symbol (altium_import_part).", "Parts are placed unrotated."], json!({"schPath": "C:\\work\\Buck.SchDoc", "libraryPath": "C:\\work\\library\\Buck.SchLib", "parts": [{"ref": "U1", "symbol": "TPS54202DDCR", "block": "core", "comment": "TPS54202"}], "nets": {"VIN": ["U1.3"]}})),
package.json+1−1@@ -1,6 +1,6 @@ { "slug": "altium-bridge",- "version": "0.2.117",+ "version": "0.2.118", "type": "app", "description": "Let an AI (Claude, ChatGPT, Codex or any agent) run Altium Designer for you: create symbols and footprints, place parts (also from Altium 365), wire and annotate schematics, Update PCB, set the stack-up and rules, route, pour copper, add mounting holes and stitching vias, run ERC and DRC, and make Gerbers, BOMs and STEP. Free in Hydrogen; bring your own AI and Altium licence.", "tags": [
page.json+2−2@@ -4,7 +4,7 @@ "type": "app", "title": "Altium Bridge: AI for Altium Designer", "brief": "Let an AI (Claude, ChatGPT, Codex or any agent) run Altium Designer for you: create symbols and footprints, place parts (also from Altium 365), wire and annotate schematics, Update PCB, set the stack-up and rules, route, pour copper, add mounting holes and stitching vias, run ERC and DRC, and make Gerbers, BOMs and STEP. Free in Hydrogen; bring your own AI and Altium licence.",- "version": "0.2.117",+ "version": "0.2.118", "hero": { "type": "image", "path": "screenshots/hero.png"@@ -159,4 +159,4 @@ "tools/symbol_modes.py", "uninstall.sh" ]-}+}
skills/altium-schematic-edit/SKILL.md+5@@ -291,6 +291,11 @@ altium_simulate '{"schematic":"<copy.schematic from the reply>","analysis":{"typ its Value parameter, else its comment (`10k`). `passivesWithoutValue` names the ones it could not give one. - Calling again rebuilds the copy from the design; edits on the copy are lost. A folder the verb did not make is never cleared (`copy_dir_not_ours`).+- The copy's sheets are named `<name>_sim.SchDoc` (sheet symbols follow). Altium matches open documents by file name:+ when the copy kept the design's names, compiling it left the design's sheets asking to be saved at close (0.2.117).+ Other copies the verb made that Altium still holds (it reopens projects at launch) are saved and closed first+ (`closedCopies`). `altium_simulate` saves the project file and `.simcfg` it writes, and `altium_build_schematic` the+ project file it writes (`projectSaved`), so Altium closes without asking (0.2.118). ## Title block and PDF
src/BRIDGE_VERSION+1−1@@ -1 +1 @@-0.2.117+0.2.118
src/agent/AdomAgent.pas.tmpl+45@@ -11985,6 +11985,50 @@ Begin Result := '{' + JRaw('ok','true') + ',' + JRaw('added', IntToStr(N)) + ',' + JRaw('parts', '[' + S + ']') + '}'; End; +{ sim_refs: on the current sheet, every sheet symbol whose file is one of the payload's "old|new" names (file name only,+ any case) now names the new file, its folder part kept. altium_sim_copy renames the copy's sheets (Main.SchDoc ->+ Main_sim.SchDoc) so no open document shares a name with the design's own: with the names shared, compiling the copy+ left the design's same-named sheets asking to be saved (measured 2026-12-01). }+Function CmdSimRefs(Lines : TStringList; Payload : String) : String;+Var+ Doc : ISch_Document;+ It : ISch_Iterator;+ SS : ISch_SheetSymbol;+ Map : TStringList;+ I, N : Integer;+ F, B : String;+Begin+ Doc := SchServer.GetCurrentSchDocument;+ If (Doc = Nil) Or (Doc.ObjectID = eSchLib) Then Begin Result := '{' + JRaw('ok','false') + ',' + JStr('errorCode','no_current_schematic') + ',' + JStr('error','no current schematic sheet') + '}'; Exit; End;+ Map := TStringList.Create;+ Map.Text := Payload;+ N := 0;+ It := Doc.SchIterator_Create;+ It.AddFilter_ObjectSet(MkSet(eSheetSymbol));+ SS := It.FirstSchObject;+ While SS <> Nil Do+ Begin+ F := SS.SheetFileName.Text;+ B := F;+ While Pos('\', B) > 0 Do B := Copy(B, Pos('\', B) + 1, Length(B));+ While Pos('/', B) > 0 Do B := Copy(B, Pos('/', B) + 1, Length(B));+ For I := 0 To Map.Count - 1 Do+ Begin+ If (Trim(Map[I]) <> '') And (UpperCase(FieldP(Map[I], 1)) = UpperCase(B)) Then+ Begin+ SS.SheetFileName.Text := Copy(F, 1, Length(F) - Length(B)) + FieldP(Map[I], 2);+ N := N + 1;+ Break;+ End;+ End;+ SS := It.NextSchObject;+ End;+ Doc.SchIterator_Destroy(It);+ Map.Free;+ If N > 0 Then Doc.GraphicallyInvalidate;+ Result := '{' + JRaw('ok','true') + ',' + JRaw('renamed', IntToStr(N)) + '}';+End;+ Function Dispatch(Cmd : String; Lines : TStringList; Payload : String) : String; Begin If Cmd = 'ping' Then Result := CmdPing(Lines)@@ -12027,6 +12071,7 @@ Begin Else If Cmd = 'add_sim' Then Result := CmdAddSim(Lines) Else If Cmd = 'sim_part' Then Result := CmdSimPart(Lines) Else If Cmd = 'sim_generic' Then Result := CmdSimGeneric(Lines)+ Else If Cmd = 'sim_refs' Then Result := CmdSimRefs(Lines, Payload) Else If Cmd = 'place_on_pcb' Then Result := CmdPlaceOnPcb(Lines) Else If Cmd = 'pcb_report' Then Result := CmdPcbReport(Lines) Else If Cmd = 'list_designators' Then Result := CmdListDesignators(Lines)
src/bridge.json+1−1@@ -2,7 +2,7 @@ "manifest_version": 1, "name": "altium", "displayName": "Altium Designer",- "version": "0.2.117",+ "version": "0.2.118", "description": "Drive Altium Designer from Adom: a resident DelphiScript agent (eval + the 1,100-command process launcher), the X2 -R command line, UIA over the VCL shell, dialogs by PID, screenshots of every Altium window, and Altium 365.", "homepage": "https://wiki.adom.inc/adom/altium-bridge", "docs": "https://wiki.adom.inc/adom/altium-bridge",