← Commit history

0.2.76 source (not yet released, needs signing): move_parts flips parts (side top|bottom, flip:true, side read back); altium_bodies, the standard's 3D body boxes; routing_state lists isolatedCopper and no longer counts pour islands as unconnected; schematic_review reads pin types by name (supply, not_connected); the copper map uses copperPoints for custom pads (202 verbs)

Colby Knox ·7fe9ee30fd · ·parent 004f4e4
14 files changed +212−61
CHANGELOG.md+19
@@ -1,5 +1,24 @@ # Changelog +## 0.2.76 (2026-10-27)++- `altium_move_parts`: flips parts. `side: "top" | "bottom"` puts a part on that side and `flip: true` turns it+  over; the side is read back with position and rotation. The EDA Bridge Standard asked for flipping as an argument+  on move_parts rather than a verb of its own.+- `altium_bodies` (new): every part's 3D bodies as boxes in mm, the standard's bodies model (`{ref, side, x0, y0,+  x1, y1, z0, z1}`), plus the parts with no body. The data `height_check` already read, now its own verb, so the+  shared checks engine and other tools can read it.++- `altium_routing_state`: a pour that touches nothing else of its net is listed under `isolatedCopper` and no longer+  counted in `unconnected`, as KiCad's DRC and the EDA Bridge Standard treat it (adom/eda-bridge-standard#1, #2). A+  stray track or via still counts.+- `altium_schematic_review`: pin types are read as Altium's code or as a name (`input`, `io`, `power`, `supply`,+  `not_connected`...), so the same review runs on another bridge's sheet model. A `not_connected` pin is not reported+  as unconnected; a `supply` pin drives its net.+- The copper map (copper balance, return paths) fills a custom pad from its real outline when the board model carries+  `copperPoints` (Fusion sends them), and from its bounding rectangle otherwise. A fractured fill (holes joined to+  the outline by zero-width cuts, as KiCad stores them) is tested to give the same copper as an outline with holes.+ ## 0.2.75 (2026-10-26) **Reviews, pair routing, length tuning, thermal vias, a board report: eight new verbs (201).** - New verb `altium_schematic_review`: every placed pin (from the sheet files, with its electrical type) against Altium's compiled netlist: power pins on no net and outputs together (errors), pins on no net, one-pin nets, undriven inputs and IC supplies with no decoupling capacitor (warnings; inductor nets taken as switch nodes). Bluetooth Sentinel: 15 sheets, 194 pins, 65 nets in 8 s.
README.md+6−5
@@ -15,7 +15,7 @@ normal session. Ask in plain words and it: - makes the outputs: Gerbers, NC drill, pick and place, BOMs grouped by MPN (JLCPCB, Mouser, DigiKey files),   schematic PDF and STEP, checking that the outline and every copper layer reached the Gerbers -201 commands, tested on Altium Designer 26.11 and Altium Designer Develop. It runs in **Hydrogen**, Adom's free+202 commands, tested on Altium Designer 26.11 and Altium Designer Develop. It runs in **Hydrogen**, Adom's free desktop app, through Adom Bridge. You bring your own AI subscription and your own Altium licence.  ::youtube{id="dFecpcIzdSE" title="An AI designs a 12 V to 5 V buck converter in Altium Designer"}@@ -29,7 +29,7 @@ and the verb prefix `altium_`.  ## What it can do -Tested on Altium Designer 26.11.1 and Altium Designer Develop. 201 verbs; each row names the ones+Tested on Altium Designer 26.11.1 and Altium Designer Develop. 202 verbs; each row names the ones behind it (prefix `altium_`).  | Area | What the AI can do | Verbs |@@ -70,7 +70,7 @@ This bridge is the reference for the [EDA Bridge Standard](https://wiki.adom.inc  Altium Designer is the user's own **host app**. The bridge finds an installed Altium (`%ProgramFiles%\Altium\AD*\X2.EXE`, Designer or Develop), starts it in the background, runs a small-**DelphiScript agent** inside it, and gives the AI 201 `altium_*` verbs.+**DelphiScript agent** inside it, and gives the AI 202 `altium_*` verbs.  - **Page and docs:** https://wiki.adom.inc/adom/altium-bridge - **Bridge SDK:** https://wiki.adom.inc/adom/adom-bridge-sdk@@ -170,7 +170,7 @@ way to read it). A stopped engine is restarted with `altium_agent_recover`.  <!-- verbs:start (tools/readme_verbs.py writes this list) --> -All 201 verbs, by area (prefix `altium_`). `altium_describe` returns the live catalog with every input, output, hint and example.+All 202 verbs, by area (prefix `altium_`). `altium_describe` returns the live catalog with every input, output, hint and example.  ### Running Altium: launch, close, health, dialogs @@ -244,7 +244,7 @@ All 201 verbs, by area (prefix `altium_`). `altium_describe` returns the live ca  - `altium_routing_state`: The WHOLE current board as data, in mm: tracks, arcs, vias, pads (with owner and net), components (ref, x, y, rotation, side), polygon pours, the outline, the unrouted (ratsnest) count, and a revision hash. - `altium_route_net`: Route one net as tracks, segment by segment; a waypoint on another layer drops a via there.-- `altium_move_parts`: Move and rotate placed components; each part is read back to 0.001 mm and the exact rotation.+- `altium_move_parts`: Move, rotate and flip placed components (side top or bottom; flip:true turns a part over); each part is read back to 0.001 mm, the exact rotation and its side. - `altium_place_vias`: Place vias (through, top to bottom). - `altium_board_features`: Add the furniture every real board needs in one undo step: mounting holes (at points or the four corners), fiducials, keepout areas, and a stitching-via grid on a net that keeps clear of every other net's copper, every pad and the board edge. - `altium_sch_sheet_symbol`: Make a design hierarchical: a sheet symbol on the parent sheet for a child sheet, its entries joined to the parent's nets, and matching ports on the child.@@ -259,6 +259,7 @@ All 201 verbs, by area (prefix `altium_`). `altium_describe` returns the live ca - `altium_impedance`: Controlled impedance from the board's own stack-up: the track width each copper layer needs for a single-ended target (50 ohm default) and the width and gap for a differential pair (90 ohm USB, 100 ohm Ethernet/LVDS), microstrip outside and stripline inside; optionally written as width or diff-pair rules per layer. - `altium_current_capacity`: Will this trace carry the current? For each power net and its current: the narrowest track on every layer it is routed on against the width IPC-2221 needs for the allowed temperature rise (with each layer's real copper weight), and what one of its vias carries. - `altium_height_check`: Will it fit the enclosure? Each part's height from its 3D bodies (top and bottom side), the parts over a height limit board-wide or under a lid feature in a region, and part bodies that collide or come closer than a gap.+- `altium_bodies`: Every part's 3D bodies as boxes in mm (the EDA Bridge Standard's bodies model): footprint rectangle in the board frame and the height range above the surface the part sits on, plus the parts that have no 3D body. - `altium_copper_balance`: How much of each copper layer is copper (tracks, pads, vias and what Altium actually poured, inside the outline; a plane counts full), and how far apart each mirrored pair of layers is: the copper balance a fab asks about because an unbalanced stack bows and twists in reflow. - `altium_return_path`: Where signal tracks lose their reference: for every signal net, the length of track on each layer that runs over no pour or plane copper on either neighbouring layer (a split, a gap, a void), with where the first gap starts. - `altium_silk_designators`: Place every reference designator the way assembly houses want: one size, upright, beside its own part, clear of every pad (JLCPCB: 0.15 mm), every other part's body and the other designators, inside the board; read back from Altium's own text boxes.
bridge-rs/Cargo.lock+1−1
@@ -10,7 +10,7 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"  [[package]] name = "altium-bridge"-version = "0.2.34"+version = "0.2.39" dependencies = [  "getrandom",  "serde",
bridge-rs/src/bodies.rs+20
@@ -67,6 +67,26 @@ pub fn clashes(bs: &[BodyBox], gap: f64) -> (Vec<Value>, Vec<Value>) { }  /// altium_height_check {filePath?, maxTopMm?, maxBottomMm?, regions?: [{rect, maxMm, side?, name?}], minGapMm?}+/// The bodies companion model of the EDA Bridge Standard: one box per body, in mm, z from the surface the part sits+/// on; `refs` keeps only those parts. Parts with no body are listed, not dropped.+pub fn bodies(args: &Value) -> Value {+    if let Some(g) = crate::support::need_licensed() { return g; }+    if let Some(p) = crate::support::s(args, "filePath") { if let Some(e) = crate::support::must_open(&p, 60) { return e; } }+    let r = crate::agent::call("bodies", &[], None, std::time::Duration::from_secs(120));+    let d = match r.get("data") { Some(d) if d.get("ok").and_then(|v| v.as_bool()) == Some(true) => d.clone(), _ => return r };+    let want: Option<Vec<String>> = args.get("refs").and_then(|v| v.as_array()).map(|a| a.iter().filter_map(|x| x.as_str()).map(|x| x.to_ascii_uppercase()).collect());+    let keep = |p: &str| want.as_ref().map(|w| w.contains(&p.to_ascii_uppercase())).unwrap_or(true);+    let bs: Vec<BodyBox> = boxes(&d["bodies"].as_array().cloned().unwrap_or_default()).into_iter().filter(|b| keep(&b.part)).collect();+    let rows: Vec<Value> = bs.iter().map(|b| json!({"ref": b.part, "side": if b.top { "top" } else { "bottom" },+        "x0": r3(b.x0), "y0": r3(b.y0), "x1": r3(b.x1), "y1": r3(b.y1), "z0": r3(b.z0), "z1": r3(b.z1)})).collect();+    let st = crate::routing::routing_state(&json!({}));+    let with: std::collections::BTreeSet<&str> = bs.iter().map(|b| b.part.as_str()).collect();+    let no_body: Vec<Value> = st["components"].as_array().cloned().unwrap_or_default().iter().filter_map(|c| c["ref"].as_str().map(|s| s.to_string()))+        .filter(|r| keep(r) && !with.contains(r.as_str())).map(Value::from).collect();+    json!({"success": true, "units": "mm", "bodies": rows, "count": bs.len(), "noBody": no_body, "model": "eda-bridge-standard/bodies",+        "_hint": "One box per 3D body: x0..x1, y0..y1 in the board frame (mm, as altium_routing_state), z0..z1 above the surface the part sits on (a bottom part measures down from the bottom). A part made of several bodies has several boxes. noBody lists parts with no 3D body: give them one with altium_add_body. altium_height_check answers fit and clash questions from these boxes."})+}+ pub fn height_check(args: &Value) -> Value {     if let Some(g) = crate::support::need_licensed() { return g; }     if let Some(p) = crate::support::s(args, "filePath") { if let Some(e) = crate::support::must_open(&p, 60) { return e; } }
bridge-rs/src/coppermap.rs+19
@@ -145,6 +145,9 @@ pub fn rasters(st: &Value, zones: &[Value], layers: &[(String, bool, String)], r             }             for p in st["pads"].as_array().cloned().unwrap_or_default().iter().filter(|p| on(p)) {                 let (sx, sy) = (f(&p["sizeX"]), f(&p["sizeY"]));+                // a custom pad's real copper when the bridge sends it (Fusion's copperPoints); its bounding rectangle otherwise+                let outline: Vec<(f64, f64)> = p["copperPoints"].as_array().cloned().unwrap_or_default().iter().map(|q| (f(&q[0]), f(&q[1]))).collect();+                if outline.len() >= 3 { r.polys(&[outline], true); continue; }                 match p["shape"].as_str() {                     Some("round") | Some("circle") if (sx - sy).abs() > 1e-6 => {                         let (c, s) = (f(&p["rotation"]).to_radians().cos(), f(&p["rotation"]).to_radians().sin());@@ -370,6 +373,22 @@ mod tests {         p.polys(&[vec![(0.0, 0.0), (10.0, 0.0), (10.0, 10.0), (0.0, 10.0)], vec![(2.0, 2.0), (4.0, 2.0), (4.0, 4.0), (2.0, 4.0)]], true);         assert!((p.count() as f64 * 0.0025 - 96.0).abs() < 0.5);         assert!(!p.at(3.0, 3.0) && p.at(6.0, 6.0));+        // KiCad's fractured fill: the hole joined to the outline by a zero-width cut, holes empty. Same copper.+        let mut k = Raster::new(0.0, 0.0, 20.0, 20.0, 0.05);+        k.polys(&[vec![(0.0, 0.0), (10.0, 0.0), (10.0, 10.0), (0.0, 10.0), (0.0, 2.0), (2.0, 2.0), (2.0, 4.0), (4.0, 4.0), (4.0, 2.0), (2.0, 2.0), (0.0, 2.0)]], true);+        assert_eq!(k.count(), p.count());+        assert!(!k.at(3.0, 3.0) && k.at(6.0, 6.0));+    }++    #[test]+    fn a_custom_pad_is_its_copper_points_when_sent() {+        let pad = |extra: Value| { let mut p = json!({"ref": "Q1", "name": "5", "x": 5.0, "y": 5.0, "sizeX": 4.0, "sizeY": 4.0, "rotation": 0, "layer": "F.Cu", "net": "D", "shape": "rect"});+            if let Value::Object(m) = extra { for (k, v) in m { p[k] = v; } } p };+        let area = |p: Value| { let st = json!({"outline": [[0, 0], [10, 0], [10, 10], [0, 10]], "pads": [p]});+            let (_, m) = rasters(&st, &[], &[("F.Cu".into(), false, "".into())], 0.05, None); m["F.Cu"].count() as f64 * 0.0025 };+        assert!((area(pad(json!({}))) - 16.0).abs() < 0.5);+        // an L of copper inside that rectangle: 4x2 + 2x2 = 12 mm2+        assert!((area(pad(json!({"copperPoints": [[3, 3], [7, 3], [7, 5], [5, 5], [5, 7], [3, 7]]}))) - 12.0).abs() < 0.5);     }      fn st() -> Value {
bridge-rs/src/main.rs+1−1
@@ -58,7 +58,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.75";+pub const BRIDGE_VERSION: &str = "0.2.76";  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+51−10
@@ -135,8 +135,8 @@ fn touch(x: &Cu, y: &Cu) -> bool { }  /// Connections still to make, from the copper: per net, (groups of touching copper) - 1. Also which-/// nets are split, for the hint.-pub fn unrouted(st: &Value) -> (usize, Vec<Value>) {+/// nets are split, for the hint, and the pours that touch nothing else of their net (isolatedCopper).+pub fn unrouted(st: &Value) -> (usize, Vec<Value>, Vec<Value>) {     let mut by_net: std::collections::BTreeMap<String, Vec<Cu>> = std::collections::BTreeMap::new();     let pt = |v: &Value| (v["x"].as_f64().unwrap_or(0.0), v["y"].as_f64().unwrap_or(0.0));     for p in st["pads"].as_array().cloned().unwrap_or_default() {@@ -165,17 +165,29 @@ pub fn unrouted(st: &Value) -> (usize, Vec<Value>) {     }     let mut total = 0;     let mut split = Vec::new();+    let mut isolated = Vec::new();     for (net, items) in by_net {         let n = items.len();         let mut parent: Vec<usize> = (0..n).collect();         fn find(p: &mut Vec<usize>, x: usize) -> usize { let mut r = x; while p[r] != r { r = p[r]; } let mut y = x; while p[y] != r { let nx = p[y]; p[y] = r; y = nx; } r }         for i in 0..n { for j in (i + 1)..n { if touch(&items[i], &items[j]) { let (a, b) = (find(&mut parent, i), find(&mut parent, j)); if a != b { parent[a] = b; } } } }-        // a group that holds no pad (a stray track or a pour on its own) still counts: copper that-        // reaches nothing is a connection not made+        // a group that holds no pad (a stray track or via) still counts: copper that reaches nothing is a+        // connection not made. A group that is only pour is isolated copper (an island, or a pour that reaches no+        // pad): listed, not counted, as KiCad's DRC and the standard treat it         let roots: std::collections::BTreeSet<usize> = (0..n).map(|i| find(&mut parent, i)).collect();-        if roots.len() > 1 { total += roots.len() - 1; split.push(json!({"net": net, "groups": roots.len()})); }+        let mut groups = 0;+        for r in &roots {+            let members: Vec<usize> = (0..n).filter(|i| find(&mut parent, *i) == *r).collect();+            if members.iter().all(|i| matches!(items[*i], Cu::Pour { .. })) {+                for i in members { if let Cu::Pour { poly, layer } = &items[i] {+                    let (cx, cy) = poly.iter().fold((0.0, 0.0), |a, p| (a.0 + p.0, a.1 + p.1));+                    isolated.push(json!({"net": net, "layer": layer, "at": {"x": cx / poly.len() as f64, "y": cy / poly.len() as f64}}));+                } }+            } else { groups += 1; }+        }+        if groups > 1 { total += groups - 1; split.push(json!({"net": net, "groups": groups})); }     }-    (total, split)+    (total, split, isolated) }  /// Convert the agent's compact dump into the mm-based state AI Flow reads.@@ -225,10 +237,11 @@ pub fn shape(d: &Value) -> Value {         "components": comps, "polygons": polys, "outline": outline, "outlineEdges": edges,     });     // the count AI Flow judges is the copper's own; Altium's ratsnest count rides along-    let (n, split) = unrouted(&out);+    let (n, split, isolated) = unrouted(&out);     out["altiumRatsnest"] = out["unconnected"].clone();     out["unconnected"] = json!(n);     out["splitNets"] = json!(split);+    out["isolatedCopper"] = json!(isolated);     out } @@ -263,7 +276,7 @@ pub fn routing_state(args: &Value) -> Value {         out[k] = v.clone();     }     out["roundtripMs"] = r.get("roundtripMs").cloned().unwrap_or(Value::Null);-    out["_hint"] = json!("mm, KiCad layer names (F.Cu/B.Cu/In<n>.Cu, *.Cu = multi-layer pad). Pass revision as expectedRevision to the edit verbs; unconnected is Altium's ratsnest count.");+    out["_hint"] = json!("mm, KiCad layer names (F.Cu/B.Cu/In<n>.Cu, *.Cu = multi-layer pad). Pass revision as expectedRevision to the edit verbs; unconnected is computed from the copper (altiumRatsnest is Altium's own count); isolatedCopper lists pours that reach nothing else of their net, not counted.");     out } @@ -435,6 +448,14 @@ pub fn move_parts(args: &Value) -> Value {             q["y"] = json!(c["y"].as_f64().unwrap_or(0.0) + p.get("dy").and_then(|v| v.as_f64()).unwrap_or(0.0));         }         if p.get("rotation").is_none() { if let Some(c) = cur.as_ref() { q["rotation"] = c["rotation"].clone(); } }+        // side: "top" | "bottom" puts the part on that side; flip:true turns it to the other one+        let now = cur.as_ref().and_then(|c| c["side"].as_str()).unwrap_or("top").to_string();+        match (p.get("side").and_then(|v| v.as_str()), p.get("flip").and_then(|v| v.as_bool()) == Some(true)) {+            (Some(sd), _) if sd == "top" || sd == "bottom" => q["side"] = json!(sd),+            (Some(sd), _) => return err("bad_args", format!("part {r}: side is top or bottom, not {sd}"), ""),+            (None, true) => q["side"] = json!(if now == "bottom" { "top" } else { "bottom" }),+            _ => {}+        }         resolved.push(q);     }     let args = &{ let mut a = args.clone(); a["parts"] = json!(resolved); a };@@ -445,7 +466,8 @@ pub fn move_parts(args: &Value) -> Value {             return err("bad_args", format!("part {r}: x and y are required (mm)"), "");         };         let rot = p.get("rotation").and_then(|v| v.as_f64()).unwrap_or(0.0);-        ops.push(format!("M|{r}|{}|{}|{}", raw(x), raw(y), (rot * 1000.0).round() as i64));+        let side = match p.get("side").and_then(|v| v.as_str()) { Some("bottom") => "B", Some("top") => "T", _ => "" };+        ops.push(format!("M|{r}|{}|{}|{}|{side}", raw(x), raw(y), (rot * 1000.0).round() as i64));     }     let mut out = apply(&ops, &st, "move_parts");     // Readback: every part must sit where it was asked to, to 0.001 mm and the exact rotation.@@ -458,7 +480,8 @@ pub fn move_parts(args: &Value) -> Value {                 Some(c) if (c["x"].as_f64().unwrap_or(0.0) - p["x"].as_f64().unwrap_or(0.0)).abs() <= 0.001                     && (c["y"].as_f64().unwrap_or(0.0) - p["y"].as_f64().unwrap_or(0.0)).abs() <= 0.001                     && ((c["rotation"].as_f64().unwrap_or(0.0) - p.get("rotation").and_then(|v| v.as_f64()).unwrap_or(0.0)).rem_euclid(360.0)).min(-                        (p.get("rotation").and_then(|v| v.as_f64()).unwrap_or(0.0) - c["rotation"].as_f64().unwrap_or(0.0)).rem_euclid(360.0)) < 0.01 => {}+                        (p.get("rotation").and_then(|v| v.as_f64()).unwrap_or(0.0) - c["rotation"].as_f64().unwrap_or(0.0)).rem_euclid(360.0)) < 0.01+                    && p.get("side").map(|sd| sd == &c["side"]).unwrap_or(true) => {}                 other => off.push(json!({"ref": r, "asked": p, "got": other})),             }         }@@ -1073,6 +1096,24 @@ mod tests {         assert_eq!(unrouted(&st2).0, 0);     } +    #[test]+    fn a_pour_that_touches_nothing_is_isolated_copper_not_a_connection() {+        let st = json!({"pads": [+            {"net": "GND", "x": 0.0, "y": 0.0, "sizeX": 1.0, "sizeY": 1.0, "layer": "F.Cu"},+            {"net": "GND", "x": 4.0, "y": 0.0, "sizeX": 1.0, "sizeY": 1.0, "layer": "F.Cu"}],+            "tracks": [{"net": "GND", "start": {"x": 0.0, "y": 0.0}, "end": {"x": 4.0, "y": 0.0}, "width": 0.3, "layer": "F.Cu"}],+            "vias": [], "polygons": [{"net": "GND", "layer": "B.Cu", "points": [[10, 10], [20, 10], [20, 20], [10, 20]]}]});+        let (n, _, iso) = unrouted(&st);+        assert_eq!(n, 0);+        assert_eq!(iso.len(), 1);+        assert_eq!(iso[0]["layer"], json!("B.Cu"));+        assert_eq!(iso[0]["at"]["x"], json!(15.0));+        // a stray via is still a connection to make+        let mut st2 = st.clone();+        st2["vias"] = json!([{"net": "GND", "position": {"x": 30.0, "y": 30.0}, "size": 0.6}]);+        assert_eq!(unrouted(&st2).0, 1);+    }+     #[test]     fn a_rounded_rectangle_is_eight_vertices_with_four_arcs() {         let v = rect_outline(0.0, 0.0, 28.0, 20.0, 1.0);
bridge-rs/src/schreview.rs+37−3
@@ -9,6 +9,27 @@ pub fn electrical(n: i64) -> &'static str {     match n { 0 => "input", 1 => "io", 2 => "output", 3 => "open_collector", 4 => "passive", 5 => "hiz", 6 => "open_emitter", 7 => "power", _ => "unknown" } } +/// A pin's type from the sheet model: Altium's code, or the name the standard uses (Fusion also sends `supply`, a+/// supply symbol's pin that drives its net, and `not_connected`).+pub fn pin_type(v: &Value) -> String {+    match v {+        Value::Number(n) => electrical(n.as_i64().unwrap_or(-1)).to_string(),+        Value::String(t) => match t.to_ascii_lowercase().replace(['-', ' '], "_").as_str() {+            "bidirectional" | "bidi" | "i/o" => "io".into(),+            "pwr" => "power".into(),+            "sup" => "supply".into(),+            "nc" => "not_connected".into(),+            "oc" | "opencollector" => "open_collector".into(),+            "pas" => "passive".into(),+            "tri" | "tristate" | "3state" => "hiz".into(),+            "in" => "input".into(),+            "out" => "output".into(),+            o => o.to_string(),+        },+        _ => "unknown".into(),+    }+}+ pub fn is_ground(net: &str) -> bool {     let n = net.to_ascii_uppercase();     n == "GND" || n == "0V" || n == "VSS" || n == "AGND" || n == "DGND" || n == "PGND" || n == "GNDA" || n == "GNDD" || n.starts_with("GND_") || n.ends_with("_GND")@@ -29,14 +50,14 @@ pub fn review(parts: &[Value], nets: &Map<String, Value>) -> Value {         if des.is_empty() || des.contains('?') { continue; }         for p in c["pins"].as_array().cloned().unwrap_or_default() {             let num = p["number"].as_str().unwrap_or("").to_string();-            pins.entry(format!("{des}.{num}").to_ascii_uppercase()).or_insert((des.clone(), num, p["name"].as_str().unwrap_or("").to_string(), electrical(p["electrical"].as_i64().unwrap_or(-1)).to_string()));+            pins.entry(format!("{des}.{num}").to_ascii_uppercase()).or_insert((des.clone(), num, p["name"].as_str().unwrap_or("").to_string(), pin_type(&p["electrical"])));         }     }     let nc = |name: &str| { let n = name.to_ascii_uppercase(); n == "NC" || n == "N/C" || n == "DNC" || n.starts_with("NC_") || n == "NO CONNECT" };     let mut errors = Vec::new();     let mut warnings = Vec::new();     for (key, (des, num, name, ty)) in &pins {-        if net_of.contains_key(key) || nc(name) { continue; }+        if net_of.contains_key(key) || nc(name) || ty == "not_connected" { continue; }         let f = json!({"check": "unconnected_pin", "pin": format!("{des}.{num}"), "name": name, "type": ty});         if ty == "power" { errors.push(f) } else { warnings.push(f) }     }@@ -46,7 +67,7 @@ pub fn review(parts: &[Value], nets: &Map<String, Value>) -> Value {         let kinds: Vec<&str> = ps.as_array().cloned().unwrap_or_default().iter().filter_map(|p| p.as_str()).filter_map(|p| pins.get(&p.to_ascii_uppercase())).map(|t| t.3.as_str()).collect();         let outs = kinds.iter().filter(|k| **k == "output").count();         if outs >= 2 { errors.push(json!({"check": "outputs_together", "net": n, "outputs": outs})); }-        let driven = kinds.iter().any(|k| matches!(*k, "output" | "io" | "power" | "passive" | "open_collector" | "open_emitter" | "hiz" | "unknown"));+        let driven = kinds.iter().any(|k| matches!(*k, "output" | "io" | "power" | "supply" | "passive" | "open_collector" | "open_emitter" | "hiz" | "unknown"));         if !kinds.is_empty() && kinds.iter().all(|k| *k == "input") && !driven && members > 0 {             warnings.push(json!({"check": "undriven_input", "net": n, "inputs": kinds.len()}));         }@@ -170,6 +191,19 @@ mod tests {         json!({"designator": des, "pins": pins.iter().map(|(n, nm, e)| json!({"number": n, "name": nm, "electrical": e})).collect::<Vec<_>>()})     } +    #[test]+    fn pin_types_come_as_codes_or_names() {+        assert_eq!(pin_type(&json!(7)), "power");+        assert_eq!(pin_type(&json!("Bidirectional")), "io");+        assert_eq!(pin_type(&json!("sup")), "supply");+        let parts = vec![json!({"designator": "U1", "pins": [+            {"number": "1", "name": "IN", "electrical": "input"}, {"number": "2", "name": "X", "electrical": "not_connected"}]}),+            json!({"designator": "P1", "pins": [{"number": "1", "name": "VCC", "electrical": "supply"}]})];+        let nets = json!({"VCC": ["U1.1", "P1.1"]});+        let r = review(&parts, nets.as_object().unwrap());+        assert!(r["warnings"].as_array().unwrap().is_empty(), "{r}");+    }+     #[test]     fn the_review_finds_each_kind_of_problem() {         let parts = vec![
bridge-rs/src/verbs.rs+11−6
@@ -22,7 +22,7 @@ pub const KNOWN: &[&str] = &[     "list_nets", "net_connections", "layers", "copper_layers", "read_rules",     "set_layer_visibility", "footprint_primitives", "schematic_data", "layer_stack", "net_classes", "diff_pairs", "board_outline", "set_track_width", "find_space", "selection", "check_orientation", "replicate_layout", "outjob_info", "find_symbol", "part_parameters",     // the live-board lane AI Flow drives-    "routing_state", "route_net", "move_parts", "place_vias", "board_features", "sch_sheet_symbol", "netlist", "silkscreen_prep", "net_lengths", "teardrops", "component_classes", "read_sheet_file", "fab_check", "panelize", "impedance", "current_capacity", "height_check", "copper_balance", "return_path", "silk_designators", "via_fence", "assembly_check", "jlcpcb_order", "schematic_review", "pin_pad_check", "route_pair", "thermal_vias", "board_report", "placement_check", "auto_classes", "length_tune", "remove_items", "ripup_nets", "apply_pours", "pour_state", "remove_pours", "repour", "routing_drc", "build_board", "set_outline", "set_design_rules", "zoom_to", "add_rule", "build_schematic", "export_manufacturing", "select_net", "silk_state", "apply_silkscreen",+    "routing_state", "route_net", "move_parts", "place_vias", "board_features", "sch_sheet_symbol", "netlist", "silkscreen_prep", "net_lengths", "teardrops", "component_classes", "read_sheet_file", "fab_check", "panelize", "impedance", "current_capacity", "height_check", "bodies", "copper_balance", "return_path", "silk_designators", "via_fence", "assembly_check", "jlcpcb_order", "schematic_review", "pin_pad_check", "route_pair", "thermal_vias", "board_report", "placement_check", "auto_classes", "length_tune", "remove_items", "ripup_nets", "apply_pours", "pour_state", "remove_pours", "repour", "routing_drc", "build_board", "set_outline", "set_design_rules", "zoom_to", "add_rule", "build_schematic", "export_manufacturing", "select_net", "silk_state", "apply_silkscreen",     // surfaces     "show_project", "show_schematic", "show_2d_board", "show_3d_board", "show_library",     "show_symbol", "show_footprint", "show_3d_chip", "list_library", "demo",@@ -404,18 +404,18 @@ fn describe() -> Value {             &["layers", "layers_in_use", "show_2d_board"], &["Needs a .PcbDoc current.", "Only pass ids that altium_layers returned: the id is not range-checked before the layer object is read."], json!({"layerId": 1, "displayed": false})),         verb_doc("routing_state", "The WHOLE current board as data, in mm: tracks, arcs, vias, pads (with owner and net), components (ref, x, y, rotation, side), polygon pours, the outline, the unrouted (ratsnest) count, and a revision hash.",             json!({"expectPath": "string (optional) - refuse with wrong_board unless this .PcbDoc is the current board"}),-            json!({"revision": "string - pass as expectedRevision to the edit verbs", "boardId": "string (the .PcbDoc path)", "unconnected": "int", "counts": "{tracks, arcs, vias, pads, components, polygons, nets}", "tracks": "[{start{x,y}, end{x,y}, width, layer, net}]", "vias": "[{position{x,y}, size, drill, layers[2], net}]", "pads": "[{ref, name, x, y, sizeX, sizeY, rotation, layer, drill, net}]", "components": "[{ref, x, y, rotation, side, pattern}]", "polygons": "[{net, layer, points[[x,y]]}]", "outline": "[[x,y]]"}), 180,+            json!({"revision": "string - pass as expectedRevision to the edit verbs", "boardId": "string (the .PcbDoc path)", "unconnected": "int - connections still to make, from the copper", "altiumRatsnest": "int - Altium's own count", "splitNets": "[{net, groups}]", "isolatedCopper": "[{net, layer, at{x,y}}] - pours that touch nothing else of their net: not counted in unconnected", "counts": "{tracks, arcs, vias, pads, components, polygons, nets}", "tracks": "[{start{x,y}, end{x,y}, width, layer, net}]", "vias": "[{position{x,y}, size, drill, layers[2], net}]", "pads": "[{ref, name, x, y, sizeX, sizeY, rotation, layer, drill, net}]", "components": "[{ref, x, y, rotation, side, pattern}]", "polygons": "[{net, layer, points[[x,y]]}]", "outline": "[[x,y]]"}), 180,             "Layers use KiCad names (F.Cu, B.Cu, In<n>.Cu; *.Cu = a multi-layer pad) with Altium's layerId alongside. Coordinates are Altium's own frame (y up), in mm. This is the read AI Flow's Altium lane calls before and after every edit.",-            &["read_board", "net_connections", "footprint_primitives"], &["Needs a .PcbDoc current (altium_show_2d_board {filePath}).", "Footprint-internal tracks and arcs are left out; only free copper is listed.", "unconnected counts Altium's ratsnest lines: re-read after an edit for a fresh count."], json!({"expectPath": "C:/designs/buck/buck.PcbDoc"})),+            &["read_board", "net_connections", "footprint_primitives"], &["Needs a .PcbDoc current (altium_show_2d_board {filePath}).", "Footprint-internal tracks and arcs are left out; only free copper is listed.", "unconnected is computed from the copper (Altium's ratsnest skips parts off the board; its count rides along as altiumRatsnest). A pour that reaches nothing else of its net is listed under isolatedCopper and not counted. Re-read after an edit for a fresh count."], json!({"expectPath": "C:/designs/buck/buck.PcbDoc"})),         verb_doc("route_net", "Route one net as tracks, segment by segment; a waypoint on another layer drops a via there. One undo step, read back.",             json!({"net": "string (required)", "width": "mm (default 0.25)", "layer": "F.Cu|B.Cu|In<n>.Cu or an Altium layer id (default F.Cu)", "viaSize": "mm (default 0.6)", "viaDrill": "mm (default 0.3)", "paths": "[[waypoint,...]] - a waypoint is [x,y], {x,y,layer} or {pad:\"U1.3\"}", "expectedRevision": "string (optional) - the revision you last read; refused with stale_board if the board changed", "boardId": "string (optional) - refused with board_mismatch unless this is the current board", "expectPath": "string (optional)"}),             json!({"revision": "string - the board after the edit", "applied": "int", "failed": "int", "results": "[ok|err:...] per segment/via", "unconnected": "int", "counts": "{tracks, vias, ...}", "state": "the full altium_routing_state after"}), 300,             "Coordinates are mm in Altium's frame, the same as altium_routing_state. There is no clearance check here yet: run your own DRC (AI Flow's gate) or altium_run_drc after.",             &["routing_state", "place_vias", "remove_items", "ripup_nets"], &["Needs the board current.", "A net name must already exist on the board (nets come from the schematic / pads)."], json!({"net": "VOUT", "width": 0.5, "paths": [[{"pad": "L1.2"}, [120.0, 90.0], {"pad": "C6.1"}]]})),-        verb_doc("move_parts", "Move and rotate placed components; each part is read back to 0.001 mm and the exact rotation. One undo step.",-            json!({"parts": "[{ref, x, y, rotation}] - mm and degrees, Altium's frame; or {ref, dx, dy} to move by an offset; rotation kept when left out", "expectedRevision": "string (optional) - the revision you last read; refused with stale_board if the board changed", "boardId": "string (optional) - refused with board_mismatch unless this is the current board", "expectPath": "string (optional)"}),+        verb_doc("move_parts", "Move, rotate and flip placed components (side top or bottom; flip:true turns a part over); each part is read back to 0.001 mm, the exact rotation and its side. One undo step.",+            json!({"parts": "[{ref, x, y, rotation, side?: top|bottom, flip?: bool}] - mm and degrees, Altium's frame; or {ref, dx, dy} to move by an offset; rotation and side kept when left out", "expectedRevision": "string (optional) - the revision you last read; refused with stale_board if the board changed", "boardId": "string (optional) - refused with board_mismatch unless this is the current board", "expectPath": "string (optional)"}),             json!({"revision": "string", "results": "[ok|err:...]", "mismatches": "[{ref, asked, got}] when a part did not land where asked (errorCode readback_mismatch)"}), 300,-            "Rotation is absolute, not a delta.", &["routing_state", "route_net"], &["Moving to the other side of the board is not supported yet."], json!({"parts": [{"ref": "U1", "x": 112.0, "y": 92.0, "rotation": 90}]})),+            "Rotation is absolute, not a delta. A part flipped to the bottom is mirrored by Altium; give the rotation you want as seen from the top.", &["routing_state", "route_net"], &["Flipping a part leaves its tracks where they were: they no longer reach its pads on the other side. Re-route after a flip."], json!({"parts": [{"ref": "U1", "x": 112.0, "y": 92.0, "rotation": 90}]})),         verb_doc("place_vias", "Place vias (through, top to bottom). One undo step, read back.",             json!({"vias": "[{net, x, y, size, drill}] - mm", "expectedRevision": "string (optional) - the revision you last read; refused with stale_board if the board changed", "boardId": "string (optional) - refused with board_mismatch unless this is the current board", "expectPath": "string (optional)"}),             json!({"revision": "string", "results": "[ok|err:...]", "counts": "{vias, ...}"}), 300, "Through vias, top to bottom, on the named net. Heatsink vias under a pad: place them here, then pour or route to them.", &["route_net", "routing_state"], &[], json!({"vias": [{"net": "GND", "x": 110.0, "y": 90.0, "size": 0.6, "drill": 0.3}]})),@@ -804,6 +804,10 @@ fn describe() -> Value {             &["apply_pours", "pour_state", "route_net", "net_lengths", "board_features"],             &["Reference copper is pours, planes, the reference nets' own copper and net-less copper (a hatched pour's tracks): another signal's track under a net is not a reference.", "Checks the two neighbouring copper layers; a board with no pours or planes has nothing to reference (layersWithNoReferenceCopper)."],             json!({"nets": ["USB_DP", "USB_DN", "CLK"]})),+        verb_doc("bodies", "Every part's 3D bodies as boxes in mm (the EDA Bridge Standard's bodies model): footprint rectangle in the board frame and the height range above the surface the part sits on, plus the parts that have no 3D body.",+            json!({"refs": "[string] (optional) - only these parts", "filePath": "the .PcbDoc (opened first; else the current board)"}),+            json!({"bodies": "[{ref, side, x0, y0, x1, y1, z0, z1}] mm", "count": "int", "noBody": "[ref]"}), 120,+            "The input the 3D checks read: height_check, placement_check. Several boxes for a part made of several bodies.", &["height_check", "placement_check", "add_body"], &["Boxes, not shapes: a round body is its bounding box."], json!({"refs": ["U1", "J1"]})),         verb_doc("height_check", "Will it fit the enclosure? Each part's height from its 3D bodies (top and bottom side), the parts over a height limit board-wide or under a lid feature in a region, and part bodies that collide or come closer than a gap.",             json!({"filePath": "the .PcbDoc (opened first; else the current board)", "maxTopMm": "height limit above the top side", "maxBottomMm": "limit below the bottom side", "regions": "[{rect:[x1,y1,x2,y2] mm, maxMm, side?: top|bottom, name?}] - lid features over part of the board", "minGapMm": "report bodies closer than this (default 0: collisions only)", "limit": "how many of the tallest parts to list (default 25)"}),             json!({"ok": "bool", "tallest": "{top, bottom}", "overLimit": "[{ref, side, heightMm, limitMm, overByMm}]", "regionHits": "[{region, ref, heightMm, maxMm}]", "collisions": "[{parts, overlapMm, at}]", "tooClose": "[{parts, gapMm, at}]", "noBody": "[ref] - parts with no 3D body (no height)", "heights": "[{ref, side, heightMm, rect}]"}), 120,@@ -1821,6 +1825,7 @@ pub fn dispatch(command: &str, args: &Value, _forwarded: &[(String, String)]) ->         "impedance" => crate::impedance::impedance(args),         "current_capacity" => crate::current::current_capacity(args),         "height_check" => crate::bodies::height_check(args),+        "bodies" => crate::bodies::bodies(args),         "copper_balance" => crate::coppermap::copper_balance(args),         "return_path" => crate::coppermap::return_path(args),         "silk_designators" => crate::silkplace::silk_designators(args),
package.json+5−2
@@ -1,6 +1,6 @@ {   "slug": "altium-bridge",-  "version": "0.2.75",+  "version": "0.2.76",   "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": [@@ -204,7 +204,10 @@     "altium placement check",     "altium board report pdf",     "altium net classes automatically",-    "altium jlcpcb design rules"+    "altium jlcpcb design rules",+    "flip a part to the bottom side in altium",+    "move a component to the other side of the altium board",+    "altium 3d body sizes of every part"   ],   "discovery_pitch": "An AI that runs Altium Designer in the user's own session: libraries, schematics, Update PCB, stack-up, routing, DRC, Gerbers and BOMs.",   "sample_prompts": [
page.json+6−3
@@ -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.75",+  "version": "0.2.76",   "hero": {     "type": "image",     "path": "screenshots/hero.png"@@ -196,7 +196,10 @@     "altium placement check",     "altium board report pdf",     "altium net classes automatically",-    "altium jlcpcb design rules"+    "altium jlcpcb design rules",+    "flip a part to the bottom side in altium",+    "move a component to the other side of the altium board",+    "altium 3d body sizes of every part"   ],   "discovery_pitch": "An AI that runs Altium Designer in the user's own session: libraries, schematics, Update PCB, stack-up, routing, DRC, Gerbers and BOMs.",   "metadata": {},@@ -251,4 +254,4 @@     "tools/symbol_modes.py",     "uninstall.sh"   ]-}\ No newline at end of file+}
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-0.2.75+0.2.76
src/agent/AdomAgent.pas.tmpl+4
@@ -6189,6 +6189,10 @@ Begin             Else             Begin                 Comp.BeginModify;+                { M|ref|x|y|rot*1000|side: side T or B puts the part on that side first (Altium mirrors it as it+                  flips), then rotation and position are set; empty keeps the side }+                If (FieldP(Op, 6) = 'B') And (Comp.Layer <> eBottomLayer) Then Comp.Layer := eBottomLayer+                Else If (FieldP(Op, 6) = 'T') And (Comp.Layer <> eTopLayer) Then Comp.Layer := eTopLayer;                 Comp.Rotation := AdomInt(FieldP(Op, 5)) / 1000;                 Comp.MoveToXY(AdomInt(FieldP(Op, 3)), AdomInt(FieldP(Op, 4)));                 Comp.EndModify;
src/bridge.json+31−29
@@ -2,7 +2,7 @@   "manifest_version": 1,   "name": "altium",   "displayName": "Altium Designer",-  "version": "0.2.75",+  "version": "0.2.76",   "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",@@ -45,10 +45,15 @@     "altium_annotate",     "altium_apply_pours",     "altium_apply_silkscreen",+    "altium_assembly_check",+    "altium_auto_classes",     "altium_autoroute",+    "altium_board_features",     "altium_board_outline",+    "altium_board_report",     "altium_board_shape",     "altium_board_summary",+    "altium_bodies",     "altium_bom",     "altium_build_board",     "altium_build_footprint",@@ -62,14 +67,17 @@     "altium_close_document",     "altium_compile",     "altium_compile_intlib",+    "altium_component_classes",     "altium_component_data",     "altium_component_pins",     "altium_connect_workspace",+    "altium_copper_balance",     "altium_copper_layers",     "altium_copy_footprint",     "altium_create_footprint",     "altium_create_symbol",     "altium_cross_check",+    "altium_current_capacity",     "altium_demo",     "altium_describe",     "altium_diagnostics",@@ -86,38 +94,14 @@     "altium_export_step",     "altium_extension_ping",     "altium_extract_intlib",-    "altium_board_features",-    "altium_sch_sheet_symbol",-    "altium_netlist",-    "altium_footprint_from_land_pattern",-    "altium_silkscreen_prep",-    "altium_net_lengths",-    "altium_teardrops",-    "altium_component_classes",-    "altium_read_sheet_file",     "altium_fab_check",-    "altium_panelize",-    "altium_impedance",-    "altium_current_capacity",-    "altium_height_check",-    "altium_copper_balance",-    "altium_return_path",-    "altium_silk_designators",-    "altium_via_fence",-    "altium_assembly_check",-    "altium_jlcpcb_order",-    "altium_schematic_review",-    "altium_pin_pad_check",-    "altium_route_pair",-    "altium_thermal_vias",-    "altium_board_report",-    "altium_placement_check",-    "altium_auto_classes",-    "altium_length_tune",     "altium_find_space",     "altium_find_symbol",+    "altium_footprint_from_land_pattern",     "altium_footprint_primitives",     "altium_foreground",+    "altium_height_check",+    "altium_impedance",     "altium_import_kicad",     "altium_import_part",     "altium_install",@@ -126,10 +110,12 @@     "altium_install_library_bundle",     "altium_install_receipt",     "altium_instances",+    "altium_jlcpcb_order",     "altium_launch",     "altium_layer_stack",     "altium_layers",     "altium_layers_in_use",+    "altium_length_tune",     "altium_license",     "altium_license_status",     "altium_list_commands",@@ -140,22 +126,28 @@     "altium_move_parts",     "altium_net_classes",     "altium_net_connections",+    "altium_net_lengths",+    "altium_netlist",     "altium_normalize_bodies",     "altium_open_document",     "altium_open_project",     "altium_outjob_info",     "altium_panel",+    "altium_panelize",     "altium_part_parameters",     "altium_pcb_report",+    "altium_pin_pad_check",     "altium_place_on_pcb",     "altium_place_on_sch",     "altium_place_vias",+    "altium_placement_check",     "altium_plate_vias",     "altium_pour_state",     "altium_progress",     "altium_read_board",     "altium_read_rules",     "altium_read_schematic",+    "altium_read_sheet_file",     "altium_read_symbol",     "altium_readiness",     "altium_remove_footprint",@@ -166,9 +158,11 @@     "altium_rename_symbol",     "altium_replicate_layout",     "altium_repour",+    "altium_return_path",     "altium_review_board",     "altium_ripup_nets",     "altium_route_net",+    "altium_route_pair",     "altium_routing_drc",     "altium_routing_state",     "altium_rules_by_kind",@@ -181,9 +175,11 @@     "altium_sch_connect",     "altium_sch_edit",     "altium_sch_place_part",+    "altium_sch_sheet_symbol",     "altium_sch_swap_part",     "altium_sch_zoom",     "altium_schematic_data",+    "altium_schematic_review",     "altium_select_net",     "altium_selection",     "altium_selftest_script_error",@@ -206,17 +202,22 @@     "altium_show_symbol",     "altium_signin",     "altium_signin_status",+    "altium_silk_designators",     "altium_silk_state",+    "altium_silkscreen_prep",     "altium_state",     "altium_status",     "altium_swap_footprint",     "altium_symbol_mode",     "altium_symbol_prims",+    "altium_teardrops",     "altium_test_board",+    "altium_thermal_vias",     "altium_uninstall",     "altium_uninstall_library",     "altium_update_pcb",     "altium_variants",+    "altium_via_fence",     "altium_window_info",     "altium_workspace_place",     "altium_workspace_search",@@ -375,7 +376,8 @@       "replicate_layout": 180,       "outjob_info": 30,       "find_symbol": 300,-      "part_parameters": 300+      "part_parameters": 300,+      "bodies": 180     },     "prefixes": [       {