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.80 (unreleased): engine 0.6.1 (standard 0.9.1): plan_route takes the board's Width and Routing Via rules
8 files changed
+63−14
CHANGELOG.md+4−3@@ -2,11 +2,12 @@ ## 0.2.80 (unreleased) -- **`altium_plan_route`: a path for one net between two pads, from the standard's shared planner** (#21, standard 0.9.0,- adom-eda-checks 0.6.0, vendored as published). An A* search on a grid, over the copper layers you allow (any number,+- **`altium_plan_route`: a path for one net between two pads, from the standard's shared planner** (#21, standard 0.9.1,+ adom-eda-checks 0.6.1, vendored as published). An A* search on a grid, over the copper layers you allow (any number, inner layers too), with vias between them; every step keeps the board's clearance rule from other nets' copper, pads measured by their real outline. It answers `routeNet`, altium_route_net's own arguments, and `apply:true` routes it- here, guarded by the revision it was planned on. Pours are not obstacles: repour after. 252 verbs; Altium now covers+ here, guarded by the revision it was planned on. The track and via take the board's own Width and Routing Via rules+ unless widthMm / viaSizeMm are given (`planner.widthFrom`, `viaFrom`): 0.25 mm broke a 10 mil Width rule (#21, PR #4). Pours are not obstacles: repour after. 252 verbs; Altium now covers 233 of the standard's 236. - **`generate_body` is the standard's engine writer now** (#20, standard 0.8.1, adom-eda-checks 0.5.1, vendored as
bridge-rs/Cargo.lock+1−1@@ -10,7 +10,7 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "adom-eda-checks"-version = "0.6.0"+version = "0.6.1" dependencies = [ "roxmltree", "serde_json",
bridge-rs/src/verbs.rs+1−1@@ -413,7 +413,7 @@ fn describe() -> Value { "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("plan_route", "Find a path for one net between two pads, clear of other nets' copper by the board's clearance rule, on the copper layers you allow, with vias between them (the standard's shared planner). A plan: apply:true routes it.",- json!({"net": "string (required)", "from": "Ref.Pad (required), e.g. U1.3", "to": "Ref.Pad (required)", "widthMm": "track width, default 0.25", "layers": "[F.Cu, B.Cu, In<n>.Cu] - default F.Cu and B.Cu", "allowVias": "bool, default true", "viaSizeMm": "mm", "viaDrillMm": "mm", "gridMm": "search grid, default 0.5; 0.1 for fine-pitch pads", "clearanceMm": "only raises the board's rule", "edgeClearanceMm": "mm from the outline", "maxNodes": "search bound, default 50000", "apply": "bool, default false - route it with altium_route_net, guarded by the revision it was planned on", "filePath": "the .PcbDoc (opened first; else the current board)"}),+ json!({"net": "string (required)", "from": "Ref.Pad (required), e.g. U1.3", "to": "Ref.Pad (required)", "widthMm": "track width, default the board's Width rule (Preferred), else 0.25", "layers": "[F.Cu, B.Cu, In<n>.Cu] - default F.Cu and B.Cu", "allowVias": "bool, default true", "viaSizeMm": "mm, default the board's Routing Via rule, else 0.6", "viaDrillMm": "mm, default the Routing Via rule, else 0.3", "gridMm": "search grid, default 0.5; 0.1 for fine-pitch pads", "clearanceMm": "only raises the board's rule", "edgeClearanceMm": "mm from the outline", "maxNodes": "search bound, default 50000", "apply": "bool, default false - route it with altium_route_net, guarded by the revision it was planned on", "filePath": "the .PcbDoc (opened first; else the current board)"}), json!({"found": "bool", "routeNet": "altium_route_net's own arguments {net, layer, width, viaSize, viaDrill, paths}", "lengthMm": "float", "vias": "int", "viaAt": "[[x, y]]", "revision": "string - pass as expectedRevision", "reason": "string - why no path, when found is false", "applied": "{success, applied, failed, unconnected} - with apply", "engine": "string"}), 300, "A plan changes nothing: read it, then call again with apply:true, or pass routeNet to altium_route_net yourself. Pours are not obstacles: repour after. The path is orthogonal on the grid: a 0.5 mm pitch part needs gridMm 0.1 to escape its pads. found:false says why (no room at this grid and clearance, or the search bound).", &["route_net", "routing_state", "repour", "routing_drc", "route_pair"], &["Pours are ignored: a route through a pour's area cuts it until the repour.", "A coarse grid misses paths between fine-pitch pads: try gridMm 0.1 before giving up."], json!({"net": "N1", "from": "U1.8", "to": "U2.1", "gridMm": 0.25})),
bridge-rs/vendor/README.md+1−1@@ -2,7 +2,7 @@ | Folder | From | Version | |---|---|---|-| `adom-eda-checks/` | adom/eda-bridge-standard `engine/` (the shared checks engine) | standard 0.9.0, engine 0.6.0 |+| `adom-eda-checks/` | adom/eda-bridge-standard `engine/` (the shared checks engine) | standard 0.9.1, engine 0.6.1 | | `pcb-design-rules/records/` | adom/pcb-design-rules `rules/records/` (each fab's published limits, with sources and dates) | head of 2026-10-27 | The wiki has no git protocol, so these are copied at a version: refresh both from their pages, then run the tests.
bridge-rs/vendor/adom-eda-checks/Cargo.toml+1−1@@ -1,6 +1,6 @@ [package] name = "adom-eda-checks"-version = "0.6.0"+version = "0.6.1" edition = "2021" description = "The EDA Bridge Standard's checks and board-file writers, computed from the board model JSON: no bridge calls, no tool." license = "MIT"
bridge-rs/vendor/adom-eda-checks/README.md+2−2@@ -18,7 +18,7 @@ boards the engine gives the same answers the Altium bridge 0.2.76 gives. | `current_capacity` | board, stack? | per net and layer, the narrowest copper against the width the current needs (IPC-2221), and the vias a layer change needs | | `height_check` | bodies, board? | each part's height on its side, parts over `maxTopMm`/`maxBottomMm` or under a lid region (`regions`), body collisions and near misses (`minGapMm`); `noBody` and `complete: false` when a part has no 3D body | | `placement_check` | board, bodies? | courtyard overlaps (pads and bodies, grown by `marginMm`), parts off or over the edge, pads within `edgeMm` of the edge, parts on mounting holes; `stacked` lists plan-view overlaps where one part sits wholly above the other (a part under a raised molecule: pads apart, no bodies meeting in 3D); `bodiesUsed: false` when no bodies were given |-| `plan_route` | board, rules? | a path between two pads of a net (`from`, `to` as Ref.Pad) on any listed copper `layers`, with through vias between them: a bounded orthogonal A* on `gridMm`, keeping `widthMm/2` + the board's clearance from other nets' copper (pads by their real outline), inside the outline, no via in a pad. `routeNet` is route_net's arguments, unchanged; pours are not obstacles (repour after) |+| `plan_route` | board, rules? | a path between two pads of a net (`from`, `to` as Ref.Pad) on any listed copper `layers`, with through vias between them: a bounded orthogonal A* on `gridMm`, width and via from the args, else the board's width and via rules (`planner.widthFrom`, `viaFrom`), keeping `widthMm/2` + the board's clearance from other nets' copper (pads by their real outline), inside the outline, no via in a pad. `routeNet` is route_net's arguments, unchanged; pours are not obstacles (repour after) | | `thermal_vias` | board, rules? | a grid of vias in a part's exposed pad (`ref`, `pad?`), clear of vias already there; `apply` is `place_vias` arguments | | `via_fence` | board, rules? | vias of `viaNet` both sides of the named nets' tracks and/or round the board edge (`edge`), at `pitchMm` or lambda/20 at `freqGHz`, clear of other copper; `apply` is `place_vias` arguments | @@ -90,7 +90,7 @@ adom-eda-checks import_svg --svg logo.svg --args '{"at": [10, 10], "widthMm": 20 Replies keep the standard envelope (`success`, `errorCode`, `error`, `_hint`) and name verbs without a prefix (`apply_pours`, `add_rule`, `place_vias`): a bridge adds its own. Every reply also carries `engine`-(`"adom-eda-checks 0.6.0"`), so a bridge reports the engine it runs without writing the version by hand.+(`"adom-eda-checks 0.6.1"`), so a bridge reports the engine it runs without writing the version by hand. ## Tests
bridge-rs/vendor/adom-eda-checks/src/features.rs+29@@ -188,6 +188,26 @@ pub fn via_style(rules: &[Value]) -> Option<(f64, f64)> { } +/// The board's preferred track width in mm. A standard rule gives it as `{kind: "width", preferredMm}` (or `widthMm`);+/// Altium's Width rule descriptor is read too, e.g. "Width Constraint (Min=10mil) (Max=10mil) (Preferred=10mil) (All)":+/// the board-wide one (scope All), highest priority first, its Preferred else its Min. Pure.+pub fn width_style(rules: &[Value]) -> Option<f64> {+ if let Some(r) = rules.iter().filter(|r| r["enabled"] != json!(false))+ .find(|r| r["kind"].as_str().map(|k| k.eq_ignore_ascii_case("width")).unwrap_or(false)) {+ if let Some(v) = r["preferredMm"].as_f64().or_else(|| r["widthMm"].as_f64()) { return Some(v); }+ }+ let num = |d: &str, key: &str| -> Option<f64> {+ let i = d.find(&format!("({key}="))? + key.len() + 2;+ let s = &d[i..d[i..].find(')')? + i];+ let v: f64 = s.trim_end_matches(char::is_alphabetic).parse().ok()?;+ Some(if s.ends_with("mil") { v * 0.0254 } else { v })+ };+ let mut rs: Vec<&Value> = rules.iter().filter(|r| r["enabled"] != json!(false) && r["descriptor"].as_str().map(|d| d.starts_with("Width")).unwrap_or(false)).collect();+ rs.sort_by_key(|r| (r["scope1"].as_str() != Some("All"), r["priority"].as_i64().unwrap_or(99)));+ let d = rs.first()?["descriptor"].as_str()?;+ num(d, "Preferred").or_else(|| num(d, "Min")).map(|v| (v * 10000.0).round() / 10000.0)+}+ /// Thermal via grid points inside a pad (x, y, sx, sy, rotation mm): `pitch` apart, `inset` from the pad's edge plus /// the via's radius, centred. Pure. pub fn thermal_grid(x: f64, y: f64, sx: f64, sy: f64, rot: f64, pitch: f64, size: f64, inset: f64) -> Vec<(f64, f64)> {@@ -408,4 +428,13 @@ mod tests { assert_eq!(via_fence(&json!({"board": st, "args": {"viaNet": "NOPE", "nets": ["RF"]}}))["errorCode"], "no_such_net"); assert_eq!(thermal_vias(&json!({"board": st, "args": {"ref": "U9"}}))["errorCode"], "part_not_found"); }+ #[test]+ fn width_style_reads_the_standard_rule_and_altiums_descriptor() {+ assert_eq!(width_style(&[json!({"kind": "width", "preferredMm": 0.2})]), Some(0.2));+ let alt = vec![json!({"enabled": true, "scope1": "InNet('VIN')", "priority": 1, "descriptor": "Width Constraint (Min=20mil) (Max=40mil) (Preferred=30mil) (InNet('VIN'))"}),+ json!({"enabled": true, "scope1": "All", "priority": 2, "descriptor": "Width Constraint (Min=10mil) (Max=10mil) (Preferred=10mil) (All)"})];+ assert_eq!(width_style(&alt), Some(0.254), "the board-wide rule, not a net's");+ assert_eq!(width_style(&[json!({"descriptor": "Width Constraint (Min=0.15mm) (Max=1mm) (All)", "scope1": "All"})]), Some(0.15));+ assert_eq!(width_style(&[]), None);+ } }
bridge-rs/vendor/adom-eda-checks/src/route.rs+24−5@@ -83,7 +83,8 @@ fn pad_layers(p: &Value, all: &[String]) -> Vec<String> { } /// plan_route: input {board, rules?, args: {net, from, to, widthMm?, layers?, allowVias?, viaSizeMm?, viaDrillMm?, gridMm?,-/// viaCost?, clearanceMm?, edgeClearanceMm?, maxNodes?}}. `from` and `to` are pads as Ref.Pad.+/// viaCost?, clearanceMm?, edgeClearanceMm?, maxNodes?}}. `from` and `to` are pads as Ref.Pad. The width and via come from+/// the args, else the board's width and via rules (`rules`), else 0.25 mm and 0.6/0.3; `planner` says which. pub fn plan_route(input: &Value) -> Value { let st = match crate::input::board(input) { Ok(b) => b, Err(e) => return e }; let args = &input["args"];@@ -106,8 +107,14 @@ pub fn plan_route(input: &Value) -> Value { if key(&ends[0]).eq_ignore_ascii_case(&key(&ends[1])) { return crate::input::refuse("bad_args", "from and to are the same pad"); } let layers: Vec<String> = args["layers"].as_array().map(|a| a.iter().filter_map(|v| v.as_str().map(String::from)).collect()).unwrap_or_else(|| vec!["F.Cu".into(), "B.Cu".into()]); if layers.is_empty() || layers.iter().any(|l| !l.ends_with(".Cu") || l == "*.Cu") { return crate::input::refuse("bad_args", "layers are copper layers by name: [\"F.Cu\", \"In1.Cu\", \"B.Cu\"]"); }- let width = num("widthMm", 0.25);- let (via_size, via_drill) = (num("viaSizeMm", 0.6), num("viaDrillMm", 0.3));+ // the board's own width and via rules, so the route passes its DRC (a 0.25 mm default broke a 10 mil Width rule on+ // Altium's lane board, 2026-10-28); args still win+ let rules = crate::input::rules(input);+ let (width_rule, via_rule) = (crate::features::width_style(&rules), crate::features::via_style(&rules));+ let width = num("widthMm", width_rule.unwrap_or(0.25));+ let width_from = if args.get("widthMm").is_some() { "widthMm" } else if width_rule.is_some() { "the board's width rule" } else { "default 0.25" };+ let (via_size, via_drill) = (num("viaSizeMm", via_rule.map(|v| v.0).unwrap_or(0.6)), num("viaDrillMm", via_rule.map(|v| v.1).unwrap_or(0.3)));+ let via_from = if args.get("viaSizeMm").is_some() { "viaSizeMm/viaDrillMm" } else if via_rule.is_some() { "the board's via rule" } else { "default 0.6/0.3" }; if via_drill >= via_size { return crate::input::refuse("bad_args", "viaDrillMm must be smaller than viaSizeMm"); } let grid = num("gridMm", 0.5); if !(0.05..=5.0).contains(&grid) { return crate::input::refuse("bad_args", "gridMm is 0.05 to 5"); }@@ -115,7 +122,7 @@ pub fn plan_route(input: &Value) -> Value { let via_cost = num("viaCost", 5.0); let max_nodes = args["maxNodes"].as_u64().unwrap_or(50_000).clamp(1, 500_000) as usize; // the board's own clearance decides; a caller's clearanceMm can only raise it- let rule = crate::fab::min_clearance(&crate::input::rules(input));+ let rule = crate::fab::min_clearance(&rules); let clearance = num("clearanceMm", 0.0).max(rule.unwrap_or(0.2)); let edge = num("edgeClearanceMm", 0.3); let ring = crate::coppermap::outline_ring(&st);@@ -252,7 +259,7 @@ pub fn plan_route(input: &Value) -> Value { way.push(json!({"pad": key(&ends[1])})); json!({"success": true, "found": true, "lengthMm": r3(length), "vias": vias.len(), "viaAt": vias, "routeNet": {"net": net, "layer": layers[path[0].2], "width": width, "viaSize": via_size, "viaDrill": via_drill, "paths": [way]},- "planner": {"algorithm": "bounded orthogonal A*", "gridMm": grid, "layers": layers, "clearanceMm": clearance, "edgeClearanceMm": edge, "expandedNodes": seen.len()},+ "planner": {"algorithm": "bounded orthogonal A*", "widthFrom": width_from, "viaFrom": via_from, "gridMm": grid, "layers": layers, "clearanceMm": clearance, "edgeClearanceMm": edge, "expandedNodes": seen.len()}, "revision": revision, "_hint": "A plan only: pass routeNet to route_net unchanged (with expectedRevision: revision). A layer change is two waypoints at the same point, where route_net places a via. Pours (and a hatched pour's net-less pieces) are not obstacles: repour after placing the route. The path is orthogonal on the grid: a finer gridMm finds tighter paths and searches longer."}) }@@ -320,4 +327,16 @@ mod tests { assert_eq!(three["found"], json!(true), "{three}"); assert!(three["routeNet"]["paths"][0].as_array().unwrap().iter().any(|w| w["layer"] == "In1.Cu")); }+ #[test]+ fn the_track_and_via_follow_the_boards_rules() {+ // Altium's lane board: a 10 mil Width rule and a 0.5/0.3 Routing Via rule+ let rules = json!([{"enabled": true, "scope1": "All", "priority": 1, "descriptor": "Width Constraint (Min=10mil) (Max=10mil) (Preferred=10mil) (All)"},+ {"enabled": true, "scope1": "All", "priority": 1, "descriptor": "Routing Via (PreferredHoleWidth=0.3mm) (PreferedWidth=0.5mm) (All)"}]);+ let r = plan_route(&json!({"board": board(json!([])), "rules": rules, "args": {"net": "SIG", "from": "U1.1", "to": "J1.1"}}));+ assert_eq!((r["routeNet"]["width"].clone(), r["routeNet"]["viaSize"].clone()), (json!(0.254), json!(0.5)), "{r}");+ assert_eq!(r["planner"]["widthFrom"], "the board's width rule");+ let given = plan_route(&json!({"board": board(json!([])), "rules": rules, "args": {"net": "SIG", "from": "U1.1", "to": "J1.1", "widthMm": 0.4}}));+ assert_eq!(given["routeNet"]["width"], json!(0.4));+ assert_eq!(plan_route(&json!({"board": board(json!([])), "args": {"net": "SIG", "from": "U1.1", "to": "J1.1"}}))["planner"]["widthFrom"], "default 0.25");+ } }