← Commit history
AI Flow 0.2.83: Fusion export parts, Windows out dirs, tour fields machine, Fusion silk graphics
Co-Authored-By: Claude Opus 5.5 <[email protected]>
13 files changed
+395−29
Cargo.lock+10−10Cargo.toml+1−1bin/adom-aiflowcrates/adom-aiflow/src/host_machine.rs+68crates/adom-aiflow/src/main.rs+27−4crates/adom-aiflow/src/silk_polarity.rs+17crates/adom-aiflow/src/winpath.rs+40crates/aiflow-board/src/eagle.rs+92docs/release-0.2.83.md+25package.json+1−1page.json+1−1tools/fusion-project.py+57−12tools/test_fusion_project.py+56Cargo.lock+10−10@@ -4,7 +4,7 @@ version = 4 [[package]] name = "adom-aiflow"-version = "0.2.82"+version = "0.2.83" dependencies = [ "aiflow-analyze", "aiflow-board",@@ -25,7 +25,7 @@ dependencies = [ [[package]] name = "aiflow-analyze"-version = "0.2.82"+version = "0.2.83" dependencies = [ "aiflow-board", "serde",@@ -35,7 +35,7 @@ dependencies = [ [[package]] name = "aiflow-board"-version = "0.2.82"+version = "0.2.83" dependencies = [ "roxmltree", "serde",@@ -44,7 +44,7 @@ dependencies = [ [[package]] name = "aiflow-bridge"-version = "0.2.82"+version = "0.2.83" dependencies = [ "aiflow-board", "serde",@@ -53,7 +53,7 @@ dependencies = [ [[package]] name = "aiflow-copper"-version = "0.2.82"+version = "0.2.83" dependencies = [ "aiflow-board", "aiflow-grid",@@ -63,7 +63,7 @@ dependencies = [ [[package]] name = "aiflow-grid"-version = "0.2.82"+version = "0.2.83" dependencies = [ "aiflow-board", "serde",@@ -72,7 +72,7 @@ dependencies = [ [[package]] name = "aiflow-place"-version = "0.2.82"+version = "0.2.83" dependencies = [ "aiflow-board", "serde",@@ -81,7 +81,7 @@ dependencies = [ [[package]] name = "aiflow-pours"-version = "0.2.82"+version = "0.2.83" dependencies = [ "aiflow-board", "aiflow-copper",@@ -91,7 +91,7 @@ dependencies = [ [[package]] name = "aiflow-router"-version = "0.2.82"+version = "0.2.83" dependencies = [ "aiflow-board", "aiflow-grid",@@ -101,7 +101,7 @@ dependencies = [ [[package]] name = "aiflow-run"-version = "0.2.82"+version = "0.2.83" dependencies = [ "serde", "serde_json",
Cargo.toml+1−1@@ -14,7 +14,7 @@ members = [ ] [workspace.package]-version = "0.2.82"+version = "0.2.83" edition = "2021" license = "MIT" repository = "https://wiki.adom.inc/adom/adom-aiflow"
bin/adom-aiflow⋯ 1 unchanged line ⋯
crates/adom-aiflow/src/host_machine.rsadded+68@@ -0,0 +1,68 @@+//! Issue #209 (Zoltán): which Adom Bridge machine runs this Hydrogen local workspace. The distro's hostname+//! was taken as that machine's name, but WSL rewrites a Windows name with accented letters, so `tour fields`+//! filmed on a machine the relay did not know (target_not_found three times). The name is now matched+//! against `adom-bridge targets`: exactly, then with accents and punctuation folded away.+use serde_json::Value;++/// The names Adom Bridge knows (each target's name).+pub fn names(targets: &Value) -> Vec<String> {+ targets["targets"].as_array().into_iter().flatten().filter_map(|t| t["name"].as_str().map(str::to_string)).collect()+}++/// The target (its name, as Adom Bridge spells it) that one of `candidates` names; None when none does,+/// or when a folded match is ambiguous.+pub fn pick(candidates: &[String], targets: &Value) -> Option<String> {+ let rows: Vec<(String, Vec<String>)> = targets["targets"].as_array().into_iter().flatten().filter_map(|t| {+ let name = t["name"].as_str()?.to_string();+ let mut keys = vec![name.clone()];+ if let Some(h) = t["hostname"].as_str() { keys.push(h.to_string()); }+ Some((name, keys))+ }).collect();+ for fold in [exact as fn(&str) -> String, ascii_letters, transliterated] {+ let hits: Vec<&String> = rows.iter().filter(|(_, keys)| keys.iter().any(|k| candidates.iter().any(|c| !fold(c).is_empty() && fold(c) == fold(k)))).map(|(n, _)| n).collect();+ if hits.len() == 1 { return Some(hits[0].clone()); }+ if hits.len() > 1 { return None; }+ }+ None+}++fn exact(s: &str) -> String { s.trim().to_lowercase() }++/// Letters and digits only, non-ASCII dropped ("Zoltán-PC" and WSL's "ZOLTN-PC" both read "zoltnpc").+fn ascii_letters(s: &str) -> String { s.chars().filter(|c| c.is_ascii_alphanumeric()).map(|c| c.to_ascii_lowercase()).collect() }++/// Accented Latin letters as their base letter ("Zoltán-PC" reads "zoltanpc").+fn transliterated(s: &str) -> String {+ s.chars().map(|c| match c.to_lowercase().next().unwrap_or(c) {+ 'á' | 'à' | 'â' | 'ä' | 'ã' | 'å' | 'ā' | 'ą' => 'a', 'é' | 'è' | 'ê' | 'ë' | 'ě' | 'ę' | 'ē' => 'e',+ 'í' | 'ì' | 'î' | 'ï' | 'ī' => 'i', 'ó' | 'ò' | 'ô' | 'ö' | 'õ' | 'ő' | 'ø' | 'ō' => 'o',+ 'ú' | 'ù' | 'û' | 'ü' | 'ű' | 'ů' | 'ū' => 'u', 'ý' | 'ÿ' => 'y', 'ç' | 'č' | 'ć' => 'c', 'ñ' | 'ń' | 'ň' => 'n',+ 'š' | 'ś' => 's', 'ž' | 'ź' | 'ż' => 'z', 'ř' => 'r', 'ď' => 'd', 'ť' => 't', 'ł' => 'l', 'ß' => 's', o => o,+ }).filter(|c| c.is_ascii_alphanumeric()).collect()+}++#[cfg(test)]+mod tests {+ use super::*;+ use serde_json::json;++ fn targets(names: &[&str]) -> Value { json!({"targets": names.iter().map(|n| json!({"name": n, "hostname": n})).collect::<Vec<_>>()}) }++ #[test]+ fn the_host_is_found_however_wsl_spelled_it() {+ let t = targets(&["Zoltán-Laptop", "Zoltán-PC"]);+ assert_eq!(pick(&["ZOLTN-PC".into()], &t).as_deref(), Some("Zoltán-PC"), "accent dropped");+ assert_eq!(pick(&["Zoltan-PC".into()], &t).as_deref(), Some("Zoltán-PC"), "accent transliterated");+ assert_eq!(pick(&["zoltán-pc".into()], &t).as_deref(), Some("Zoltán-PC"), "case");+ assert_eq!(pick(&["Colby-ROG2".into()], &targets(&["Colby-ROG2", "DESKTOP-BAR6S0F"])).as_deref(), Some("Colby-ROG2"));+ assert_eq!(pick(&["adom-workspace".into()], &t), None, "an unknown name is not guessed");+ let named = json!({"targets": [{"name": "Shop PC", "hostname": "DESKTOP-ABC123"}]});+ assert_eq!(pick(&["DESKTOP-ABC123".into()], &named).as_deref(), Some("Shop PC"), "a renamed machine by its hostname");+ assert_eq!(names(&t), vec!["Zoltán-Laptop".to_string(), "Zoltán-PC".to_string()]);+ }++ #[test]+ fn a_folded_match_on_two_machines_is_not_a_choice() {+ assert_eq!(pick(&["PC1".into()], &targets(&["PC-1", "PC_1"])), None);+ }+}
crates/adom-aiflow/src/main.rs+27−4@@ -2,6 +2,8 @@ //! Every reply starts with OK: or ERROR: and carries Hint: lines that depend on this board and run. mod continuation; mod fields_versions;+mod winpath;+mod host_machine; mod supply; mod priorities; mod part_check;@@ -971,10 +973,23 @@ fn primary_machine() -> Option<String> { } /// The desktop this container runs on, when that is knowable: under Hydrogen's local mode-/// (ADOM_DESKTOP_MODE=local, a WSL distro) the container shares the Windows machine's hostname.+/// (ADOM_DESKTOP_MODE=local, a WSL distro), the Adom Bridge machine the distro's hostname (or Windows'+/// own, through interop) names. Issue #209: WSL rewrites accented names, so the hostname alone could name+/// a machine the relay does not know; it is matched against `adom-bridge targets` (host_machine.rs). fn container_host() -> Option<String> { if std::env::var("ADOM_DESKTOP_MODE").ok().as_deref() != Some("local") { return None; }- std::fs::read_to_string("/proc/sys/kernel/hostname").ok().map(|h| h.trim().to_string()).filter(|h| !h.is_empty())+ let linux = std::fs::read_to_string("/proc/sys/kernel/hostname").ok().map(|h| h.trim().to_string()).filter(|h| !h.is_empty());+ let targets = std::process::Command::new("adom-bridge").arg("targets").output().ok().and_then(|o| serde_json::from_slice::<Value>(&o.stdout).ok());+ let Some(t) = targets.filter(|t| t["targets"].is_array()) else { return linux };+ let mut cands: Vec<String> = linux.clone().into_iter().collect();+ if let Some(h) = host_machine::pick(&cands, &t) { return Some(h); }+ if let Ok(o) = std::process::Command::new("timeout").args(["5", "/mnt/c/Windows/System32/hostname.exe"]).output() {+ let w = String::from_utf8_lossy(&o.stdout).trim().to_string();+ if !w.is_empty() { cands.push(w); }+ }+ let found = host_machine::pick(&cands, &t);+ if found.is_none() { eprintln!("NOTE: this workspace's machine ({}) is not one Adom Bridge lists ({}); say which with --on <name>", cands.join(" / "), host_machine::names(&t).join(", ")); }+ found } /// The run's screen mode (screen.rs, issues #132/#135), recorded in run.json `screenMode` and said@@ -3900,6 +3915,8 @@ fn main() { if lane != "kicad" { err(&format!("this run builds in {}: its export is the tool's own", aiflow_bridge::eda::active().name()), &[format!("`adom-aiflow {lane} export` writes and checks the set from the {lane} design (Gerbers, drill, CPL, BOM).")]); } let board_path = board.clone().unwrap_or_else(|| r.current_board()); let out_dir = out.clone().unwrap_or_else(|| dir.join("manufacturing"));+ // issue #208: a Windows --out is the same folder under /mnt/<drive>, never a local "C:" folder+ let out_dir = winpath::local(&out_dir, Path::new("/mnt")).unwrap_or_else(|e| err(&e, &["The files are written in this workspace: pass a path here (default <run>/manufacturing), then send them to the desktop.".into()])); let kicad = std::env::var("ADOM_AIFLOW_KICAD_CLI").unwrap_or_else(|_| "kicad-cli".into()); let off = export::off_board(&spec_soft(&r)); match export::export_with(&board_path, &out_dir, &kicad, &off) {@@ -3939,7 +3956,7 @@ fn main() { } let facts = Board::load(&board_path).ok().filter(|_| mechanical::applies(&board_path)).map(|b| verified::board_facts(&b, &board_path, &project_dir_of(&r), &spec_soft(&r))); let checked = verified::run_items(&r, facts.as_ref());- ok(&format!("manufacturing files in {}, checked against the board: Gerbers ({} copper layers of {}, pours present as regions on {} poured layer(s)), drill ({} hits = vias and drilled pads), pick and place ({} parts) and BOM ({} lines) for review, not a fab's upload format (a fab's own come from its ordering stage; {} says which file goes where)\n{}", out_dir.display(), report["gerbers"]["copperLayers"], report["gerbers"]["boardCopperLayers"], report["fillsGerbers"]["layersWithPours"].as_object().map(|o| o.len()).unwrap_or(0), report["drill"]["hits"], report["cpl"]["refs"], report["bom"]["lines"], export::ORDER_NOTE, verified::message(&checked)), &hints);+ ok(&format!("manufacturing files in {}, checked against the board: Gerbers ({} copper layers of {}, pours present as regions on {} poured layer(s)), drill ({} hits = vias and drilled pads), pick and place ({} parts) and BOM ({} lines) for review, not a fab's upload format (a fab's own come from its ordering stage; {} says which file goes where)\n{}", winpath::shown(&out_dir), report["gerbers"]["copperLayers"], report["gerbers"]["boardCopperLayers"], report["fillsGerbers"]["layersWithPours"].as_object().map(|o| o.len()).unwrap_or(0), report["drill"]["hits"], report["cpl"]["refs"], report["bom"]["lines"], export::ORDER_NOTE, verified::message(&checked)), &hints); } Err((report, problems)) => { let _ = std::fs::create_dir_all(&out_dir);@@ -7189,7 +7206,7 @@ fn main() { let _ = br.call("pup_prewarm", &json!({"reason": "aiflow fields walkthrough: warming pup on the test box"})); for _ in 0..30 { let rd = br.call("pup_readiness", &json!({}));- if rd["ready"].as_bool() == Some(true) { break; }+ if rd["ready"].as_bool() == Some(true) || rd["errorCode"] == "target_not_found" { break; } std::thread::sleep(std::time::Duration::from_secs(3)); } // a fresh pup session every time: a session whose browser died answers browser_gone forever@@ -7204,6 +7221,7 @@ fn main() { sid = format!("aiflow-fields-{}{}", now().chars().filter(|c| c.is_ascii_digit()).skip(8).collect::<String>(), if attempt > 0 { "-retry" } else { "" }); let op = br.call("pup_open_window", &json!({"sessionId": sid, "url": proxy, "width": 1600, "height": 1000, "reason": "aiflow fields walkthrough: the AI's current and heat analysis on camera"})); open_err = if Bridge::ok(&op) { None } else { Some(op["errorCode"].as_str().or(op["error"].as_str()).unwrap_or("?").chars().take(200).collect::<String>()) };+ if open_err.as_deref().is_some_and(|e| e.contains("target_not_found")) { break; } // pup can take a minute to bring a browser up on a cold box: the window is polled for, not assumed for _ in 0..40 { std::thread::sleep(std::time::Duration::from_secs(2));@@ -7234,6 +7252,11 @@ fn main() { } if hwnd.is_some() { break; } }+ // issue #209: target_not_found is the relay's answer for a machine name it does not know, not pup's+ if open_err.as_deref().is_some_and(|e| e.contains("target_not_found")) {+ let known = std::process::Command::new("adom-bridge").arg("targets").output().ok().and_then(|o| serde_json::from_slice::<Value>(&o.stdout).ok()).map(|t| host_machine::names(&t)).unwrap_or_default();+ err(&format!("Adom Bridge knows no machine named \"{}\", so the Fields window could not be opened there", br.target), &[format!("The machines it knows: {}. Film on the one running this workspace: `tour fields --port {port} --on <its name>`.", if known.is_empty() { "none listed (adom-bridge targets)".to_string() } else { known.join(", ") })]);+ } let Some(win) = hwnd else { let _ = br.call("pup_close_window", &json!({"sessionId": sid})); err(&format!("the app's window did not appear on {} (no window for this walkthrough session{})", br.target, open_err.map(|e| format!("; pup said {e}")).unwrap_or_default()), &["`adom-bridge --target <box> pup_readiness` says whether pup is ready there; a browser_gone means pup's browser died: `pup_close_window` the old sessions or restart pup on the box.".into(), match (preboard::proxy_is_local(&proxy), &host) { (true, Some(h)) if br.target.eq_ignore_ascii_case(h) => format!("This is the right machine: {h} runs this container and is the only one that can open {proxy}. Retry `tour fields --port {port}` here (pup can take longer than this wait on a cold box); never pass --on another machine, which cannot open a localhost URL."), (true, Some(h)) => format!("The URL {proxy} is a localhost proxy: only {h}, the machine running this container, can open it. `tour fields --port {port}` with no --on films there."),
crates/adom-aiflow/src/silk_polarity.rs+17@@ -445,4 +445,21 @@ mod tests { assert_eq!((c["testPoints"]["found"].clone(), c["testPoints"]["labelled"].clone(), c["testPoints"]["unlabelled"].clone(), c["testPoints"]["mismatched"].clone()), (json!(4), json!(1), json!(2), json!(1))); assert_eq!(label_check_lines(&c)[1], "test points: 4 (TP1 +3V3, TP2 PH1, TP3 USB_D+, X9 Net-(TP4-Pad1)), 1 labelled with their net, 2 unlabelled, 1 labelled with another net"); }++ /// Issue #210: a cathode dot drawn on the board in Fusion (a tPlace circle) is the diode's mark.+ #[test]+ fn a_fusion_board_level_dot_is_a_polarity_mark() {+ let brd = r#"<?xml version="1.0"?><eagle><drawing><board>+<plain><wire x1="0" y1="0" x2="20" y2="0" width="0" layer="20"/><wire x1="20" y1="0" x2="20" y2="10" width="0" layer="20"/><wire x1="20" y1="10" x2="0" y2="10" width="0" layer="20"/><wire x1="0" y1="10" x2="0" y2="0" width="0" layer="20"/>DOT</plain>+<libraries><library name="L"><packages><package name="SOD323"><smd name="1" x="-1" y="0" dx="0.6" dy="0.5" layer="1"/><smd name="2" x="1" y="0" dx="0.6" dy="0.5" layer="1"/></package></packages></library></libraries>+<elements><element name="D1" library="L" package="SOD323" value="BAT54" x="10" y="5"/></elements>+<signals><signal name="A"><contactref element="D1" pad="1"/></signal><signal name="B"><contactref element="D1" pad="2"/></signal></signals></board></drawing></eagle>"#;+ let unmarked = |dot: &str| {+ let b = aiflow_board::Board::from_text("t.kicad_pcb", aiflow_board::eagle::to_kicad(&brd.replace("DOT", dot)).unwrap()).unwrap();+ warnings(&b).iter().any(|w| w.contains("polarity") && w.contains("D1"))+ };+ assert!(unmarked(""), "no mark: the warning stands");+ assert!(!unmarked(r#"<circle x="8.4" y="5" radius="0.2" width="0" layer="21"/>"#), "the board-level dot beside pad 1 is the mark");+ }+ }
crates/adom-aiflow/src/winpath.rsadded+40@@ -0,0 +1,40 @@+//! Issue #208 (Zoltán): a Windows path handed to a command that writes in this Linux workspace+//! (C:/Users/... or C:\Users\...) is the same folder under /mnt/<drive>, never a local folder named "C:".+use std::path::{Path, PathBuf};++/// The path as this workspace sees it: a Windows drive path under `mnt` (/mnt), anything else unchanged.+/// Err when it is a Windows path and that drive is not mounted here.+pub fn local(p: &Path, mnt: &Path) -> Result<PathBuf, String> {+ let s = p.to_string_lossy();+ let b = s.as_bytes();+ if cfg!(windows) || b.len() < 3 || !b[0].is_ascii_alphabetic() || b[1] != b':' || !(b[2] == b'/' || b[2] == b'\\') { return Ok(p.to_path_buf()); }+ let drive = mnt.join((b[0] as char).to_ascii_lowercase().to_string());+ if !drive.is_dir() { return Err(format!("{s} is a Windows path, and this workspace has no {} to reach that drive", drive.display())); }+ Ok(s[3..].split(['/', '\\']).filter(|x| !x.is_empty()).fold(drive, |acc, x| acc.join(x)))+}++/// A workspace path, with its Windows form when it is on a mounted drive (/mnt/c/x = C:/x).+pub fn shown(p: &Path) -> String {+ let s = p.display().to_string();+ let rest = s.strip_prefix("/mnt/").filter(|r| r.len() == 1 || r.as_bytes().get(1) == Some(&b'/'));+ match rest { Some(r) => format!("{s} ({}:{} on Windows)", r[..1].to_uppercase(), if r.len() > 1 { &r[1..] } else { "/" }), None => s }+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn a_windows_path_is_the_mounted_drive() {+ let mnt = std::env::temp_dir().join(format!("aiflow-winpath-{}", std::process::id()));+ std::fs::create_dir_all(mnt.join("c")).unwrap();+ assert_eq!(local(Path::new("C:/Users/me/Documents/JLCPCB_X"), &mnt).unwrap(), mnt.join("c/Users/me/Documents/JLCPCB_X"));+ assert_eq!(local(Path::new(r"C:\Users\me\out"), &mnt).unwrap(), mnt.join("c/Users/me/out"));+ assert!(local(Path::new("D:/x"), &mnt).unwrap_err().contains("no "), "an unmounted drive is refused");+ assert_eq!(local(Path::new("manufacturing"), &mnt).unwrap(), PathBuf::from("manufacturing"));+ assert_eq!(local(Path::new("/home/me/x"), &mnt).unwrap(), PathBuf::from("/home/me/x"));+ assert_eq!(shown(Path::new("/mnt/c/Users/me")), "/mnt/c/Users/me (C:/Users/me on Windows)");+ assert_eq!(shown(Path::new("/home/me")), "/home/me");+ assert_eq!(shown(Path::new("/mnt/wsl/x")), "/mnt/wsl/x");+ }+}
crates/aiflow-board/src/eagle.rs+92@@ -249,6 +249,12 @@ pub fn to_kicad(text: &str) -> Result<String, String> { let _ = writeln!(o, " (pad {} thru_hole {shape} (at {} {} {}) (size {} {}) (drill {}) (layers \"*.Cu\" \"*.Mask\") {pn})", q(&name), n(lx), n(ly), n(ang), n(sx), n(sy), n(drill)); } }+ // the package's own silkscreen graphics (a pin-1 dot, a cathode bar), in the footprint's frame as+ // its pads are: plain y negation, or straight to board space less the origin on a mirrored part+ let shapes: Vec<roxmltree::Node> = pkg.children().filter(|x| matches!(x.tag_name().name(), "wire" | "circle" | "polygon" | "rectangle")).collect();+ let flip = |l: &str| silk_layer(&if mirror { flip_layer(l) } else { l.to_string() });+ let local = |p: (f64, f64)| if mirror { let (wx, wy) = place(p, (ex, ey), ea, true); (wx - ex, yy(wy) - fy) } else { (p.0, -p.1) };+ silk_shapes(&mut o, "fp", " ", &shapes, &flip, &local); o.push_str(" )\n"); silk_of_element(&mut silk, &e, pkg, (ex, ey), ea, mirror); }@@ -261,6 +267,10 @@ pub fn to_kicad(text: &str) -> Result<String, String> { let (d, m) = parse_rot(t.attribute("rot")); silk_text(&mut o, content, (f(&t, "x"), f(&t, "y")), f(&t, "size"), f(&t, "ratio"), (d, m, t.attribute("rot").unwrap_or("").contains('S')), t.attribute("align").unwrap_or(""), l); }+ // issue #210: board-level silkscreen circles, wires, polygons and rectangles (a pin-1 or cathode dot+ // drawn on tPlace/bPlace is printed, so the polarity check must see it)+ let shapes: Vec<roxmltree::Node> = plain.children().filter(|x| matches!(x.tag_name().name(), "wire" | "circle" | "polygon" | "rectangle")).collect();+ silk_shapes(&mut o, "gr", " ", &shapes, &|l: &str| silk_layer(l), &|p: (f64, f64)| (p.0, yy(p.1))); } // outline: the Dimension layer@@ -337,6 +347,58 @@ pub fn to_kicad(text: &str) -> Result<String, String> { /// The silkscreen text an element shows: a smashed element its displayed attributes where they stand /// (their layer is already the board's), an unsmashed one its package texts through its transform.+/// Silkscreen graphics (issue #210): wires (arcs when curved), circles, polygons and rectangles on the+/// silkscreen layers, written as `<kind>_line/_arc/_circle/_poly` (`gr` on the board, `fp` in a footprint).+/// `pt` maps an EAGLE point to the KiCad frame being written; `lyr` names the KiCad layer for an EAGLE one.+fn silk_shapes(o: &mut String, kind: &str, indent: &str, items: &[roxmltree::Node], lyr: &dyn Fn(&str) -> Option<&'static str>, pt: &dyn Fn((f64, f64)) -> (f64, f64)) {+ let w_of = |x: &roxmltree::Node| { let w = f(x, "width"); if w > 0.0 { w } else { 0.1 } };+ for x in items {+ let Some(l) = lyr(x.attribute("layer").unwrap_or("")) else { continue };+ match x.tag_name().name() {+ "wire" => {+ let (a, b, curve) = ((f(x, "x1"), f(x, "y1")), (f(x, "x2"), f(x, "y2")), f(x, "curve"));+ let (pa, pb) = (pt(a), pt(b));+ if curve.abs() > 1e-6 {+ let m = pt(arc_mid(a, b, curve));+ let _ = writeln!(o, "{indent}({kind}_arc (start {} {}) (mid {} {}) (end {} {}) (stroke (width {}) (type solid)) (layer \"{l}\"))", n(pa.0), n(pa.1), n(m.0), n(m.1), n(pb.0), n(pb.1), n(w_of(x)));+ } else {+ let _ = writeln!(o, "{indent}({kind}_line (start {} {}) (end {} {}) (stroke (width {}) (type solid)) (layer \"{l}\"))", n(pa.0), n(pa.1), n(pb.0), n(pb.1), n(w_of(x)));+ }+ }+ "circle" => {+ let (c, r) = (pt((f(x, "x"), f(x, "y"))), f(x, "radius"));+ // width 0: EAGLE fills the circle (a pin-1 dot)+ let fill = if f(x, "width") <= 0.0 { "solid" } else { "no" };+ let _ = writeln!(o, "{indent}({kind}_circle (center {} {}) (end {} {}) (stroke (width {}) (type solid)) (fill {fill}) (layer \"{l}\"))", n(c.0), n(c.1), n(c.0 + r), n(c.1), n(if fill == "solid" { 0.0 } else { w_of(x) }));+ }+ "polygon" | "rectangle" => {+ let mut pts: Vec<(f64, f64)> = Vec::new();+ if x.tag_name().name() == "rectangle" {+ let (x1, y1, x2, y2) = (f(x, "x1"), f(x, "y1"), f(x, "x2"), f(x, "y2"));+ let (deg, _) = parse_rot(x.attribute("rot"));+ let c = ((x1 + x2) / 2.0, (y1 + y2) / 2.0);+ for q in [(x1, y1), (x2, y1), (x2, y2), (x1, y2)] { pts.push(place((q.0 - c.0, q.1 - c.1), c, deg, false)); }+ } else {+ let vs: Vec<((f64, f64), f64)> = x.children().filter(|v| v.has_tag_name("vertex")).map(|v| ((f(&v, "x"), f(&v, "y")), f(&v, "curve"))).collect();+ for (i, (p, curve)) in vs.iter().enumerate() {+ pts.push(*p);+ if curve.abs() > 1e-6 {+ let q = vs[(i + 1) % vs.len()].0;+ let arc = crate::geom::arc_points(*p, arc_mid(*p, q, *curve), q, 0.25);+ pts.extend(arc[1..arc.len() - 1].iter().copied());+ }+ }+ }+ if pts.len() < 3 { continue; }+ let _ = write!(o, "{indent}({kind}_poly (pts");+ for p in &pts { let m = pt(*p); let _ = write!(o, " (xy {} {})", n(m.0), n(m.1)); }+ let _ = writeln!(o, ") (stroke (width 0) (type solid)) (fill solid) (layer \"{l}\"))");+ }+ _ => {}+ }+ }+}+ fn silk_of_element(o: &mut String, e: &roxmltree::Node, pkg: &roxmltree::Node, at: (f64, f64), ea: f64, mirror: bool) { let name = e.attribute("name").unwrap_or(""); let value = e.attribute("value").unwrap_or("");@@ -561,4 +623,34 @@ mod tests { assert_eq!(crate::eagle::bottom_number(&brd.replace("number=\"304\" name=\"Bottom\"", "number=\"305\" name=\"Other\"").replace("number=\"16\" name=\"Route16\"", "number=\"16\" name=\"Bottom\"")), Some(16), "an older board's Bottom is 16"); } ++ /// Issue #210: board-level silkscreen graphics come along, and a package's pin-1 dot sits on pad 1 of+ /// a part on the bottom turned 90 degrees, as its pad does.+ #[test]+ fn silkscreen_graphics_come_along_on_the_board_and_in_the_package() {+ let brd = BRD.replace("</plain>", r#"<circle x="4" y="5" radius="0.2" width="0" layer="21"/><wire x1="1" y1="8" x2="3" y2="8" width="0.15" layer="22"/><polygon width="0" layer="21"><vertex x="15" y="2"/><vertex x="16" y="2"/><vertex x="15.5" y="3"/></polygon><wire x1="1" y1="1" x2="2" y2="2" width="0.1" layer="51"/></plain>"#)+ .replace(r#"<smd name="2" x="0.5" y="0" dx="0.5" dy="0.6" layer="1"/></package>"#, r#"<smd name="2" x="0.5" y="0" dx="0.5" dy="0.6" layer="1"/><circle x="-0.5" y="0" radius="0.1" width="0" layer="21"/></package>"#)+ .replace(r#"rot="MR0""#, r#"rot="MR90""#);+ let text = super::to_kicad(&brd).unwrap();+ assert!(text.contains(r#"(gr_circle (center 4 -5) (end 4.2 -5) (stroke (width 0) (type solid)) (fill solid) (layer "F.SilkS"))"#), "{text}");+ assert!(text.contains(r#"(gr_line (start 1 -8) (end 3 -8) (stroke (width 0.15) (type solid)) (layer "B.SilkS"))"#), "{text}");+ assert!(text.contains(r#"(gr_poly (pts (xy 15 -2) (xy 16 -2) (xy 15.5 -3))"#), "{text}");+ assert!(!text.contains("(xy 1 -1)") && !text.contains("(start 1 -1)"), "a documentation layer is not silkscreen");+ let b = crate::Board::from_text("t.kicad_pcb", text.clone()).unwrap();+ for r in ["R1", "R2"] {+ let pad1 = b.pads_of(r).into_iter().find(|p| p.name == "1").unwrap();+ let fp = b.root.find_all("footprint").find(|f| crate::reference_of(f).as_deref() == Some(r)).unwrap();+ let c = fp.find("fp_circle").unwrap_or_else(|| panic!("{r}: no fp_circle"));+ let layer = c.find("layer").and_then(|l| l.value()).unwrap();+ assert_eq!(layer, if r == "R2" { "B.SilkS" } else { "F.SilkS" }, "{r}");+ let at = fp.find("at").unwrap();+ let (fx, fy, fa) = (at.number(1).unwrap(), at.number(2).unwrap(), at.number(3).unwrap_or(0.0));+ let cc = c.find("center").unwrap();+ // footprint-local to board, as KiCad does (rotation by -angle in screen y-down)+ let (lx, ly, a) = (cc.number(1).unwrap(), cc.number(2).unwrap(), -fa.to_radians());+ let w = (fx + lx * a.cos() - ly * a.sin(), fy + lx * a.sin() + ly * a.cos());+ assert!((w.0 - pad1.x).abs() < 1e-6 && (w.1 - pad1.y).abs() < 1e-6, "{r}: dot at {w:?}, pad 1 at ({}, {})", pad1.x, pad1.y);+ }+ }+ }
docs/release-0.2.83.mdadded+25@@ -0,0 +1,25 @@+# AI Flow 0.2.83++Four Fusion-lane fixes from Zoltán's run.++- **`fusion export` keeps every part the fab places** (#207). Parts with no MPN (buck ICs and inductors with only+ an LCSC number, bulk caps) were taken for test points and left out of the pick and place, and the check that every+ placed part is in both files skipped them, so export said OK. The Fusion bridge's "no MPN" list and its+ "(board only)" placeholder are no longer read as test points: a test point is a test-point package or part, PCB+ copper, or a part the library made board-only. Parts the design marks not fitted (populate off, a DNP attribute,+ the bridge BOM's `excluded`) now leave the pick and place and the JLCPCB BOM, and the OK line lists them under+ that reason. Parts with neither an MPN nor an LCSC number stay in the pick and place and are named as such.+- **A Windows `--out-dir`** (#208). `fusion export --out-dir C:/Users/...` (and `export --out` on the KiCad lane)+ writes to the same folder under /mnt/c instead of a local folder named `C:`, and the OK line gives both forms.+ Without that drive mounted, it says so. The other Fusion-lane path options read Windows paths the same way.+- **`tour fields` films on the right machine** (#209). On a Hydrogen local workspace it filmed on the machine named+ by the distro's hostname, which WSL rewrites for a Windows name with accented letters, so Adom Bridge answered+ `target_not_found`. The machine is now matched against `adom-bridge targets` (exactly, then with accents and+ punctuation folded, and Windows' own hostname through interop); `--on <name>` works when no match is found; and a+ `target_not_found` stops the waits at once and names the machines Adom Bridge knows.+- **Fusion silkscreen graphics come along** (#210). The .brd converter carried silkscreen text only. Board-level+ circles, wires, arcs, polygons and rectangles on tPlace/bPlace are now `gr_*` on F.SilkS/B.SilkS, and each+ package's own silkscreen graphics are `fp_*` in its footprint (bottom parts flipped as their pads are), so the+ polarity check sees a pin-1 or cathode dot drawn in Fusion.++Tests added for each.
package.json+1−1@@ -1,7 +1,7 @@ { "slug": "adom-aiflow", "type": "app",- "version": "0.2.82",+ "version": "0.2.83", "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.82",+ "version": "0.2.83", "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.",
tools/fusion-project.py+57−12@@ -1971,11 +1971,15 @@ TP_NAME = re.compile(r'test[ _.-]?(point|pad)|^tp[_-]', re.I) MACHINE_NAME = re.compile(r'machine[ _-]?(contact|pin)|press[ _-]?fit', re.I) -def fab_roles(text, st, board_only=()):- """{ref: 'tp' | 'machine'} for the parts a fab must not place: bare-copper test points (a test point- package or part, a MANUFACTURER of PCB copper, a part the library recorded as board only) and the- machine contacts and pins (press-fit Adom stock, fitted after assembly: DNP)."""+def fab_roles(text, st, board_only=(), not_fitted=()):+ """{ref: 'tp' | 'machine' | 'dnp'} for the parts a fab must not place: bare-copper test points (a test+ point package or part, a MANUFACTURER of PCB copper, a part the library recorded as board only), the+ machine contacts and pins (press-fit Adom stock, fitted after assembly: DNP) and the parts the design+ marks not fitted (populate="no", a DNP attribute, the bridge BOM's `excluded`).+ `board_only` is refs known to be bare copper. Never the bridge BOM's own `boardOnly`, which is every+ line with no MPN: real ICs and inductors with only an LCSC number went out as test points (issue #207).""" roles = {r: 'tp' for r in board_only}+ for r in not_fitted: roles.setdefault(r, 'dnp') only = {m for m, p in (st.get('parts') or {}).items() if p.get('boardOnly')} for r, m in (st.get('refs') or {}).items(): if m in only: roles[r] = 'tp'@@ -1986,9 +1990,15 @@ def fab_roles(text, st, board_only=()): names = ' '.join([e.get('package') or '', e.get('library') or '', e.get('value') or '', attrs.get('MPN', ''), attrs.get('DEVICESET', '')]) if TP_NAME.search(names) or re.search(r'pcb copper|board only', attrs.get('MANUFACTURER', ''), re.I) or attrs.get('MPN', '').upper() in {m.upper() for m in only}: roles[ref] = 'tp' elif MACHINE_NAME.search(names): roles[ref] = 'machine'+ elif e.get('populate') == 'no' or attrs.get('DNP', '').lower() in ('yes', 'true', '1'): roles.setdefault(ref, 'dnp') return roles +def bridge_refs(groups):+ """The bridge BOM's designator lists ("C1 C2 C15" per line) as single refs."""+ return sorted({x for g in (groups or ()) for x in re.split(r'[ ,;]+', str(g)) if x.strip()})++ def fab_rewrite(path, roles, drop_machine=False): """Rewrite a BOM or pick-and-place CSV in place: test points out, machine contacts/pins out of the CPL (and the fab BOM) or marked DNP in the BOM. A BOM row also names its parts by package and maker, so@@ -2010,13 +2020,17 @@ def fab_rewrite(path, roles, drop_machine=False): refs = [x for x in re.split(r'[ ,;]+', row[di]) if x.strip()] sep = ',' if ',' in row[di] else ' ' info = ' '.join(row[i] for i, c in enumerate(h) if c in ('package', 'footprint', 'mpn', 'value', 'comment') and i < len(row))- maker = ' '.join(row[i] for i, c in enumerate(h) if c in ('manufacturer', 'mpn') and i < len(row))- if bom and (TP_NAME.search(info) or re.search(r'pcb copper|board only', maker, re.I)):+ maker = ' '.join(row[i] for i, c in enumerate(h) if c == 'manufacturer' and i < len(row))+ # issue #207: the bridge BOM writes "(board only)" as the MPN and "test point" as the value of every+ # line with no MPN; that placeholder is no evidence, so such a line is left to the board source+ mpn_cell = next((row[i] for i, c in enumerate(h) if c == 'mpn' and i < len(row)), '').strip()+ placeholder = mpn_cell.lower() in ('', '(board only)')+ if bom and not placeholder and (TP_NAME.search(info) or re.search(r'pcb copper|board only', maker, re.I)): for r in refs: roles.setdefault(r, 'tp')- elif bom and MACHINE_NAME.search(info):+ elif bom and not placeholder and MACHINE_NAME.search(info): for r in refs: roles.setdefault(r, 'machine')- keep = [r for r in refs if roles.get(r) not in ('tp', 'machine')]- mach = [r for r in refs if roles.get(r) == 'machine']+ keep = [r for r in refs if roles.get(r) not in ('tp', 'machine', 'dnp')]+ mach = [r for r in refs if roles.get(r) in ('machine', 'dnp')] changed |= set(refs) - set(keep) def part(rs, dnp): nr = list(row) + [''] * (len(h) - len(row)); nr[di] = sep.join(rs)@@ -2050,6 +2064,28 @@ def gerber_copper_problem(names, copper): return 'the board has %d copper layers but the Gerbers carry %d inner layer(s), not %d' % (copper, len(inner), copper - 2) +LOCAL_PATH_ARGS = ('out_dir', 'board_out', 'parts', 'footprints', 'numbers', 'kicad', 'spec', 'netlist', 'fixed', 'mpns', 'layout', 'board_file')+WIN_PATH = re.compile(r'^([A-Za-z]):[\\/](.*)$')+++def local_path(p, mnt='/mnt'):+ """A Windows path (C:/Users/... or C:\\Users\\...) as the same folder seen from this Linux workspace+ (/mnt/c/Users/...). Refused with a hint where that drive is not mounted; any other path as given."""+ m = WIN_PATH.match(str(p))+ if not m or os.name == 'nt': return p+ drive = os.path.join(mnt, m.group(1).lower())+ if not os.path.isdir(drive):+ err('%s is a Windows path, and this workspace has no %s to reach that drive' % (p, drive),+ ['The files are written in this workspace: pass a path here (the run folder is the default), then pull_file or send them to the desktop.'])+ return os.path.join(drive, *[x for x in re.split(r'[\\/]+', m.group(2)) if x])+++def shown_path(p):+ """A workspace path, with its Windows form when it is on a mounted drive (/mnt/c/... = C:/...)."""+ m = re.match(r'^/mnt/([a-z])(/.*)?$', str(p))+ return '%s (%s:%s on Windows)' % (p, m.group(1).upper(), m.group(2) or '/') if m else str(p)++ def cmd_export(a): st = load_state(); name = a.design or st.get('design') if not name: err('which design? pass --design <name>')@@ -2085,12 +2121,15 @@ def cmd_export(a): board_refs = set(re.findall(r'<element name="([^"]+)"', text)) # fab-ready as written: bare-copper test points are not parts (out of both files), the machine contacts # and pins are fitted after assembly (DNP in the BOM, out of the pick and place and the fab's BOM)- roles = fab_roles(text, st, b.get('boardOnly') or ())+ # issue #207: the bridge's boardOnly is "no MPN", not "bare copper"; its excluded is the not-fitted parts+ roles = fab_roles(text, st, (), b.get('excluded') or ())+ no_number = [r for r in bridge_refs(b.get('notInJlcpcbBom') if 'notInJlcpcbBom' in b else b.get('boardOnly')) if r not in roles and r in board_refs] for f_, drop in (('bom.csv', False), ('bom-jlcpcb.csv', True), (name + '-cpl.csv', True)): try: if (out / f_).is_file(): fab_rewrite(out / f_, roles, drop) except Exception as e: problems.append('%s could not be made fab-ready (%s)' % (f_, e)) tps = sorted(r for r, k in roles.items() if k == 'tp'); dnp = sorted(r for r, k in roles.items() if k == 'machine')+ unfitted = sorted(r for r, k in roles.items() if k == 'dnp' and r in board_refs) def refs_in(path, cols, dnp_too=True): try: rows = list(csv.reader(open(path, newline='', encoding='utf-8-sig')))@@ -2117,10 +2156,12 @@ def cmd_export(a): if problems: err('manufacturing files written to %s, but they do not check out: %s' % (out, '; '.join(problems)), ['Fix the export (the CAM job, the parts\' attributes) and run `fusion export` again; never hand the human files that do not match the board.']) prove('export', {'dir': str(out.resolve()), 'gerberFiles': len(names), 'bomRefs': len(bom_refs), 'cplRefs': len(cpl_refs)}) if os.environ.get('AIFLOW_EXE'): run([os.environ['AIFLOW_EXE'], '--run', str(RUN), 'timeline', 'write'], timeout=60)- ok('manufacturing files in %s, checked: Gerbers (%d files, %d layers: copper, mask, silkscreen, outline, drill), pick and place (%d parts), BOM (%d lines) and the JLCPCB BOM; every part the fab places is in both' % (out, gd.get('fileCount') or 0, gd.get('layerCount') or 0, len(cpl_refs), len(b.get('lines') or [])),+ ok('manufacturing files in %s, checked: Gerbers (%d files, %d layers: copper, mask, silkscreen, outline, drill), pick and place (%d parts), BOM (%d lines) and the JLCPCB BOM; every part the fab places is in both' % (shown_path(out.resolve()), gd.get('fileCount') or 0, gd.get('layerCount') or 0, len(cpl_refs), len(b.get('lines') or [])), ['Parts without a distributor number: ' + '; '.join('%s: %s' % (k, ', '.join(v)) for k, v in missing.items()) if missing else '', 'Test points are bare board copper, left out of the BOM and the pick and place: ' + ', '.join(tps) if tps else '',- 'Machine contacts and pins are fitted after assembly: DNP in bom.csv, left out of the pick and place and the JLCPCB BOM: ' + ', '.join(dnp) if dnp else ''])+ 'Machine contacts and pins are fitted after assembly: DNP in bom.csv, left out of the pick and place and the JLCPCB BOM: ' + ', '.join(dnp) if dnp else '',+ 'Not fitted in the design (DNP or populate off), left out of the pick and place and the JLCPCB BOM: ' + ', '.join(unfitted) if unfitted else '',+ 'No MPN and no LCSC number, so not in the JLCPCB BOM (still in the pick and place; give each a part number if the fab should buy and place it): ' + ', '.join(no_number) if no_number else '']) def cmd_reset(a):@@ -2165,6 +2206,10 @@ def main(): p.add_argument('--display', help='the layers to show while it draws, e.g. "17 18 20 21 25" (pads, vias, outline, tPlace, tNames): the silkscreen reads clearly over no copper') p.add_argument('--pause-ms', type=int, default=700, help='pause after each frame or label, so the recording sees it land') a = ap.parse_args()+ # issue #208: these paths are read and written HERE (the workspace), not on the desktop: a Windows path+ # is the same folder under /mnt/<drive>, never a local folder named "C:"+ for k in LOCAL_PATH_ARGS:+ if getattr(a, k, None): setattr(a, k, local_path(getattr(a, k))) {'silkscreen': cmd_silkscreen, 'library': cmd_library, 'reference': cmd_reference, 'schematic': cmd_schematic, 'reset': cmd_reset, 'export': cmd_export, 'view3d': cmd_view3d}[a.cmd](a)
tools/test_fusion_project.py+56@@ -462,3 +462,59 @@ class RelayoutKeeps(unittest.TestCase): if __name__ == '__main__': unittest.main()+++class FabRolesIssue207(unittest.TestCase):+ """Issue #207: parts with no MPN (buck ICs and inductors with only an LCSC number) are placed parts,+ not test points; a part the design marks not fitted leaves the pick and place."""+ SRC = '''<eagle><drawing><board><elements>+<element name="U1" library="L" package="SOT-583" value="TPS62933"><attribute name="LCSC" value="C3001"/></element>+<element name="U2" library="L" package="SOT-583" value="TPS62933"><attribute name="LCSC" value="C3001"/></element>+<element name="L1" library="L" package="IND-4020" value="4.7u"/>+<element name="TP1" library="L" package="TESTPAD_1MM" value=""/>+<element name="R9" library="L" package="R0603" value="0R" populate="no"/>+<element name="R10" library="L" package="R0603" value="0R"><attribute name="DNP" value="yes"/></element>+</elements></board></drawing></eagle>'''++ def write(self, d, name, rows):+ p = Path(d) / name+ with open(p, 'w', newline='') as f: fp.csv.writer(f).writerows(rows)+ return p++ def read(self, p):+ return list(fp.csv.reader(open(p, newline='')))++ def test_no_mpn_parts_stay_placed_and_not_fitted_parts_leave(self):+ roles = fp.fab_roles(self.SRC, {}, (), ['R9'])+ self.assertEqual(roles.get('TP1'), 'tp')+ self.assertEqual(roles.get('R9'), 'dnp'); self.assertEqual(roles.get('R10'), 'dnp')+ for r in ('U1', 'U2', 'L1'): self.assertNotIn(r, roles)+ with tempfile.TemporaryDirectory() as d:+ # the bridge BOM writes "(board only)" and "test point" for lines with no MPN+ bom = self.write(d, 'bom.csv', [['Designators', 'Quantity', 'Value', 'Package', 'MPN', 'Manufacturer', 'Mouser', 'DigiKey', 'LCSC'],+ ['U1 U2', '2', 'TPS62933', 'SOT-583', '(board only)', '', '', '', 'C3001'],+ ['L1', '1', 'test point', 'IND-4020', '(board only)', '', '', '', ''],+ ['TP1', '1', 'test point', 'TESTPAD_1MM', '(board only)', '', '', '', '']])+ cpl = self.write(d, 'cpl.csv', [['Designator', 'Mid X', 'Mid Y', 'Layer', 'Rotation']] + [[r, '1', '1', 'Top', '0'] for r in ('L1', 'R10', 'R9', 'TP1', 'U1', 'U2')])+ fp.fab_rewrite(bom, roles, False); fp.fab_rewrite(cpl, roles, True)+ self.assertEqual([r[0] for r in self.read(cpl)[1:]], ['L1', 'U1', 'U2'])+ lines = [r[0] for r in self.read(bom)[1:]]+ self.assertIn('U1 U2', lines); self.assertIn('L1', lines); self.assertNotIn('TP1', lines)+ for r in ('U1', 'U2', 'L1'): self.assertNotIn(r, roles, 'a placeholder line must not make %s a test point' % r)++ def test_bridge_designator_groups_split(self):+ self.assertEqual(fp.bridge_refs(['C1 C2', 'L1', 'R3,R4']), ['C1', 'C2', 'L1', 'R3', 'R4'])+ self.assertEqual(fp.bridge_refs(None), [])+++class WindowsPathsIssue208(unittest.TestCase):+ """Issue #208: a Windows --out-dir is the same folder under /mnt/<drive>, never a local folder named C:."""+ def test_windows_paths_map_to_the_mounted_drive(self):+ with tempfile.TemporaryDirectory() as mnt:+ os.makedirs(os.path.join(mnt, 'c'))+ self.assertEqual(fp.local_path('C:/Users/me/Documents/JLCPCB_X', mnt), os.path.join(mnt, 'c', 'Users', 'me', 'Documents', 'JLCPCB_X'))+ self.assertEqual(fp.local_path('C:\\Users\\me\\out', mnt), os.path.join(mnt, 'c', 'Users', 'me', 'out'))+ self.assertEqual(fp.local_path('manufacturing', mnt), 'manufacturing')+ with self.assertRaises(SystemExit): fp.local_path('D:/x', mnt)+ self.assertEqual(fp.shown_path('/mnt/c/Users/me'), '/mnt/c/Users/me (C:/Users/me on Windows)')+ self.assertEqual(fp.shown_path('/home/me/run'), '/home/me/run')