← Commit history
AI Flow 0.2.106: inner-layer planes read with their layer and fill (#249)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
9 files changed
+65−15
Cargo.lock+10−10@@ -4,7 +4,7 @@ version = 4 [[package]] name = "adom-aiflow"-version = "0.2.105"+version = "0.2.106" dependencies = [ "aiflow-analyze", "aiflow-board",@@ -25,7 +25,7 @@ dependencies = [ [[package]] name = "aiflow-analyze"-version = "0.2.105"+version = "0.2.106" dependencies = [ "aiflow-board", "serde",@@ -35,7 +35,7 @@ dependencies = [ [[package]] name = "aiflow-board"-version = "0.2.105"+version = "0.2.106" dependencies = [ "roxmltree", "serde",@@ -44,7 +44,7 @@ dependencies = [ [[package]] name = "aiflow-bridge"-version = "0.2.105"+version = "0.2.106" dependencies = [ "aiflow-board", "serde",@@ -53,7 +53,7 @@ dependencies = [ [[package]] name = "aiflow-copper"-version = "0.2.105"+version = "0.2.106" dependencies = [ "aiflow-board", "aiflow-grid",@@ -63,7 +63,7 @@ dependencies = [ [[package]] name = "aiflow-grid"-version = "0.2.105"+version = "0.2.106" dependencies = [ "aiflow-board", "serde",@@ -72,7 +72,7 @@ dependencies = [ [[package]] name = "aiflow-place"-version = "0.2.105"+version = "0.2.106" dependencies = [ "aiflow-board", "serde",@@ -81,7 +81,7 @@ dependencies = [ [[package]] name = "aiflow-pours"-version = "0.2.105"+version = "0.2.106" dependencies = [ "aiflow-board", "aiflow-copper",@@ -91,7 +91,7 @@ dependencies = [ [[package]] name = "aiflow-router"-version = "0.2.105"+version = "0.2.106" dependencies = [ "aiflow-board", "aiflow-grid",@@ -101,7 +101,7 @@ dependencies = [ [[package]] name = "aiflow-run"-version = "0.2.105"+version = "0.2.106" dependencies = [ "serde", "serde_json",
Cargo.toml+1−1@@ -14,7 +14,7 @@ members = [ ] [workspace.package]-version = "0.2.105"+version = "0.2.106" edition = "2021" license = "MIT" repository = "https://wiki.adom.inc/adom/adom-aiflow"
bin/adom-aiflow⋯ 1 unchanged line ⋯
crates/aiflow-board/src/lib.rs+15@@ -132,6 +132,15 @@ pub struct Zone { pub fills: Vec<(usize, Vec<Pt>)>, } +impl Zone {+ /// The zone's copper layers by name, inner ones included (issue #249: an In1.Cu plane is not "").+ pub fn layer_names(&self) -> Vec<String> {+ let mut v: Vec<String> = self.layers.iter().map(|&l| LAYER_NAMES[l].to_string()).collect();+ v.extend(self.inner_layers.iter().cloned());+ v+ }+}+ /// A drilled hole with no copper layer at all (an NPTH whose pad lists only `*.Mask`, such as a /// USB-C shell peg). It is not a pad: it has no net and no copper, so pad, net, BOM and netlist /// consumers never see it. Copper consumers (router, pours, via placement) keep clearance from it.@@ -567,6 +576,12 @@ impl Board { self.zones_on(false) } + /// Issue #249: every copper zone with its fills on every copper layer, inner ones included (`zones()` keeps+ /// F.Cu and B.Cu only, for the router's two layers).+ pub fn zones_all_layers(&self) -> Vec<Zone> {+ self.zones_on(true)+ }+ /// Every filled zone island on every copper layer, for connectivity: (net, `copper_layer` /// index, island polygon). pub fn copper_fills(&self) -> Vec<(String, usize, Vec<Pt>)> {
crates/aiflow-router/src/board_copper.rs+25@@ -363,6 +363,31 @@ pub(crate) mod tests { format!("\t(segment\n\t\t(start {} {})\n\t\t(end {} {})\n\t\t(width 0.25)\n\t\t(layer \"{layer}\")\n\t\t(net \"{net}\")\n\t)\n", a.0, a.1, b.0, b.1) } + /// Issue #249: a GND plane on In1.Cu saved by KiCad 10 as a single-layer zone with its fill is a filled plane,+ /// not a zone "on ''" with "no fill"; the same zone left unfilled is warned about by name.+ #[test]+ fn a_filled_inner_plane_is_not_warned_and_an_unfilled_one_is_named() {+ let mk = |fill: &str| {+ let t = format!(r#"(kicad_pcb (version 20260206) (generator "test")+ (layers (0 "F.Cu" signal) (4 "In1.Cu" power) (6 "In2.Cu" signal) (2 "B.Cu" signal) (25 "Edge.Cuts" user))+ (footprint "T:A" (layer "F.Cu") (at 3 3) (property "Reference" "U1") (pad "1" smd rect (at 0 0) (size 1 1) (layers "F.Cu") (net "GND")))+ (footprint "T:B" (layer "F.Cu") (at 17 7) (property "Reference" "U2") (pad "1" smd rect (at 0 0) (size 1 1) (layers "F.Cu") (net "GND")))+ (zone (net "GND") (layer "In1.Cu") (name "GND plane") (polygon (pts (xy 0.5 0.5) (xy 19.5 0.5) (xy 19.5 9.5) (xy 0.5 9.5))){fill})+ (gr_rect (start 0 0) (end 20 10) (layer "Edge.Cuts")))"#);+ Board::from_text("t.kicad_pcb", t).unwrap()+ };+ let filled = mk(r#" (filled_polygon (layer "In1.Cu") (pts (xy 0.6 0.6) (xy 19.4 0.6) (xy 19.4 9.4) (xy 0.6 9.4)))"#);+ let z = filled.zones_all_layers();+ assert_eq!((z[0].layer_names(), z[0].fills.len()), (vec!["In1.Cu".to_string()], 1));+ let route = |b: Board| { let mut rules = Rules::default(); rules.planes.insert("GND".into(), "In1.Cu".into());+ let mut r = Router::new(b, rules, false); let _ = crate::drive::route_board(&mut r, 1, 2, 10); r.board_copper_summary() };+ let w = route(filled);+ assert!(w["warnings"].as_array().unwrap().is_empty(), "{w}");+ let w = route(mk(""));+ let line = w["warnings"][0].as_str().unwrap_or("");+ assert!(line.contains("GND has a zone on In1.Cu with no fill"), "{w}");+ }+ #[test] fn unnamed_mounting_holes_block_vias_without_becoming_terminals() { let extra = r#"(footprint "T:Mount"
crates/aiflow-router/src/drive.rs+4−2@@ -1431,14 +1431,16 @@ impl Router { } // a zone of a net the plan still tracks, with no fill in the board file: once refilled it // may join those pads itself, so say so instead of tracking across it in silence (issue #84)- let zones = self.board.zones();+ // issue #249: every copper layer and its fills, so a filled inner plane is neither "on ''" nor "no fill"+ let zones = self.board.zones_all_layers(); let islands = self.board.copper_fills().len(); let mut warnings: Vec<String> = Vec::new(); for net in &self.nets { if net.done_by_board || net.routes.is_empty() { continue; } let unfilled: Vec<&aiflow_board::Zone> = zones.iter().filter(|z| z.net == net.name && z.fills.is_empty()).collect(); if unfilled.is_empty() { continue; }- let mut layers: Vec<&str> = unfilled.iter().flat_map(|z| z.layers.iter().map(|&l| aiflow_board::LAYER_NAMES[l])).collect();+ let names: Vec<Vec<String>> = unfilled.iter().map(|z| z.layer_names()).collect();+ let mut layers: Vec<&str> = names.iter().flatten().map(|s| s.as_str()).collect(); layers.sort(); layers.dedup(); warnings.push(format!("{} has a zone on {} with no fill in the board file, and the plan tracks {} connection(s) of it: refill the zones (KiCad: Edit > Fill All Zones, save) and route again instead of tracking across the pour", net.name, layers.join(" and "), net.routes.len()));
docs/release-0.2.106.mdadded+8@@ -0,0 +1,8 @@+# AI Flow 0.2.106++- **An inner-layer plane is read with its layer and its fill** (#249, King Silver). A zone on one inner layer, as+ KiCad 10 writes it (`(layer "In1.Cu")` with its `filled_polygon` blocks), was read for `route`'s warning by the+ two-layer zone reader: no layer name and no fill, so a filled GND plane on In1.Cu was reported as "a zone on+ with no fill" and the hint said to refill it. The warning now reads every copper layer and its fills: a filled+ inner plane is not warned about, and an unfilled one is named by its layer. The plane itself was already used+ (`planes: {"GND": "In1.Cu"}`: each GND pad gets a short stub and a via down to the plane).
package.json+1−1@@ -1,7 +1,7 @@ { "slug": "adom-aiflow", "type": "app",- "version": "0.2.105",+ "version": "0.2.106", "title": "AI Flow", "description": "Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board. One Rust binary with a crate per step (placement helpers, a grid router with Kelvin taps, pours with keepouts, KiCad's DRC gate, live landing through the KiCad Bridge, copper measurement, current and thermal analysis) and a finish line that refuses an unfinished board. Every command answers with hints for the AI; every turn, its thinking time and every rework loop go into run.jsonl, so Claude, Codex and any other engine are compared on the same flow. KiCad, Fusion 360 and Altium Designer today (the same steps and gates through each tool's bridge); Adom's own web apps next.", "summary": "Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board. The AI thinks its way from placement through routing, pours, current and thermal analysis to a delivered video; the binary does the fast, deterministic parts of every step, hands back hints, and keeps a ledger of every turn, every return to an earlier step, and the clock from the prompt to done.",
page.json+1−1@@ -1,7 +1,7 @@ { "slug": "adom-aiflow", "type": "app",- "version": "0.2.105",+ "version": "0.2.106", "title": "AI Flow", "description": "Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board. One Rust binary with a crate per step (placement helpers, a grid router with Kelvin taps, pours with keepouts, KiCad's DRC gate, live landing through the KiCad Bridge, copper measurement, current and thermal analysis) and a finish line that refuses an unfinished board. Every command answers with hints for the AI; every turn, its thinking time and every rework loop go into run.jsonl, so Claude, Codex and any other engine are compared on the same flow. KiCad, Fusion 360 and Altium Designer today (the same steps and gates through each tool's bridge); Adom's own web apps next.", "summary": "Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board. The AI thinks its way from placement through routing, pours, current and thermal analysis to a delivered video; the binary does the fast, deterministic parts of every step, hands back hints, and keeps a ledger of every turn, every return to an earlier step, and the clock from the prompt to done.",