← Commit history

0.2.109: routing_drc honours filePath and says what batch DRC leaves out; revision covers the layer stack; close_document takes filePath

Colby Knox ·33c67db936 · ·parent 3a4d8c0
9 files changed +39−13
CHANGELOG.md+8
@@ -1,5 +1,13 @@ # Changelog +## 0.2.109++- **`altium_routing_drc` checks the board you name.** `filePath` was ignored, so the board in front was checked and its violations came back as the named board's. It now opens the named board first.+- `altium_routing_drc {full:true}` no longer says its list is complete. Batch DRC covers only the rules the board's batch setup enables, and on a new board that leaves out component clearance: two parts on top of each other gave no violation (found by AI Flow, adom-aiflow#229). The reply and its documentation say so and point to `altium_placement_check`, which finds overlapping parts.+- **`altium_routing_state`'s `revision` changes when the layer stack does.** Going from 2 to 4 copper layers left it the same, so an edit guarded by an older revision could land on the new stack-up.+- `altium_close_document` takes `filePath` as well as `path`.+- Tested on Altium Designer 26.11.1: a DRC named one board while another was in front, a 2 to 4 layer change, and a close by `filePath`; the battery cases for the touched verbs passed.+ ## 0.2.108  - **`altium_routing_state` lists the board's keepouts** (eda-bridge-standard#33). Keepout tracks, arcs, fills and regions, and anything on the Keep-Out layer, footprints' own included, come back in `keepouts[]`: `{name, kind, layers, points}` in mm, the area each covers (a track's band, an arc's curved band, a fill's rotated rectangle, a region's outline). The Keep-Out layer is `*.Cu`, every copper layer. `tracks[]` is unchanged.
README.md+1−1
@@ -338,7 +338,7 @@ All 281 verbs, by area (prefix `altium_`). `altium_describe` returns the live ca - `altium_pour_state`: Every polygon pour with the copper it actually poured: filled area per pour and per layer, and the pours that poured nothing. - `altium_remove_pours`: Delete polygon pours by net (and layer), or all of them, and the pour keepouts (cutouts) apply_pours made. - `altium_repour`: Repour every polygon on the board (Altium's Repour All) and answer the copper after.-- `altium_routing_drc`: Design-rule violations on the current board WITH locations, plus the unrouted (ratsnest) count, as one clean/not-clean answer.+- `altium_routing_drc`: Design-rule violations on the current board (or filePath, opened first) WITH locations, plus the unrouted (ratsnest) count, as one clean/not-clean answer. - `altium_build_board`: Build a NEW board from a parts list and a netlist: outline (rounded corners allowed), every footprint from one PcbLib placed by its own origin, pad nets assigned, saved; then read back pin by pin. - `altium_set_outline`: Reshape the current board's outline (a rectangle with rounded corners, or a polygon). - `altium_set_design_rules`: Write a fab's design rules into the current board: clearance, track width, routing via style, hole size, annular ring, hole-to-hole and board-edge clearance (mm).
bridge-rs/src/main.rs+1−1
@@ -83,7 +83,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.108";+pub const BRIDGE_VERSION: &str = "0.2.109";  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+19−2
@@ -89,7 +89,9 @@ pub(crate) fn fnv(s: &str) -> String { /// is the iterator's, which is stable for an unchanged board. pub fn revision(d: &Value) -> String {     let keys = ["tracks", "arcs", "vias", "comps", "polys", "outline"];-    let canon: Vec<String> = keys.iter().map(|k| d.get(*k).map(|v| v.to_string()).unwrap_or_default()).collect();+    let mut canon: Vec<String> = keys.iter().map(|k| d.get(*k).map(|v| v.to_string()).unwrap_or_default()).collect();+    // the copper layers too: going from 2 to 4 layers left the revision as it was (aiflow-lane, adom-aiflow#229)+    canon.push(LAYER_MAP.with(|g| g.borrow().iter().map(|(i, n)| format!("{i}:{n}")).collect::<Vec<_>>().join(",")));     fnv(&canon.join("|")) } @@ -1080,6 +1082,10 @@ pub fn repour(args: &Value) -> Value { /// altium_routing_drc {full?}: violations with locations + the unrouted count. full:true runs /// Altium's batch DRC on the CURRENT board first (otherwise online DRC's live set is read). pub fn routing_drc(args: &Value) -> Value {+    // a board named by filePath is opened first: it was ignored, and the board in front was checked instead+    if let Some(b) = crate::support::s(args, "filePath").filter(|p| p.to_lowercase().ends_with(".pcbdoc")) {+        if let Some(e) = crate::support::must_open(&b, 60) { return e; }+    }     let mut batch = Value::Null;     if args.get("full").and_then(|v| v.as_bool()) == Some(true) {         let st = routing_state(&json!({}));@@ -1100,7 +1106,7 @@ pub fn routing_drc(args: &Value) -> Value {     let unconnected = d["unrouted"].as_i64().unwrap_or(0);     let mut out = json!({"success": true, "file": d["file"], "unconnected": unconnected, "errors": errors,         "clean": errors == 0 && unconnected == 0, "violations": viol,-        "_hint": if args.get("full").and_then(|v| v.as_bool()) == Some(true) { "Batch DRC ran on this board first, so violations[] is the full set." } else { "Read from online DRC's live set; pass full:true to run the batch DRC first (it covers rules online DRC skips)." }});+        "_hint": if args.get("full").and_then(|v| v.as_bool()) == Some(true) { "Batch DRC ran on this board first, so violations[] is everything the board's batch DRC checks. That leaves out what its batch setup does not enable, component clearance on a new board among them: altium_placement_check finds overlapping parts." } else { "Read from online DRC's live set; pass full:true to run the batch DRC first (it covers rules online DRC skips)." }});     if !batch.is_null() {         out["batch"] = json!({"success": batch["success"], "violationCount": batch["violationCount"], "errorCode": batch["errorCode"]});     }@@ -1524,6 +1530,17 @@ mod tests {         assert_eq!(rect_outline(0.0, 0.0, 28.0, 20.0, 0.0).len(), 4);     } +    #[test]+    fn the_revision_covers_the_layer_stack() {+        let d = json!({"tracks": [[0, 0, 1, 1, 10, 1, "N"]]});+        set_layer_map(&json!({"layers": [{"layerId": 1}, {"layerId": 32}]}));+        let two = revision(&d);+        set_layer_map(&json!({"layers": [{"layerId": 1}, {"layerId": 2}, {"layerId": 3}, {"layerId": 32}]}));+        let four = revision(&d);+        LAYER_MAP.with(|g| g.borrow_mut().clear());+        assert_ne!(two, four, "2 -> 4 layers is a new revision");+    }+     #[test]     fn layer_names_round_trip() {         assert_eq!(layer_id(&json!("F.Cu")), Some(1));
bridge-rs/src/verbs.rs+6−5
@@ -319,7 +319,7 @@ fn describe() -> Value {             "Then altium_compile {projectPath} for ERC, or altium_open_document one of its sheets. altium_state lists the project's documents.",             &["open_document", "compile", "show_project", "state"], &["data.shown:false is NORMAL for a project: projects have no document view."], json!({"filePath": "C:/proj/board.PrjPcb"})),         verb_doc("close_document", "Close ONE open document by path through its document handle. Never saves.",-            json!({"path": "absolute path of the open document (required)"}),+            json!({"path": "absolute path of the open document (required; filePath is accepted too)"}),             json!({"data": "{closed: bool, path} | {closed: false, note: 'not open: <path>'}", "roundtripMs": "int"}), 30,             "altium_save {filePath} first if anything is worth keeping. After re-running altium_place_on_sch / altium_test_board to the same path, close the stale document before altium_show_*.",             &["save", "open_document", "state"], &["Unsaved edits are DISCARDED without a prompt.", "success:true with closed:false means the document was not open."], json!({"path": "C:/proj/tof.SchDoc"})),@@ -588,8 +588,8 @@ fn describe() -> Value {             json!({"inScript": "bool (default false) - repour from inside the agent instead (scoped rules then match nothing)"}), json!({"zones": "[...]", "filledAreaByLayerMm2": "{...}", "unfilled": "[...]", "run": "{helperExited, seconds, agentStart}"}), 600,             "Run after moving parts or copper that pours flow around. Altium evaluates rule queries through its scripting system, so a repour from inside the resident agent ignores every scoped rule (a pour's own connect style, net-class clearances); this verb stops the agent, repours, and starts it again (a few seconds). apply_pours does the same on its own when it wrote connect rules.",             &["pour_state", "apply_pours"], &["Needs the board current.", "The agent restarts: a verb sent meanwhile waits for it."], json!({})),-        verb_doc("routing_drc", "Design-rule violations on the current board WITH locations, plus the unrouted (ratsnest) count, as one clean/not-clean answer.",-            json!({"full": "bool (default false) - run Altium's batch DRC on this board first"}),+        verb_doc("routing_drc", "Design-rule violations on the current board (or filePath, opened first) WITH locations, plus the unrouted (ratsnest) count, as one clean/not-clean answer.",+            json!({"filePath": "optional: the .PcbDoc to check, opened first (default the board in front)", "full": "bool (default false) - run Altium's batch DRC on this board first. It covers the rules the board's batch DRC setup enables: component clearance is off on a new board, so use altium_placement_check for overlapping parts"}),             json!({"clean": "bool - no violations and nothing unrouted", "errors": "int", "unconnected": "int", "violations": "[{rule, description, at{x,y} mm}]"}), 300,             "Without full, this reads online DRC's live violations (fast). full:true runs the batch check through Altium's DRC dialog first.",             &["routing_state", "run_drc"], &["Needs the board current.", "violations[] is capped at 500; errors is the real count."], json!({"full": true})),@@ -1963,8 +1963,9 @@ pub fn dispatch(command: &str, args: &Value, _forwarded: &[(String, String)]) ->             // on ADDevelop (RunProcess Client:CloseDocument no-ops; CloseAllOpenDocuments             // unregisters documents while their views stay open - measured 2026-09-02, #7)             if let Some(g) = need_licensed() { return g; }-            match s(args, "path") {-                None => json!({"success": false, "error": "path is required (absolute path of the open document to close; never saves - altium_save first if anything is worth keeping)"}),+            // filePath as most verbs call it (aiflow-lane), path as this verb always has+            match s(args, "path").or_else(|| s(args, "filePath")) {+                None => json!({"success": false, "error": "path (or filePath) is required (absolute path of the open document to close; never saves - altium_save first if anything is worth keeping)"}),                 Some(p) => agent::call("close_document", &[("path", p.replace('/', "\\"))], None, Duration::from_secs(30)),             }         }
package.json+1−1
@@ -1,6 +1,6 @@ {   "slug": "altium-bridge",-  "version": "0.2.108",+  "version": "0.2.109",   "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+1−1
@@ -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.108",+  "version": "0.2.109",   "hero": {     "type": "image",     "path": "screenshots/hero.png"
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-0.2.108+0.2.109
src/bridge.json+1−1
@@ -2,7 +2,7 @@   "manifest_version": 1,   "name": "altium",   "displayName": "Altium Designer",-  "version": "0.2.108",+  "version": "0.2.109",   "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",