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.76 source, continued (still unreleased): copper_balance, return_path, fab_check, impedance and current_capacity answered by the EDA Bridge Standard's shared engine (vendored adom-eda-checks); fab_check takes any adom/pcb-design-rules vendor (records bundled); copper layers named by their place in the stack, planes included
34 files changed
+6524−13
CHANGELOG.md+12bridge-rs/Cargo.lock+8bridge-rs/Cargo.toml+2bridge-rs/src/checks.rs+217bridge-rs/src/coppermap.rs+12−4bridge-rs/src/main.rs+1bridge-rs/src/routing.rs+40bridge-rs/src/verbs.rs+10−8bridge-rs/vendor/README.md+12bridge-rs/vendor/adom-eda-checks/Cargo.toml+22bridge-rs/vendor/adom-eda-checks/README.md+78bridge-rs/vendor/adom-eda-checks/src/coppermap.rs+442bridge-rs/vendor/adom-eda-checks/src/current.rs+140bridge-rs/vendor/adom-eda-checks/src/fab.rs+294bridge-rs/vendor/adom-eda-checks/src/geom.rs+23bridge-rs/vendor/adom-eda-checks/src/impedance.rs+234bridge-rs/vendor/adom-eda-checks/src/input.rs+55bridge-rs/vendor/adom-eda-checks/src/lib.rs+29bridge-rs/vendor/adom-eda-checks/src/main.rs+48bridge-rs/vendor/adom-eda-checks/tests/fixtures.rs+56bridge-rs/vendor/pcb-design-rules/records/adom-3rdpartyfab.json+257bridge-rs/vendor/pcb-design-rules/records/advanced-circuits-4pcb.json+528bridge-rs/vendor/pcb-design-rules/records/aisler.json+262bridge-rs/vendor/pcb-design-rules/records/allpcb.json+340bridge-rs/vendor/pcb-design-rules/records/elecrow.json+208bridge-rs/vendor/pcb-design-rules/records/eurocircuits.json+502bridge-rs/vendor/pcb-design-rules/records/jlcpcb.json+290bridge-rs/vendor/pcb-design-rules/records/macrofab.json+281bridge-rs/vendor/pcb-design-rules/records/nextpcb.json+319bridge-rs/vendor/pcb-design-rules/records/osh-park.json+451bridge-rs/vendor/pcb-design-rules/records/pcbway.json+616bridge-rs/vendor/pcb-design-rules/records/seeed-fusion.json+468bridge-rs/vendor/pcb-design-rules/records/sierra-circuits.json+266src/agent/AdomAgent.pas.tmpl+1−1CHANGELOG.md+12@@ -33,6 +33,18 @@ arcs, texts, rectangles, regions and dimensions by id, or by layer and kind). - `scripts/release.py`: the agent lint refuses two routines of one name (DelphiScript ignores case; a duplicate halted the engine at compile with "Identifier redeclared").+- **The EDA Bridge Standard's shared checks engine** (`adom-eda-checks`, vendored from the standard 0.4.0 in+ `bridge-rs/vendor/`) now answers `copper_balance`, `return_path`, `fab_check`, `impedance` and `current_capacity`:+ this bridge gathers the board model and its companions, the engine computes, and the reply names Altium's verbs.+ The same code answers on KiCad and Fusion. Its results match this bridge's own on the lane and Sentinel fixtures.+- `altium_fab_check {fab}` takes any of the 13 vendors adom/pcb-design-rules covers (bundled; the record for the+ board's layer count, with its source page and the date it was read in every finding) or a record object. The+ JLCPCB numbers no longer come from a table of our own.+- `altium_impedance {apply}` still writes the rules: the engine plans one per layer and this bridge adds each, scoped+ OnLayer by Altium's layer name.+- **Copper layers are named by their place in the stack**, an internal plane included (`In<n>.Cu`, kind plane), the+ standard's rule: `routing_state`, `layer_stack` (each layer now carries `layer` and `layerId`), every layer lookup+ and the copper checks agree. A board without planes reads exactly as before. - `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.
bridge-rs/Cargo.lock+8@@ -8,10 +8,18 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" +[[package]]+name = "adom-eda-checks"+version = "0.1.0"+dependencies = [+ "serde_json",+]+ [[package]] name = "altium-bridge" version = "0.2.39" dependencies = [+ "adom-eda-checks", "getrandom", "serde", "serde_json",
bridge-rs/Cargo.toml+2@@ -6,6 +6,8 @@ description = "Adom altium-bridge — the bridge process, in Rust. Calls ab's ve license = "MIT" [dependencies]+# the EDA Bridge Standard's shared checks engine, vendored (vendor/README.md)+adom-eda-checks = { path = "vendor/adom-eda-checks" } tiny_http = "0.12" serde = { version = "1", features = ["derive"] } serde_json = "1"
bridge-rs/src/checks.rsadded+217@@ -0,0 +1,217 @@+//! The checks the EDA Bridge Standard's shared engine answers (vendor/adom-eda-checks): copper balance, return paths,+//! fab limits, impedance and current capacity. This bridge gathers the board model and its companions from Altium,+//! the engine computes, and the reply names Altium's own verbs. Fab limits come from adom/pcb-design-rules' records,+//! bundled in vendor/pcb-design-rules, never from a table of our own.+use serde_json::{json, Value};+use std::time::Duration;++/// The vendored engine, as vendor/README.md records it.+const ENGINE: &str = "adom-eda-checks 0.1.0 (EDA Bridge Standard 0.4.0)";++/// adom/pcb-design-rules' vendor records, bundled at build time (vendor/README.md).+const RECORDS: &[(&str, &str)] = &[+ ("adom-3rdpartyfab", include_str!("../vendor/pcb-design-rules/records/adom-3rdpartyfab.json")),+ ("advanced-circuits-4pcb", include_str!("../vendor/pcb-design-rules/records/advanced-circuits-4pcb.json")),+ ("aisler", include_str!("../vendor/pcb-design-rules/records/aisler.json")),+ ("allpcb", include_str!("../vendor/pcb-design-rules/records/allpcb.json")),+ ("elecrow", include_str!("../vendor/pcb-design-rules/records/elecrow.json")),+ ("eurocircuits", include_str!("../vendor/pcb-design-rules/records/eurocircuits.json")),+ ("jlcpcb", include_str!("../vendor/pcb-design-rules/records/jlcpcb.json")),+ ("macrofab", include_str!("../vendor/pcb-design-rules/records/macrofab.json")),+ ("nextpcb", include_str!("../vendor/pcb-design-rules/records/nextpcb.json")),+ ("osh-park", include_str!("../vendor/pcb-design-rules/records/osh-park.json")),+ ("pcbway", include_str!("../vendor/pcb-design-rules/records/pcbway.json")),+ ("seeed-fusion", include_str!("../vendor/pcb-design-rules/records/seeed-fusion.json")),+ ("sierra-circuits", include_str!("../vendor/pcb-design-rules/records/sierra-circuits.json")),+];++/// One fab's record for a board: the vendor (slug or name, "jlc" for JLCPCB), the process (standard unless named) and+/// the record whose layer count is the board's (else the nearest above it). Pure.+pub fn fab_record(vendor: &str, layers: Option<i64>, process: Option<&str>) -> Result<Value, String> {+ let want = vendor.to_lowercase().replace([' ', '_'], "-");+ let want = if want == "jlc" { "jlcpcb".to_string() } else { want };+ let Some((slug, text)) = RECORDS.iter().find(|(s, t)| *s == want || serde_json::from_str::<Value>(t).ok().and_then(|v| v["vendor"].as_str().map(|n| n.to_lowercase() == vendor.to_lowercase())).unwrap_or(false)) else {+ return Err(format!("no record for {vendor}: the bundled vendors are {}", RECORDS.iter().map(|r| r.0).collect::<Vec<_>>().join(", ")));+ };+ let file: Value = serde_json::from_str(text).map_err(|e| format!("{slug}: {e}"))?;+ let recs = file["records"].as_array().cloned().unwrap_or_default();+ let proc_ok = |r: &Value| process.map(|p| r["process"].as_str().map(|x| x.eq_ignore_ascii_case(p)).unwrap_or(false)).unwrap_or(r["process"].as_str().map(|x| x == "standard").unwrap_or(true));+ let mut cands: Vec<&Value> = recs.iter().filter(|r| proc_ok(r)).collect();+ if cands.is_empty() { cands = recs.iter().collect(); }+ let n = layers.unwrap_or(2);+ let pick = cands.iter().filter(|r| r["layerCount"].as_i64() == Some(n)).next()+ .or_else(|| cands.iter().filter(|r| r["layerCount"].as_i64().map(|c| c >= n).unwrap_or(false)).min_by_key(|r| r["layerCount"].as_i64().unwrap_or(99)))+ .or_else(|| cands.first()).ok_or_else(|| format!("{slug} has no records"))?;+ let mut rec = (*pick).clone();+ rec["vendor"] = file["vendor"].clone();+ Ok(rec)+}++/// Prefix the standard verbs a reply names (apply_pours, add_rule ...) with altium_, so the next step is callable as+/// written. Only words with an underscore that this bridge serves are touched. Pure.+pub fn prefix_verbs(v: &mut Value) {+ match v {+ Value::String(s) => *s = prefix_text(s),+ Value::Array(a) => a.iter_mut().for_each(prefix_verbs),+ Value::Object(o) => o.values_mut().for_each(prefix_verbs),+ _ => {}+ }+}++fn prefix_text(s: &str) -> String {+ let mut out = String::with_capacity(s.len() + 16);+ let mut word = String::new();+ let flush = |w: &mut String, out: &mut String, prev: Option<char>| {+ if w.contains('_') && crate::verbs::KNOWN.contains(&w.as_str()) && !matches!(prev, Some(c) if c.is_alphanumeric() || c == '_') { out.push_str("altium_"); }+ out.push_str(w);+ w.clear();+ };+ let mut prev_of_word: Option<char> = None;+ let mut last: Option<char> = None;+ for c in s.chars() {+ if c.is_ascii_alphanumeric() || c == '_' {+ if word.is_empty() { prev_of_word = last; }+ word.push(c);+ } else {+ if !word.is_empty() { flush(&mut word, &mut out, prev_of_word); }+ out.push(c);+ }+ last = Some(c);+ }+ if !word.is_empty() { flush(&mut word, &mut out, prev_of_word); }+ out+}++fn engine(check: &str, input: &Value) -> Value {+ let mut r = adom_eda_checks::run(check, input);+ prefix_verbs(&mut r);+ r["engine"] = json!(ENGINE);+ r+}++fn open(args: &Value) -> Option<Value> {+ if let Some(g) = crate::support::need_licensed() { return Some(g); }+ crate::support::s(args, "filePath").and_then(|p| crate::support::must_open(&p, 60))+}++fn board() -> Result<Value, Value> {+ let st = crate::routing::routing_state(&json!({}));+ if st.get("success").and_then(|b| b.as_bool()) != Some(true) { return Err(st); }+ Ok(st)+}++fn stack() -> Value {+ let mut d = crate::agent::call("layer_stack", &[], None, Duration::from_secs(60)).get("data").cloned().unwrap_or(Value::Null);+ crate::routing::name_stack(&mut d);+ d+}++fn without(args: &Value, keys: &[&str]) -> Value {+ let mut a = args.clone();+ if let Some(o) = a.as_object_mut() { for k in keys { o.remove(*k); } }+ a+}++/// altium_copper_balance {filePath?, resolutionMm?}+pub fn copper_balance(args: &Value) -> Value {+ if let Some(e) = open(args) { return e; }+ let st = match board() { Ok(s) => s, Err(e) => return e };+ let pours = crate::routing::pour_state(&json!({}));+ engine("copper_balance", &json!({"board": st, "stack": stack(), "pours": pours, "args": without(args, &["filePath"])}))+}++/// altium_return_path {filePath?, nets?, referenceNets?, resolutionMm?, fixMarginMm?}+pub fn return_path(args: &Value) -> Value {+ if let Some(e) = open(args) { return e; }+ let st = match board() { Ok(s) => s, Err(e) => return e };+ let pours = crate::routing::pour_state(&json!({}));+ engine("return_path", &json!({"board": st, "stack": stack(), "pours": pours, "args": without(args, &["filePath"])}))+}++/// altium_current_capacity {nets: {net: amps}, riseC?, platingUm?, filePath?}+pub fn current_capacity(args: &Value) -> Value {+ if let Some(e) = open(args) { return e; }+ let st = match board() { Ok(s) => s, Err(e) => return e };+ engine("current_capacity", &json!({"board": st, "stack": stack(), "args": without(args, &["filePath"])}))+}++/// altium_impedance {z0?, diff?, gapMm?, layers?, apply?: {scope, name?}, filePath?}: the engine plans; apply writes the+/// planned rules here (one width or diffpair rule per layer, scoped OnLayer by Altium's own layer name).+pub fn impedance(args: &Value) -> Value {+ if let Some(e) = open(args) { return e; }+ let st = stack();+ if st.is_null() { return json!({"success": false, "errorCode": "no_stack", "error": "the layer stack could not be read (open a board first)"}); }+ let mut r = engine("impedance", &json!({"stack": st, "args": without(args, &["filePath"])}));+ if r.get("success").and_then(|b| b.as_bool()) != Some(true) { return r; }+ if let Some(scope) = args.get("apply").and_then(|a| a.get("scope")).and_then(|v| v.as_str()) {+ let mut applied = Vec::new();+ for rule in r["apply"]["rules"].as_array().cloned().unwrap_or_default() {+ let tool_layer = rule["toolLayer"].as_str().unwrap_or("");+ let mut a = rule.clone();+ if let Some(o) = a.as_object_mut() { for k in ["scope", "layer", "toolLayer"] { o.remove(k); } }+ a["scope1"] = json!(format!("({scope}) And OnLayer('{tool_layer}')"));+ let res = crate::routing::add_rule(&a);+ applied.push(json!({"layer": rule["layer"], "rule": rule["name"], "success": res.get("success").cloned().unwrap_or(json!(false)), "error": res.get("error").cloned().unwrap_or(Value::Null)}));+ }+ r["applied"] = json!(applied);+ r["_hint"] = json!("Widths are for uncoated copper: solder mask lowers an outer layer's impedance by about 1 to 3 ohm. Inner layers assume planes on both neighbours. apply wrote one width or diffpair rule per layer (OnLayer) at +/-10%: applied says which landed.");+ }+ r+}++/// altium_fab_check {fab?: vendor or record, process?, limits?, copperOz?, filePath?}+pub fn fab_check(args: &Value) -> Value {+ if let Some(e) = open(args) { return e; }+ let st = match board() { Ok(s) => s, Err(e) => return e };+ let stk = stack();+ let rules = crate::agent::call("read_rules", &[], None, Duration::from_secs(60)).get("data").cloned().unwrap_or(Value::Null);+ let layers = stk["copperLayers"].as_i64();+ let fab = match args.get("fab") {+ Some(Value::String(v)) => match fab_record(v, layers, args.get("process").and_then(|p| p.as_str())) {+ Ok(r) => r,+ Err(e) => return json!({"success": false, "errorCode": "unknown_fab", "error": e, "_hint": "Pass a vendor adom/pcb-design-rules covers (fab:\"jlcpcb\"), a record from it, or any fab's numbers as limits."}),+ },+ Some(v) => v.clone(),+ None => Value::Null,+ };+ let wants_silk = args.get("limits").map(|l| l.get("minSilkText").is_some() || l.get("minSilkLine").is_some()).unwrap_or(false) || !fab.is_null();+ let silk = if wants_silk { crate::routing::silk_state(&json!({})) } else { Value::Null };+ engine("fab_check", &json!({"board": st, "stack": stk, "rules": rules, "silk": silk, "fab": fab, "args": without(args, &["filePath", "fab", "process"])}))+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn a_vendor_names_its_record_for_the_layer_count() {+ let r = fab_record("jlcpcb", Some(2), None).unwrap();+ assert_eq!(r["layerCount"], 2);+ assert_eq!(r["process"], "standard");+ assert!(r["vendor"].as_str().unwrap().to_lowercase().contains("jlc"));+ assert_eq!(fab_record("JLC", Some(4), None).unwrap()["layerCount"], 4);+ assert!(fab_record("nobody", Some(2), None).is_err());+ for (s, _) in RECORDS { assert!(fab_record(s, Some(2), None).is_ok(), "{s}"); }+ }++ #[test]+ fn standard_verbs_in_a_reply_get_the_prefix() {+ let mut v = json!({"verb": "apply_pours", "note": "Run add_rule once, then altium_run_drc and run_drc; leave apply_poursX and my_apply_pours alone", "n": 3});+ prefix_verbs(&mut v);+ assert_eq!(v["verb"], "altium_apply_pours");+ assert_eq!(v["note"], "Run altium_add_rule once, then altium_run_drc and altium_run_drc; leave apply_poursX and my_apply_pours alone");+ }++ #[test]+ fn the_engine_answers_on_the_lane_fixture() {+ let dir = concat!(env!("CARGO_MANIFEST_DIR"), "/../fixtures/altium/");+ let read = |n: &str| -> Value { serde_json::from_str(&std::fs::read_to_string(format!("{dir}{n}")).unwrap()).unwrap() };+ let input = json!({"board": read("lane.routing_state.json"), "stack": read("lane.layer_stack.json"), "pours": read("lane.pour_state.json"), "args": {}});+ let got = engine("copper_balance", &input);+ let want = read("expected/lane.copper_balance.json");+ assert_eq!(got["layers"], want["layers"]);+ assert_eq!(got["balanced"], want["balanced"]);+ let rp = engine("return_path", &input);+ assert_eq!(rp["nets"], read("expected/lane.return_path.json")["nets"]);+ }+}
bridge-rs/src/coppermap.rs+12−4@@ -89,9 +89,10 @@ pub fn stack_layers(stack: &Value) -> Vec<(String, bool, String)> { let ls: Vec<Value> = stack["layers"].as_array().cloned().unwrap_or_default(); let n = ls.len(); ls.iter().enumerate().map(|(i, l)| {- if l["kind"] == "plane" { return (format!("L{}", 38 + l["plane"].as_i64().unwrap_or(1)), true, l["net"].as_str().unwrap_or("").to_string()); }- let name = if i == 0 { "F.Cu".to_string() } else if i + 1 == n { "B.Cu".to_string() } else { format!("In{}.Cu", l["mid"].as_i64().unwrap_or(i as i64)) };- (name, false, String::new())+ let plane = l["kind"] == "plane";+ // the board model's name when the stack gives it (`layer`); else by place in the stack, a plane included+ let name = l["layer"].as_str().map(str::to_string).unwrap_or_else(|| if i == 0 { "F.Cu".to_string() } else if i + 1 == n { "B.Cu".to_string() } else { format!("In{i}.Cu") });+ (name, plane, if plane { l["net"].as_str().unwrap_or("").to_string() } else { String::new() }) }).collect() } @@ -421,8 +422,15 @@ mod tests { fn stack_names_match_routing_state() { let s = json!({"layers": [{"name": "Top"}, {"kind": "plane", "plane": 1, "net": "GND"}, {"kind": "signal", "mid": 1}, {"name": "Bottom"}]}); let l = stack_layers(&s);- assert_eq!(l.iter().map(|x| x.0.as_str()).collect::<Vec<_>>(), vec!["F.Cu", "L39", "In1.Cu", "B.Cu"]);+ // the EDA Bridge Standard's rule: inner layers by their place in the stack, a plane included+ assert_eq!(l.iter().map(|x| x.0.as_str()).collect::<Vec<_>>(), vec!["F.Cu", "In1.Cu", "In2.Cu", "B.Cu"]); assert!(l[1].1 && l[1].2 == "GND");+ // and routing_state names the same layers the same way, from the stack's Altium ids+ let named = json!({"layers": [{"layerId": 1}, {"layerId": 39, "kind": "plane"}, {"layerId": 2}, {"layerId": 32}]});+ crate::routing::set_layer_map(&named);+ assert_eq!((crate::routing::layer_name(39), crate::routing::layer_name(2)), ("In1.Cu".to_string(), "In2.Cu".to_string()));+ assert_eq!(crate::routing::layer_id(&json!("In1.Cu")), Some(39));+ crate::routing::set_layer_map(&json!({})); } #[test] fn gap_runs_group_and_the_fix_patches_the_neighbour() {
bridge-rs/src/main.rs+1@@ -15,6 +15,7 @@ mod schreview; mod schwire; mod schsheet; mod boardedit;+mod checks; mod design; mod dialogs; mod health;
bridge-rs/src/routing.rs+40@@ -26,8 +26,45 @@ fn deg(v: &Value) -> Value { json!(v.as_f64().unwrap_or(0.0) / 1000.0) } +/// This board's copper layers as the board model names them, by their place in the stack (F.Cu, In1.Cu .., B.Cu;+/// an internal plane too, the EDA Bridge Standard's rule): Altium layer id and name. Set from the stack on every read+/// of the board and of the stack, so names and ids agree with the board the caller last read.+thread_local! { static LAYER_MAP: std::cell::RefCell<Vec<(i64, String)>> = const { std::cell::RefCell::new(Vec::new()) }; }++/// The stack's copper layers named by place: the first is F.Cu, the last B.Cu, the ones between In1.Cu, In2.Cu ..+/// whether signal or plane. Pure.+pub fn stack_names(stack: &Value) -> Vec<(i64, String)> {+ let ls = stack["layers"].as_array().cloned().unwrap_or_default();+ let n = ls.len();+ ls.iter().enumerate().map(|(k, l)| {+ let id = l["layerId"].as_i64().or_else(|| l["mid"].as_i64().map(|m| m + 1)).or_else(|| l["plane"].as_i64().map(|p| 38 + p)).unwrap_or(if k == 0 { TOP } else { BOTTOM });+ let name = if k == 0 { "F.Cu".to_string() } else if k + 1 == n { "B.Cu".to_string() } else { format!("In{k}.Cu") };+ (id, name)+ }).collect()+}++/// Each copper layer of a layer_stack reply gets its board model name (`layer`) and the map is remembered. The+/// reply's stack sits at the top level or under `data`.+pub fn name_stack(r: &mut Value) {+ let stack = if r.get("layers").is_some() { r.clone() } else { r.get("data").cloned().unwrap_or(Value::Null) };+ let names = stack_names(&stack);+ if names.is_empty() { return; }+ set_layer_map(&stack);+ let target = if r.get("layers").is_some() { &mut *r } else { match r.get_mut("data") { Some(d) => d, None => return } };+ if let Some(ls) = target.get_mut("layers").and_then(|v| v.as_array_mut()) {+ for (l, (_, n)) in ls.iter_mut().zip(names.iter()) { l["layer"] = json!(n); }+ }+}++/// Remember this board's stack naming (stack_names) for layer_name and layer_id.+pub fn set_layer_map(stack: &Value) {+ let m = stack_names(stack);+ LAYER_MAP.with(|g| *g.borrow_mut() = if m.len() >= 2 { m } else { Vec::new() });+}+ /// Altium's copper layer id as the KiCad name AI Flow speaks. pub fn layer_name(id: i64) -> String {+ if let Some(n) = LAYER_MAP.with(|g| g.borrow().iter().find(|(i, _)| *i == id).map(|(_, n)| n.clone())) { return n; } match id { TOP => "F.Cu".into(), BOTTOM => "B.Cu".into(),@@ -262,6 +299,8 @@ pub fn routing_state(args: &Value) -> Value { } None => return r, };+ // name the copper layers by their place in this board's stack (a plane included) before shaping+ if let Some(stk) = agent::call("layer_stack", &[], None, Duration::from_secs(60)).get("data").filter(|d| d["ok"] == json!(true)) { set_layer_map(stk); } let st = shape(&data); if let Some(want) = args.get("expectPath").and_then(|v| v.as_str()) { let have = st["file"].as_str().unwrap_or("");@@ -290,6 +329,7 @@ pub fn layer_id(v: &Value) -> Option<i64> { return Some(n); } let name = v.as_str()?;+ if let Some(id) = LAYER_MAP.with(|g| g.borrow().iter().find(|(_, n)| n.eq_ignore_ascii_case(name)).map(|(i, _)| *i)) { return Some(id); } match name { "F.Cu" | "Top" | "TopLayer" => Some(TOP), "B.Cu" | "Bottom" | "BottomLayer" => Some(BOTTOM),
bridge-rs/src/verbs.rs+10−8@@ -949,9 +949,9 @@ fn describe() -> Value { &["Opens the board, then creates and saves the panel; without projectPath the saved panel is closed (open it with altium_open_document).", "tabs refuses a board that draws its own outline on a mechanical layer: every copy brings it along closed and a router would cut each board free.", "JLCPCB's rules as published (V-cut standards and mouse-bite guide, read 2026-10-23): V-cut panels 70 to 475 mm, 0.6 mm boards or thicker, copper 0.4 mm (1.0 recommended) from a cut, at most 25 cuts a side; mouse bites 0.6 mm holes 5 to a set, gaps of 1.2 mm or more."], json!({"pcbPath": "C:/proj/Board.PcbDoc", "panelPath": "C:/proj/Panel.PcbDoc", "rows": 3, "cols": 3, "separation": "vscore", "railMm": 5, "projectPath": "C:/proj/Board.PrjPcb"})), verb_doc("fab_check", "Before ordering: the board's fab-relevant minimums measured from the live board (narrowest track, smallest via drill, diameter and annular ring, smallest pad hole and ring, smallest SMD pad, clearance rule, copper layers, board size), each with where it is; with a fab's limits, which ones fall short.",- json!({"filePath": "the .PcbDoc (opened first)", "fab": "jlcpcb - JLCPCB's published standard capabilities for this board's layer count and copper weight (source and date in the reply)", "copperOz": "outer copper weight for the preset (default: read from the stack)", "limits": "{minTrack, minClearance, minViaDrill, minViaDiameter, minViaAnnularRing, minPadHole, minPadAnnularRing, minSmdPad, minEdgeClearance, minHoleToHoleVia, minHoleToHolePad, maxDrill, minSilkLine, minSilkText, maxLayers, minBoardMm:[w,h], maxBoardMm:[w,h]} in mm - any fab's numbers; with fab, these override the preset"}),+ json!({"filePath": "the .PcbDoc (opened first)", "fab": "a vendor adom/pcb-design-rules covers (jlcpcb, pcbway, osh-park, eurocircuits, aisler, allpcb, elecrow, nextpcb, seeed-fusion, advanced-circuits-4pcb, sierra-circuits, macrofab, adom-3rdpartyfab): its record for this board's layer count (source page and date read in the reply); or a record object from that page", "process": "the record's process (default standard)", "copperOz": "outer copper weight for the preset (default: read from the stack)", "limits": "{minTrack, minClearance, minViaDrill, minViaDiameter, minViaAnnularRing, minPadHole, minPadAnnularRing, minSmdPad, minEdgeClearance, minHoleToHoleVia, minHoleToHolePad, maxDrill, minSilkLine, minSilkText, maxLayers, minBoardMm:[w,h], maxBoardMm:[w,h]} in mm - any fab's numbers; with fab, these override the preset"}), json!({"fab": "{name, service, copperOz, source, read, notes} | null", "measured": "{track, viaDrill, viaDiameter, viaAnnularRing, padHole, padAnnularRing, smdPad, edgeClearance, holeToHoleVia, holeToHolePad, largestDrill, silkText, silkLine: {mm, at}, clearanceRule, copperLayers, boardSize, counts}", "outsideLimits": "[{limit, limitMm, boardMm, at}]", "fits": "bool | null", "costlierOrBelowRecommended": "[{feature, boardMm, note}]"}), 180,- "Look up the fab's own limits (its capability page) and pass them: the bridge does not carry fab numbers, they change. The measured values are what a fab's order form asks for.",+ "Computed by the EDA Bridge Standard's shared engine (adom-eda-checks). Fab limits come from adom/pcb-design-rules' records, bundled with the bridge: each finding names the vendor's page and the date it was read. limits adds or overrides any limit. The measured values are what a fab's order form asks for.", &["routing_state", "read_rules", "layer_stack", "export_manufacturing", "run_drc"], &["Measures the board as it is now, from the live document: routed copper, vias and pads.", "Board size is the outline's bounding box."], json!({"fab": "jlcpcb"})),@@ -1819,7 +1819,9 @@ pub fn dispatch(command: &str, args: &Value, _forwarded: &[(String, String)]) -> }, "layer_stack" => { if ["add", "remove", "set", "totalMm"].iter().any(|k| args.get(*k).is_some()) { return crate::design::layer_stack_edit(args); }- board_read("layer_stack", vec![], 60)+ let mut r = board_read("layer_stack", vec![], 60);+ crate::routing::name_stack(&mut r);+ r } "footprint_primitives" => match s(args, "designator") { None => json!({"success": false, "error": "designator is required (a placed component, e.g. U1)"}),@@ -1960,14 +1962,14 @@ pub fn dispatch(command: &str, args: &Value, _forwarded: &[(String, String)]) -> "teardrops" => crate::route::teardrops(args), "component_classes" => crate::design::component_classes(args), "read_sheet_file" => crate::schdoc::read_sheet_file(args),- "fab_check" => crate::fab::fab_check(args),+ "fab_check" => crate::checks::fab_check(args), "panelize" => crate::panel::panelize(args),- "impedance" => crate::impedance::impedance(args),- "current_capacity" => crate::current::current_capacity(args),+ "impedance" => crate::checks::impedance(args),+ "current_capacity" => crate::checks::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),+ "copper_balance" => crate::checks::copper_balance(args),+ "return_path" => crate::checks::return_path(args), "silk_designators" => crate::silkplace::silk_designators(args), "via_fence" => crate::features::via_fence(args), "assembly_check" => crate::assembly::assembly_check(args),
bridge-rs/vendor/README.mdadded+12@@ -0,0 +1,12 @@+# Vendored++| Folder | From | Version |+|---|---|---|+| `adom-eda-checks/` | adom/eda-bridge-standard `engine/` (the shared checks engine) | standard 0.4.0, engine 0.1.0 |+| `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.++Local change, sent upstream on adom/eda-bridge-standard#8: `adom-eda-checks/src/coppermap.rs` `stack_layers` takes each+copper layer's board-model name from the stack's `layer` (the standard's plane rule), else names it by its place in+the stack, so an internal plane is `In<n>.Cu`, not `L<38+n>`.
bridge-rs/vendor/adom-eda-checks/Cargo.tomladded+22@@ -0,0 +1,22 @@+[package]+name = "adom-eda-checks"+version = "0.1.0"+edition = "2021"+description = "The EDA Bridge Standard's checks, computed from the board model JSON: no bridge calls, no tool."+license = "MIT"++[lib]+path = "src/lib.rs"++[[bin]]+name = "adom-eda-checks"+path = "src/main.rs"++[dependencies]+serde_json = "1"++[profile.release]+opt-level = 3+lto = true+codegen-units = 1+strip = true
bridge-rs/vendor/adom-eda-checks/README.mdadded+78@@ -0,0 +1,78 @@+# adom-eda-checks: the shared checks engine++The checks tier of the EDA Bridge Standard, computed from the board model and its companions as plain JSON. It makes+no bridge calls, runs no tool and does no I/O. A bridge links the crate (the Altium, KiCad and Fusion bridges are all+Rust) or runs the `adom-eda-checks` command, then answers the check under its own prefix (`kicad_return_path`).++The code moved over from the Altium bridge's `bridge-rs/src/`, which was the reference implementation. On Altium's own+boards the engine gives the same answers the Altium bridge 0.2.76 gives.++## Checks++| Check | Reads | What it answers |+|---|---|---|+| `copper_balance` | board, stack, pours | copper per layer and how evenly mirrored layers match (bow and twist) |+| `return_path` | board, stack, pours | signal tracks running over a gap in the neighbouring layer's reference copper, with a pour plan that closes each gap (`apply_pours`) |+| `fab_check` | board, stack?, rules?, silk?, fab? | the board's smallest features, compared with a fab's limits from adom/pcb-design-rules; each finding names the fab's page and the date it was read |+| `impedance` | stack | the track width (and pair gap) for a target impedance on each copper layer; `apply` answers `add_rule` arguments |+| `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 |++The other checks-tier verbs (assembly, 3D heights, placement, schematic review, pair routing, length tuning,+designators, via fences, panels, the board report) come over from the Altium bridge a module at a time.++## Input++Every check takes one JSON object:++```json+{"board": {...}, "stack": {...}, "pours": {...}, "rules": [...], "silk": {...}, "fab": {...}, "args": {...}}+```++| Key | What it is |+|---|---|+| `board` | the board model, `<prefix>_routing_state` (`schema/board.schema.json`) |+| `stack` | the stack-up companion, `<prefix>_layer_stack` |+| `pours` | poured copper, `<prefix>_pour_state` (its `zones`) |+| `rules` | the board's rules, `<prefix>_read_rules`: a clearance rule as `{kind: "clearance", clearanceMm}` |+| `silk` | `<prefix>_silk_state` |+| `fab` | one record from adom/pcb-design-rules `rules/records/<vendor>.json`, with `vendor` |+| `args` | the check's own arguments, as the standard verb documents them |++Each part may be the bare model or the bridge's whole reply: the model's keys at the top level, or under `data`.+A missing part is never guessed. A limit with nothing to measure it against is listed in `notChecked`. Copper weight+assumed for lack of a stack is named in `assumed`.++## Use++As a crate, vendored at a tagged standard version (the wiki has no git protocol, so Cargo can't fetch it):++```toml+[dependencies]+adom-eda-checks = { path = "vendor/adom-eda-checks" }+```++```rust+let reply = adom_eda_checks::run("return_path", &serde_json::json!({"board": board, "stack": stack, "pours": pours, "args": {}}));+```++As a command:++```bash+adom-eda-checks list+adom-eda-checks return_path --board board.json --stack stack.json --pours pours.json --args '{"resolutionMm": 0.1}'+adom-eda-checks fab_check bundle.json # or - for stdin+```++Replies keep the standard envelope (`success`, `errorCode`, `error`, `_hint`) and name verbs without a prefix+(`apply_pours`, `add_rule`): a bridge adds its own.++## Tests++`cargo test` runs the unit tests. To compare with a bridge's own answers, point `ADOM_EDA_FIXTURES` at a folder of+saved replies laid out as `<bridge>/<board>.<model>.json` and `<bridge>/expected/<board>.<check>.json`:++```bash+ADOM_EDA_FIXTURES=/path/to/fixtures cargo test --test fixtures+```++Fixtures live on each bridge's own page, not here.
bridge-rs/vendor/adom-eda-checks/src/coppermap.rsadded+442@@ -0,0 +1,442 @@+//! The copper of each layer as a raster (0.1 mm by default) inside the board outline, from the live board: tracks,+//! arcs, pads, vias and the copper Altium actually poured (its regions minus their holes); an internal plane counts as+//! copper everywhere. From it: how much of each layer is copper and how evenly the stack is balanced (bow and twist),+//! and where signal tracks run over a gap in the copper of the layer next to them (the return current's path).+use serde_json::{json, Value};+use std::collections::BTreeMap;++fn f(v: &Value) -> f64 { v.as_f64().unwrap_or(0.0) }+fn r1(v: f64) -> f64 { (v * 10.0).round() / 10.0 }+fn r3(v: f64) -> f64 { (v * 1000.0).round() / 1000.0 }++/// A layer's copper as cells of `res` mm from (x0, y0).+#[derive(Clone)]+pub struct Raster { pub x0: f64, pub y0: f64, pub res: f64, pub w: usize, pub h: usize, pub cells: Vec<bool> }++impl Raster {+ pub fn new(x0: f64, y0: f64, x1: f64, y1: f64, res: f64) -> Raster {+ let w = (((x1 - x0) / res).ceil() as usize).max(1);+ let h = (((y1 - y0) / res).ceil() as usize).max(1);+ Raster { x0, y0, res, w, h, cells: vec![false; w * h] }+ }+ fn centre(&self, i: usize, j: usize) -> (f64, f64) { (self.x0 + (i as f64 + 0.5) * self.res, self.y0 + (j as f64 + 0.5) * self.res) }+ /// cells whose centre is in [x0, x1] x [y0, y1], clipped+ fn span(&self, x0: f64, y0: f64, x1: f64, y1: f64) -> (usize, usize, usize, usize) {+ let c = |v: f64, o: f64, n: usize| (((v - o) / self.res - 0.5).max(0.0) as usize).min(n);+ let (i0, j0) = (c(x0, self.x0, self.w), c(y0, self.y0, self.h));+ let (i1, j1) = ((((x1 - self.x0) / self.res + 0.5).max(0.0) as usize).min(self.w), (((y1 - self.y0) / self.res + 0.5).max(0.0) as usize).min(self.h));+ (i0, j0, i1, j1)+ }+ pub fn at(&self, x: f64, y: f64) -> bool {+ let (i, j) = ((x - self.x0) / self.res, (y - self.y0) / self.res);+ if i < 0.0 || j < 0.0 || i >= self.w as f64 || j >= self.h as f64 { return false; }+ self.cells[j as usize * self.w + i as usize]+ }+ /// a segment of width w with round ends (a track, an arc's piece, an oval pad)+ pub fn capsule(&mut self, ax: f64, ay: f64, bx: f64, by: f64, w: f64) {+ let r = w / 2.0;+ let (i0, j0, i1, j1) = self.span(ax.min(bx) - r, ay.min(by) - r, ax.max(bx) + r, ay.max(by) + r);+ let (dx, dy) = (bx - ax, by - ay);+ let l2 = dx * dx + dy * dy;+ for j in j0..j1 { for i in i0..i1 {+ let (x, y) = self.centre(i, j);+ let t = if l2 > 0.0 { (((x - ax) * dx + (y - ay) * dy) / l2).clamp(0.0, 1.0) } else { 0.0 };+ let (px, py) = (ax + t * dx - x, ay + t * dy - y);+ if px * px + py * py <= r * r { self.cells[j * self.w + i] = true; }+ } }+ }+ /// a rectangle sx by sy centred at (cx, cy), turned `rot` degrees+ pub fn rect(&mut self, cx: f64, cy: f64, sx: f64, sy: f64, rot: f64) {+ let (c, s) = (rot.to_radians().cos(), rot.to_radians().sin());+ let e = (sx * sx + sy * sy).sqrt() / 2.0;+ let (i0, j0, i1, j1) = self.span(cx - e, cy - e, cx + e, cy + e);+ for j in j0..j1 { for i in i0..i1 {+ let (x, y) = self.centre(i, j);+ let (u, v) = ((x - cx) * c + (y - cy) * s, -(x - cx) * s + (y - cy) * c);+ if u.abs() <= sx / 2.0 && v.abs() <= sy / 2.0 { self.cells[j * self.w + i] = true; }+ } }+ }+ /// polygons filled by the even-odd rule (an outline with its holes), set to `on`+ pub fn polys(&mut self, rings: &[Vec<(f64, f64)>], on: bool) {+ let ys: Vec<f64> = rings.iter().flatten().map(|p| p.1).collect();+ if ys.is_empty() { return; }+ let (lo, hi) = (ys.iter().cloned().fold(f64::MAX, f64::min), ys.iter().cloned().fold(f64::MIN, f64::max));+ let (_, j0, _, j1) = self.span(self.x0, lo, self.x0, hi);+ for j in j0..j1 {+ let y = self.y0 + (j as f64 + 0.5) * self.res;+ let mut xs: Vec<f64> = Vec::new();+ for ring in rings {+ let n = ring.len();+ for k in 0..n {+ let (a, b) = (ring[k], ring[(k + 1) % n]);+ if (a.1 <= y) != (b.1 <= y) { xs.push(a.0 + (y - a.1) / (b.1 - a.1) * (b.0 - a.0)); }+ }+ }+ xs.sort_by(|a, b| a.partial_cmp(b).unwrap());+ for p in xs.chunks(2) {+ if p.len() < 2 { continue; }+ let (i0, _, i1, _) = self.span(p[0], y, p[1], y);+ for i in i0..i1 { self.cells[j * self.w + i] = on; }+ }+ }+ }+ pub fn and(&mut self, mask: &Raster) { for (c, m) in self.cells.iter_mut().zip(&mask.cells) { *c = *c && *m; } }+ pub fn count(&self) -> usize { self.cells.iter().filter(|c| **c).count() }+}++/// The stack's copper layers in order as (routing_state name, plane?, plane net).+pub fn stack_layers(stack: &Value) -> Vec<(String, bool, String)> {+ let ls: Vec<Value> = stack["layers"].as_array().cloned().unwrap_or_default();+ let n = ls.len();+ ls.iter().enumerate().map(|(i, l)| {+ let plane = l["kind"] == "plane";+ // the board model's name when the stack gives it (`layer`); else by place in the stack, a plane included+ let name = l["layer"].as_str().map(str::to_string).unwrap_or_else(|| if i == 0 { "F.Cu".to_string() } else if i + 1 == n { "B.Cu".to_string() } else { format!("In{i}.Cu") });+ (name, plane, if plane { l["net"].as_str().unwrap_or("").to_string() } else { String::new() })+ }).collect()+}++/// The outline as a ring in mm (arc edges sampled).+pub(crate) fn outline_ring(st: &Value) -> Vec<(f64, f64)> {+ let mut ring = Vec::new();+ for e in st["outlineEdges"].as_array().cloned().unwrap_or_default() {+ if e["kind"] == "arc" {+ let (cx, cy, r) = (f(&e["center"][0]), f(&e["center"][1]), f(&e["radius"]));+ let (a1, mut a2) = (f(&e["angle1"]), f(&e["angle2"]));+ if a2 <= a1 { a2 += 360.0; }+ // every 2 degrees: a chord cuts inside the arc by r(1 - cos 1deg), 3 um on a 20 mm radius (16 points per+ // arc put a hatched pour's ends 0.04 mm outside the Bluetooth Sentinel example's edge)+ let k = (((a2 - a1) / 2.0).ceil() as usize).max(4);+ for q in 0..=k { let t = (a1 + (a2 - a1) * q as f64 / k as f64).to_radians(); ring.push((cx + r * t.cos(), cy + r * t.sin())); }+ } else { ring.push((f(&e["start"][0]), f(&e["start"][1]))); }+ }+ if ring.is_empty() { ring = st["outline"].as_array().cloned().unwrap_or_default().iter().map(|p| (f(&p[0]), f(&p[1]))).collect(); }+ ring+}++/// Each layer's copper raster inside the outline. `refs` None: all copper. Some(nets): only the copper a return current+/// can use: pours, planes, those nets' own copper, and net-less copper (Altium lists a hatched pour's tracks with no+/// net: 8777 of the Bluetooth Sentinel example's 9378 tracks). Pure: routing_state, pour_state's zones, the stack.+pub fn rasters(st: &Value, zones: &[Value], layers: &[(String, bool, String)], res: f64, refs: Option<&[String]>) -> (Raster, BTreeMap<String, Raster>) {+ let ring = outline_ring(st);+ let (x0, x1) = ring.iter().fold((f64::MAX, f64::MIN), |a, p| (a.0.min(p.0), a.1.max(p.0)));+ let (y0, y1) = ring.iter().fold((f64::MAX, f64::MIN), |a, p| (a.0.min(p.1), a.1.max(p.1)));+ let mut board = Raster::new(x0, y0, x1, y1, res);+ board.polys(&[ring], true);+ let mut out = BTreeMap::new();+ for (name, plane, _) in layers {+ let mut r = Raster::new(x0, y0, x1, y1, res);+ if *plane { r.cells = board.cells.clone(); out.insert(name.clone(), r); continue; }+ {+ let keep = |n: &Value| match refs { None => true, Some(rs) => { let n = n.as_str().unwrap_or(""); n.is_empty() || rs.iter().any(|r| r.eq_ignore_ascii_case(n)) } };+ let on_layer = |l: &Value| l.as_str().map(|s| s == name || s == "*.Cu").unwrap_or(false);+ let on = |p: &Value| on_layer(&p["layer"]) && keep(&p["net"]);+ for t in st["tracks"].as_array().cloned().unwrap_or_default().iter().filter(|t| on(t)) {+ r.capsule(f(&t["start"]["x"]), f(&t["start"]["y"]), f(&t["end"]["x"]), f(&t["end"]["y"]), f(&t["width"]));+ }+ for a in st["arcs"].as_array().cloned().unwrap_or_default().iter().filter(|a| on(a)) {+ let (cx, cy, rad) = (f(&a["center"]["x"]), f(&a["center"]["y"]), f(&a["radius"]));+ let (s, mut e) = (f(&a["startAngle"]), f(&a["endAngle"]));+ if e <= s { e += 360.0; }+ let k = ((e - s) / 10.0).ceil().max(1.0) as usize;+ for q in 0..k {+ let (t0, t1) = ((s + (e - s) * q as f64 / k as f64).to_radians(), (s + (e - s) * (q + 1) as f64 / k as f64).to_radians());+ r.capsule(cx + rad * t0.cos(), cy + rad * t0.sin(), cx + rad * t1.cos(), cy + rad * t1.sin(), f(&a["width"]));+ }+ }+ 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());+ let (l, w) = ((sx - sy).abs() / 2.0, sx.min(sy));+ let (ux, uy) = if sx > sy { (c * l, s * l) } else { (-s * l, c * l) };+ r.capsule(f(&p["x"]) - ux, f(&p["y"]) - uy, f(&p["x"]) + ux, f(&p["y"]) + uy, w);+ }+ Some("round") | Some("circle") => r.capsule(f(&p["x"]), f(&p["y"]), f(&p["x"]), f(&p["y"]), sx),+ _ => r.rect(f(&p["x"]), f(&p["y"]), sx, sy, f(&p["rotation"])),+ }+ }+ for v in st["vias"].as_array().cloned().unwrap_or_default().iter().filter(|v| keep(&v["net"])) {+ r.capsule(f(&v["position"]["x"]), f(&v["position"]["y"]), f(&v["position"]["x"]), f(&v["position"]["y"]), f(&v["size"]));+ }+ }+ for z in zones.iter().filter(|z| z["layer"].as_str() == Some(name)) {+ for fill in z["fills"].as_array().cloned().unwrap_or_default() {+ let pts = |v: &Value| v.as_array().cloned().unwrap_or_default().iter().map(|p| (f(&p[0]), f(&p[1]))).collect::<Vec<_>>();+ let mut rings = vec![pts(&fill["outline"])];+ rings.extend(fill["holes"].as_array().cloned().unwrap_or_default().iter().map(pts));+ r.polys(&rings, true);+ }+ }+ r.and(&board);+ out.insert(name.clone(), r);+ }+ (board, out)+}++/// Per layer: copper area and share of the board; per mirrored pair (1 with n, 2 with n-1...): the difference.+pub fn balance(board: &Raster, maps: &BTreeMap<String, Raster>, layers: &[(String, bool, String)]) -> (Vec<Value>, Vec<Value>) {+ let cell = board.res * board.res;+ let total = board.count() as f64;+ let pct = |name: &str| maps.get(name).map(|r| 100.0 * r.count() as f64 / total.max(1.0)).unwrap_or(0.0);+ let rows: Vec<Value> = layers.iter().map(|(n, plane, net)| {+ let mut o = json!({"layer": n, "copperMm2": r1(maps.get(n).map(|r| r.count()).unwrap_or(0) as f64 * cell), "percent": r1(pct(n))});+ if *plane { o["plane"] = json!(net); }+ o+ }).collect();+ let k = layers.len();+ let pairs = (0..k / 2).map(|i| {+ let (a, b) = (&layers[i].0, &layers[k - 1 - i].0);+ let d = (pct(a) - pct(b)).abs();+ json!({"layers": [a, b], "percent": [r1(pct(a)), r1(pct(b))], "differencePoints": r1(d), "ok": d <= 20.0})+ }).collect();+ (rows, pairs)+}++/// Per signal net: track length on each layer, and the length that runs over no reference copper on either+/// neighbouring layer, with where the first gap starts. `skip` nets are the references themselves. Pure.+pub fn return_paths(st: &Value, refs: &BTreeMap<String, Raster>, layers: &[(String, bool, String)], skip: &[String], step: f64) -> Vec<Value> {+ let idx: BTreeMap<&str, usize> = layers.iter().enumerate().map(|(i, l)| (l.0.as_str(), i)).collect();+ let mut acc: BTreeMap<(String, String), (f64, f64, Option<(f64, f64)>, Vec<(f64, f64)>)> = BTreeMap::new();+ for t in st["tracks"].as_array().cloned().unwrap_or_default() {+ let (net, layer) = (t["net"].as_str().unwrap_or(""), t["layer"].as_str().unwrap_or(""));+ if net.is_empty() || skip.iter().any(|s| s.eq_ignore_ascii_case(net)) { continue; }+ let Some(&i) = idx.get(layer) else { continue };+ let nb: Vec<&Raster> = [i.checked_sub(1), Some(i + 1)].iter().flatten().filter_map(|j| layers.get(*j)).filter_map(|l| refs.get(&l.0)).collect();+ let (ax, ay, bx, by) = (f(&t["start"]["x"]), f(&t["start"]["y"]), f(&t["end"]["x"]), f(&t["end"]["y"]));+ let len = ((bx - ax).powi(2) + (by - ay).powi(2)).sqrt();+ let n = (len / step).ceil().max(1.0) as usize;+ let e = acc.entry((net.to_string(), layer.to_string())).or_insert((0.0, 0.0, None, Vec::new()));+ e.0 += len;+ for k in 0..n {+ let s = (k as f64 + 0.5) / n as f64;+ let (x, y) = (ax + s * (bx - ax), ay + s * (by - ay));+ if !nb.iter().any(|r| r.at(x, y)) {+ e.1 += len / n as f64;+ if e.2.is_none() { e.2 = Some((r3(x), r3(y))); }+ e.3.push((x, y));+ }+ }+ }+ let mut out: Vec<Value> = acc.into_iter().filter(|(_, v)| v.1 > 0.0).map(|((net, layer), (len, gap, at, pts))| json!({+ "net": net, "layer": layer, "lengthMm": r3(len), "unreferencedMm": r3(gap), "percent": r1(100.0 * gap / len.max(1e-9)), "firstGapAt": at.map(|p| json!([p.0, p.1])),+ "gapRuns": gap_runs(&pts, 1.0).iter().map(|r| json!([r3(r.0), r3(r.1), r3(r.2), r3(r.3)])).collect::<Vec<_>>()})).collect();+ out.sort_by(|a, b| b["unreferencedMm"].as_f64().partial_cmp(&a["unreferencedMm"].as_f64()).unwrap());+ out+}++/// The gap sample points grouped into runs: boxes (x0, y0, x1, y1) of points within `join` mm of each other. Pure.+pub fn gap_runs(pts: &[(f64, f64)], join: f64) -> Vec<(f64, f64, f64, f64)> {+ let mut runs: Vec<(f64, f64, f64, f64)> = Vec::new();+ for &(x, y) in pts {+ match runs.iter_mut().find(|r| x >= r.0 - join && x <= r.2 + join && y >= r.1 - join && y <= r.3 + join) {+ Some(r) => { r.0 = r.0.min(x); r.1 = r.1.min(y); r.2 = r.2.max(x); r.3 = r.3.max(y); }+ None => runs.push((x, y, x, y)),+ }+ }+ // runs that grew into each other merge+ let mut merged = true;+ while merged {+ merged = false;+ 'outer: for i in 0..runs.len() {+ for j in i + 1..runs.len() {+ let (a, b) = (runs[i], runs[j]);+ if a.0 <= b.2 + join && b.0 <= a.2 + join && a.1 <= b.3 + join && b.1 <= a.3 + join {+ runs[i] = (a.0.min(b.0), a.1.min(b.1), a.2.max(b.2), a.3.max(b.3));+ runs.remove(j);+ merged = true;+ break 'outer;+ }+ }+ }+ }+ runs+}++/// A plan that closes each gap: a pour patch `margin` mm round every gap run, on the neighbouring layer that already+/// carries the most reference copper, on that layer's reference net; as apply_pours arguments. Pure.+pub fn fix_plan(rows: &[Value], layers: &[(String, bool, String)], refs: &BTreeMap<String, Raster>, zones: &[Value], skip: &[String], board: (f64, f64, f64, f64), margin: f64) -> Vec<Value> {+ let idx: BTreeMap<&str, usize> = layers.iter().enumerate().map(|(i, l)| (l.0.as_str(), i)).collect();+ let mut pours = Vec::new();+ for row in rows {+ let Some(&i) = row["layer"].as_str().and_then(|l| idx.get(l)) else { continue };+ // a plane needs no patch (it is copper everywhere but its splits); pick the signal neighbour with most copper+ let best = [i.checked_sub(1), Some(i + 1)].iter().flatten().filter_map(|j| layers.get(*j)).filter(|l| !l.1)+ .max_by_key(|l| refs.get(&l.0).map(|r| r.count()).unwrap_or(0));+ let Some(nb) = best else { continue };+ let net = zones.iter().find(|z| z["layer"].as_str() == Some(nb.0.as_str())).and_then(|z| z["net"].as_str()).map(String::from)+ .or_else(|| skip.first().cloned());+ let Some(net) = net else { continue };+ for (k, r) in row["gapRuns"].as_array().cloned().unwrap_or_default().iter().enumerate() {+ let (x0, y0) = ((f(&r[0]) - margin).max(board.0 + 0.3), (f(&r[1]) - margin).max(board.1 + 0.3));+ let (x1, y1) = ((f(&r[2]) + margin).min(board.2 - 0.3), (f(&r[3]) + margin).min(board.3 - 0.3));+ if x1 <= x0 || y1 <= y0 { continue; }+ // does the patch overlap the reference copper already on that layer? (one that does not floats)+ let joins = refs.get(&nb.0).map(|ras| {+ let mut hit = false;+ let mut y = y0;+ while y <= y1 && !hit { let mut x = x0; while x <= x1 && !hit { hit = ras.at(x, y); x += ras.res; } y += ras.res; }+ hit+ }).unwrap_or(false);+ // removeDead off: a patch that only overlaps the pour it extends touches no pad or track of its net, and+ // Altium's dead-copper removal poured it as nothing (0 mm2, measured 2026-10-26)+ pours.push(json!({"net": net, "layer": nb.0, "name": format!("Return {} {}", row["net"].as_str().unwrap_or(""), k + 1), "removeDead": false,+ "points": [[r3(x0), r3(y0)], [r3(x1), r3(y0)], [r3(x1), r3(y1)], [r3(x0), r3(y1)]], "closes": {"net": row["net"], "layer": row["layer"]}, "joinsExistingCopper": joins}));+ }+ }+ pours+}++/// The board, its poured copper and its stack from the input bundle, or the refusal to answer.+fn gather(input: &Value) -> Result<(Value, Vec<Value>, Vec<(String, bool, String)>), Value> {+ let st = crate::input::board(input)?;+ if st["outline"].as_array().map(|a| a.len() < 3).unwrap_or(true) { return Err(crate::input::refuse("no_outline", "the board has no outline")); }+ let zones = crate::input::pours(input);+ let layers = crate::input::stack(input).map(|s| stack_layers(&s)).unwrap_or_default();+ if layers.is_empty() { return Err(crate::input::refuse("no_stack", "the input has no stack: pass the layer_stack companion as stack")); }+ Ok((st, zones, layers))+}++fn res_of(args: &Value) -> f64 { args.get("resolutionMm").and_then(|v| v.as_f64()).unwrap_or(0.1).clamp(0.02, 1.0) }++/// copper_balance: input {board, stack, pours, args: {resolutionMm?}}+pub fn copper_balance(input: &Value) -> Value {+ let (st, zones, layers) = match gather(input) { Ok(g) => g, Err(e) => return e };+ let args = &input["args"];+ let res = res_of(args);+ let (board, maps) = rasters(&st, &zones, &layers, res, None);+ let (rows, pairs) = balance(&board, &maps, &layers);+ let unpoured: Vec<Value> = st["polygons"].as_array().cloned().unwrap_or_default().iter()+ .filter(|g| !zones.iter().any(|z| z["layer"] == g["layer"] && z["net"] == g["net"] && z["filled"] == json!(true)))+ .map(|g| json!({"net": g["net"], "layer": g["layer"]})).collect();+ let ok = pairs.iter().all(|p| p["ok"] == json!(true));+ json!({"success": true, "boardMm2": r1(board.count() as f64 * res * res), "resolutionMm": res, "layers": rows, "pairs": pairs, "balanced": ok,+ "poursWithoutRegions": unpoured,+ "_hint": if ok { "Mirrored layers carry similar copper: the stack should stay flat through reflow." } else { "A mirrored pair differs by more than 20 points of copper: the board can bow or twist through reflow. Pour the lighter layer (apply_pours, a GND pour or copper thieving), or ask the fab to add thieving on its side." }})+}++/// return_path: input {board, stack, pours, args: {nets?, referenceNets?, resolutionMm?, fixMarginMm?}}+pub fn return_path(input: &Value) -> Value {+ let (st, zones, layers) = match gather(input) { Ok(g) => g, Err(e) => return e };+ let args = &input["args"];+ let res = res_of(args);+ // the reference nets: the ones that own pours or planes, unless named+ let mut skip: Vec<String> = args.get("referenceNets").and_then(|v| v.as_array()).map(|a| a.iter().filter_map(|v| v.as_str().map(String::from)).collect()).unwrap_or_default();+ if skip.is_empty() {+ skip = st["polygons"].as_array().cloned().unwrap_or_default().iter().filter_map(|g| g["net"].as_str().map(String::from))+ .chain(zones.iter().filter_map(|z| z["net"].as_str().map(String::from))).chain(layers.iter().filter(|l| l.1).map(|l| l.2.clone()))+ .filter(|n| !n.is_empty()).collect();+ skip.sort(); skip.dedup();+ }+ let (_, refs) = rasters(&st, &zones, &layers, res, Some(&skip));+ let mut rows = return_paths(&st, &refs, &layers, &skip, res);+ if let Some(want) = args.get("nets").and_then(|v| v.as_array()) {+ let w: Vec<String> = want.iter().filter_map(|v| v.as_str()).map(|s| s.to_ascii_lowercase()).collect();+ rows.retain(|r| r["net"].as_str().map(|n| w.contains(&n.to_ascii_lowercase())).unwrap_or(false));+ }+ let no_ref: Vec<&String> = layers.iter().map(|l| &l.0).filter(|n| refs.get(*n).map(|r| r.count() == 0).unwrap_or(true)).collect();+ // a plan to close the gaps, for the caller to read and run: nothing is changed here+ let bb = crate::geom::outline_bbox(&st).unwrap_or((0.0, 0.0, 0.0, 0.0));+ let margin = args.get("fixMarginMm").and_then(|v| v.as_f64()).unwrap_or(1.0);+ let patches = fix_plan(&rows, &layers, &refs, &zones, &skip, bb, margin);+ let fix = if patches.is_empty() { Value::Null } else {+ let pours: Vec<Value> = patches.iter().map(|p| { let mut q = p.clone(); if let Some(o) = q.as_object_mut() { o.remove("closes"); o.remove("joinsExistingCopper"); } q }).collect();+ let floating: Vec<Value> = patches.iter().filter(|p| p["joinsExistingCopper"] == json!(false)).map(|p| json!({"name": p["name"], "layer": p["layer"]})).collect();+ json!({"verb": "apply_pours", "args": {"pours": pours}, "patches": patches.len(), "closes": patches.iter().map(|p| p["closes"].clone()).collect::<Vec<_>>(),+ "floating": floating,+ "note": "A plan only: nothing changed. Each patch is a pour of the reference net round one gap run, on the neighbouring layer with the most reference copper. Read it (a patch can cut through other routing's space: the tool pours round it, keeping clearance), then run the verb with args, repour, and run return_path again. floating patches overlap no copper of their net yet: tie each to it with a via (place_vias) or it is an island."})+ };+ let note = if skip.is_empty() { json!("No net owns a pour or a plane on this board: there is no reference copper, so every signal is reported. Pour GND (apply_pours) or name referenceNets.") } else { Value::Null };+ json!({"success": true, "referenceNets": skip, "note": note, "layersWithNoReferenceCopper": no_ref, "nets": rows, "ok": rows.is_empty(), "resolutionMm": res, "fix": fix,+ "_hint": if rows.is_empty() { "Every signal track runs over pour or plane copper on a neighbouring layer." } else { "Each row is a net whose tracks on that layer run over no pour or plane on either neighbouring layer for unreferencedMm (from firstGapAt). Its return current detours around the gap: more loop area, more emission and crosstalk. Close the gap (extend the pour: apply_pours), route the net over solid copper, or add stitching capacitors or vias where it changes reference." }})+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn raster_shapes_have_their_area() {+ let mut r = Raster::new(0.0, 0.0, 20.0, 20.0, 0.05);+ r.rect(5.0, 5.0, 4.0, 2.0, 0.0);+ assert!((r.count() as f64 * 0.0025 - 8.0).abs() < 0.3);+ let mut c = Raster::new(0.0, 0.0, 20.0, 20.0, 0.05);+ c.capsule(10.0, 10.0, 10.0, 10.0, 4.0);+ assert!((c.count() as f64 * 0.0025 - std::f64::consts::PI * 4.0).abs() < 0.3);+ let mut p = Raster::new(0.0, 0.0, 20.0, 20.0, 0.05);+ 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 {+ json!({"outline": [[0, 0], [20, 0], [20, 10], [0, 10]],+ "outlineEdges": [{"kind": "line", "start": [0.0, 0.0]}, {"kind": "line", "start": [20.0, 0.0]}, {"kind": "line", "start": [20.0, 10.0]}, {"kind": "line", "start": [0.0, 10.0]}],+ "tracks": [{"net": "SIG", "layer": "F.Cu", "width": 0.2, "start": {"x": 1.0, "y": 5.0}, "end": {"x": 19.0, "y": 5.0}}]})+ }++ #[test]+ fn balance_and_return_path_on_a_split_ground() {+ let layers = vec![("F.Cu".to_string(), false, String::new()), ("B.Cu".to_string(), false, String::new())];+ // GND poured on B.Cu over x 0..8 and 12..20: a 4 mm split under the signal+ let zones = vec![json!({"layer": "B.Cu", "net": "GND", "filled": true, "fills": [+ {"outline": [[0, 0], [8, 0], [8, 10], [0, 10]], "holes": []}, {"outline": [[12, 0], [20, 0], [20, 10], [12, 10]], "holes": []}]})];+ let (board, maps) = rasters(&st(), &zones, &layers, 0.1, None);+ let (rows, pairs) = balance(&board, &maps, &layers);+ assert!((rows[1]["percent"].as_f64().unwrap() - 80.0).abs() < 1.0);+ assert!((rows[0]["percent"].as_f64().unwrap() - 1.8).abs() < 0.5);+ assert_eq!(pairs[0]["ok"], json!(false));+ let (_, refs) = rasters(&st(), &zones, &layers, 0.1, Some(&["GND".to_string()]));+ // the signal itself is not reference copper+ assert!(!refs["F.Cu"].at(10.0, 5.0));+ let rp = return_paths(&st(), &refs, &layers, &["GND".to_string()], 0.1);+ assert_eq!(rp.len(), 1);+ assert!((rp[0]["unreferencedMm"].as_f64().unwrap() - 4.0).abs() < 0.2);+ assert_eq!(rp[0]["firstGapAt"][0].as_f64().unwrap().floor(), 8.0);+ }++ #[test]+ fn stack_names_match_routing_state() {+ let s = json!({"layers": [{"name": "Top"}, {"kind": "plane", "plane": 1, "net": "GND"}, {"kind": "signal", "mid": 1}, {"name": "Bottom"}]});+ let l = stack_layers(&s);+ assert_eq!(l.iter().map(|x| x.0.as_str()).collect::<Vec<_>>(), vec!["F.Cu", "In1.Cu", "In2.Cu", "B.Cu"]);+ assert!(l[1].1 && l[1].2 == "GND");+ }+ #[test]+ fn gap_runs_group_and_the_fix_patches_the_neighbour() {+ let pts: Vec<(f64, f64)> = (0..40).map(|k| (8.05 + k as f64 * 0.1, 5.0)).chain((0..5).map(|k| (15.0 + k as f64 * 0.1, 5.0))).collect();+ let runs = gap_runs(&pts, 1.0);+ assert_eq!(runs.len(), 2);+ let layers = vec![("F.Cu".to_string(), false, String::new()), ("B.Cu".to_string(), false, String::new())];+ let zones = vec![json!({"layer": "B.Cu", "net": "GND", "filled": true, "fills": [{"outline": [[0, 0], [8, 0], [8, 10], [0, 10]], "holes": []}]})];+ let (_, refs) = rasters(&st(), &zones, &layers, 0.1, Some(&["GND".to_string()]));+ let rows = vec![json!({"net": "SIG", "layer": "F.Cu", "gapRuns": [[8.05, 5.0, 11.95, 5.0]]})];+ let p = fix_plan(&rows, &layers, &refs, &zones, &["GND".to_string()], (0.0, 0.0, 20.0, 10.0), 1.0);+ assert_eq!(p.len(), 1);+ assert_eq!(p[0]["layer"], "B.Cu");+ assert_eq!(p[0]["net"], "GND");+ assert_eq!(p[0]["points"][0], json!([7.05, 4.0]));+ assert_eq!(p[0]["joinsExistingCopper"], json!(true));+ assert_eq!(p[0]["removeDead"], json!(false));+ }+}
bridge-rs/vendor/adom-eda-checks/src/current.rsadded+140@@ -0,0 +1,140 @@+//! Current capacity of a net's copper (IPC-2221): the width each layer needs for a current at an allowed temperature+//! rise, against the narrowest track the net actually has there, and how many of its vias one layer change needs.+use serde_json::{json, Map, Value};++fn f(v: &Value) -> f64 { v.as_f64().unwrap_or(0.0) }+fn r3(v: f64) -> f64 { (v * 1000.0).round() / 1000.0 }+fn r2(v: f64) -> f64 { (v * 100.0).round() / 100.0 }++const MIL: f64 = 0.0254;++/// IPC-2221's chart as a formula: the cross-section (mil^2) for `amps` at `rise` degrees C, outer or inner layer.+fn area_mil2(amps: f64, rise: f64, outer: bool) -> f64 {+ let k = if outer { 0.048 } else { 0.024 };+ (amps / (k * rise.powf(0.44))).powf(1.0 / 0.725)+}++/// The track width (mm) `amps` needs on copper `copper_um` thick.+pub fn width_for(amps: f64, rise: f64, copper_um: f64, outer: bool) -> f64 {+ let t_mil = copper_um / 1000.0 / MIL;+ area_mil2(amps, rise, outer) / t_mil * MIL+}++/// What one via carries: its barrel (plating `plating_um` around a `drill` mm hole) as an inner conductor.+pub fn via_amps(drill: f64, plating_um: f64, rise: f64) -> f64 {+ let t = plating_um / 1000.0;+ let a_mil2 = std::f64::consts::PI * (drill + t) * t / (MIL * MIL);+ 0.024 * rise.powf(0.44) * a_mil2.powf(0.725)+}++/// routing_state's layer name to its index in the stack (F.Cu first, In<n>.Cu, B.Cu last).+fn stack_index(layer: &str, copper: usize) -> Option<usize> {+ match layer {+ "F.Cu" => Some(0),+ "B.Cu" => Some(copper.saturating_sub(1)),+ l => l.strip_prefix("In").and_then(|r| r.strip_suffix(".Cu")).and_then(|n| n.parse().ok()),+ }+}++/// Per net asked: each layer it is routed on with its narrowest track and the width the current needs. Pure.+pub fn check(state: &Value, copper_um: &[f64], nets: &Map<String, Value>, rise: f64, plating_um: f64) -> Vec<Value> {+ let tracks = state["tracks"].as_array().cloned().unwrap_or_default();+ let arcs = state["arcs"].as_array().cloned().unwrap_or_default();+ let vias = state["vias"].as_array().cloned().unwrap_or_default();+ let polys = state["polygons"].as_array().cloned().unwrap_or_default();+ let n = copper_um.len().max(2);+ nets.iter().map(|(net, amps)| {+ let amps = f(amps);+ let same = |v: &Value| v.as_str().map(|s| s.eq_ignore_ascii_case(net)).unwrap_or(false);+ // the narrowest piece of copper on each layer, tracks and arcs alike+ let mut narrow: std::collections::BTreeMap<String, (f64, Value)> = Default::default();+ let mut see = |layer: &str, w: f64, at: Value| {+ let e = narrow.entry(layer.to_string()).or_insert((f64::MAX, Value::Null));+ if w < e.0 { *e = (w, at); }+ };+ for t in tracks.iter().filter(|t| same(&t["net"])) { see(t["layer"].as_str().unwrap_or("?"), f(&t["width"]), json!([t["start"]["x"], t["start"]["y"]])); }+ for a in arcs.iter().filter(|a| same(&a["net"])) { see(a["layer"].as_str().unwrap_or("?"), f(&a["width"]), json!([a["center"]["x"], a["center"]["y"]])); }+ let mut short = Vec::new();+ let layers: Vec<Value> = narrow.into_iter().filter(|(l, _)| l.ends_with(".Cu")).map(|(layer, (w, at))| {+ let i = stack_index(&layer, n).unwrap_or(0);+ let outer = i == 0 || i + 1 == n;+ let cu = copper_um.get(i).copied().filter(|c| *c > 0.0).unwrap_or(35.0);+ let need = width_for(amps, rise, cu, outer);+ if w + 1e-9 < need { short.push(layer.clone()); }+ json!({"layer": layer, "copperUm": cu, "narrowestMm": r3(w), "at": at, "neededMm": r3(need), "ok": w + 1e-9 >= need})+ }).collect();+ let net_vias: Vec<&Value> = vias.iter().filter(|v| same(&v["net"])).collect();+ let smallest = net_vias.iter().map(|v| f(&v["drill"])).fold(f64::MAX, f64::min);+ let via = if net_vias.is_empty() { Value::Null } else {+ let each = via_amps(smallest, plating_um, rise);+ json!({"count": net_vias.len(), "smallestDrillMm": r3(smallest), "ampsEach": r2(each), "neededPerLayerChange": (amps / each).ceil() as i64})+ };+ let pours: Vec<Value> = polys.iter().filter(|p| same(&p["net"])).map(|p| p["layer"].clone()).collect();+ json!({"net": net, "amps": amps, "layers": layers, "shortOn": short, "ok": short.is_empty(), "vias": via, "poursOn": pours})+ }).collect()+}++/// current_capacity: input {board, stack?, args: {nets: {net: amps}, riseC?, platingUm?}}. Without a stack every layer+/// is taken as 35 um (1 oz) copper, and the reply says so.+pub fn current_capacity(input: &Value) -> Value {+ let args = &input["args"];+ let nets = match args.get("nets").and_then(|v| v.as_object()) {+ Some(m) if !m.is_empty() && m.values().all(|v| v.as_f64().map(|a| a > 0.0).unwrap_or(false)) => m.clone(),+ _ => return json!({"success": false, "errorCode": "bad_args", "error": "nets is {net: amps}, e.g. {\"VIN\": 3, \"GND\": 3}"}),+ };+ let rise = args.get("riseC").and_then(|v| v.as_f64()).unwrap_or(10.0);+ let plating = args.get("platingUm").and_then(|v| v.as_f64()).unwrap_or(25.0);+ let st = match crate::input::board(input) { Ok(b) => b, Err(e) => return e };+ let missing: Vec<&String> = nets.keys().filter(|k| !st["nets"].as_array().map(|a| a.iter().any(|n| n.as_str().map(|s| s.eq_ignore_ascii_case(k)).unwrap_or(false))).unwrap_or(false)).collect();+ if !missing.is_empty() { return json!({"success": false, "errorCode": "no_such_net", "error": format!("not nets on this board: {missing:?}"), "nets": st["nets"]}); }+ let stack = crate::input::stack(input);+ let copper: Vec<f64> = stack.as_ref().and_then(|s| s["layers"].as_array().cloned()).unwrap_or_default().iter().map(|l| f(&l["copperUm"])).collect();+ let rows = check(&st, &copper, &nets, rise, plating);+ let all_ok = rows.iter().all(|r| r["ok"].as_bool() == Some(true));+ json!({"success": true, "riseC": rise, "platingUm": plating, "nets": rows, "ok": all_ok,+ "assumed": if copper.is_empty() { json!("no stack in the input: every layer taken as 35 um (1 oz) copper") } else { Value::Null },+ "_hint": if all_ok { "Every routed layer of these nets carries its current within the temperature rise (IPC-2221). Vias: a layer change needs neededPerLayerChange of them side by side." }+ else { "shortOn names the layers whose narrowest copper is under neededMm: widen it (set_track_width, or a width rule with add_rule) or pour the net (apply_pours). A pour on the same layer (poursOn) may already carry the current; the check reads tracks only." }})+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn ipc_2221_matches_its_chart() {+ // 1 oz (35 um) outer copper, 10 C rise: 1 A needs about 0.30 mm (12 mil), 3 A about 1.4 mm+ let w1 = width_for(1.0, 10.0, 35.0, true);+ assert!((0.25..0.35).contains(&w1), "{w1}");+ let w3 = width_for(3.0, 10.0, 35.0, true);+ assert!((1.2..1.6).contains(&w3), "{w3}");+ // inner layers need about 2.6x the width+ assert!(width_for(1.0, 10.0, 35.0, false) / w1 > 2.4);+ // a 0.3 mm via with 25 um plating carries roughly 1 to 1.5 A at 10 C+ let v = via_amps(0.3, 25.0, 10.0);+ assert!((0.8..1.6).contains(&v), "{v}");+ }++ #[test]+ fn check_finds_the_narrow_layer() {+ let st = json!({"tracks": [{"net": "VIN", "layer": "F.Cu", "width": 1.5, "start": {"x": 0.0, "y": 0.0}}, {"net": "VIN", "layer": "B.Cu", "width": 0.3, "start": {"x": 4.0, "y": 1.0}}],+ "vias": [{"net": "VIN", "drill": 0.3}, {"net": "VIN", "drill": 0.4}], "polygons": [{"net": "VIN", "layer": "B.Cu"}]});+ let nets = json!({"VIN": 3.0}).as_object().unwrap().clone();+ let r = &check(&st, &[35.0, 35.0], &nets, 10.0, 25.0)[0];+ assert_eq!(r["shortOn"], json!(["B.Cu"]));+ assert_eq!(r["vias"]["smallestDrillMm"], 0.3);+ assert!(r["vias"]["neededPerLayerChange"].as_i64().unwrap() >= 2);+ assert_eq!(r["poursOn"], json!(["B.Cu"]));+ }++ #[test]+ fn the_verb_says_what_it_assumed_and_refuses_unknown_nets() {+ let st = json!({"nets": ["VIN"], "tracks": [{"net": "VIN", "layer": "F.Cu", "width": 0.2, "start": {"x": 0.0, "y": 0.0}}]});+ let r = current_capacity(&json!({"board": st, "args": {"nets": {"VIN": 2}}}));+ assert_eq!(r["ok"], json!(false));+ assert!(r["assumed"].as_str().unwrap().contains("35 um"));+ assert_eq!(current_capacity(&json!({"board": st, "args": {"nets": {"VOUT": 1}}}))["errorCode"], "no_such_net");+ assert_eq!(current_capacity(&json!({"board": st, "args": {}}))["errorCode"], "bad_args");+ }+}+
bridge-rs/vendor/adom-eda-checks/src/fab.rsadded+294@@ -0,0 +1,294 @@+//! The board's fab-relevant minimums, measured from the board model, and how they compare with a fab's limits: the+//! numbers a fab's order form and capability page ask about, so the AI can check a board before ordering. Fab limits+//! are never kept here: they come in as a record from adom/pcb-design-rules (`fab`), or as explicit `limits`.+use serde_json::{json, Map, Value};++fn f(v: &Value) -> f64 { v.as_f64().unwrap_or(0.0) }+fn r3(v: f64) -> f64 { (v * 1000.0).round() / 1000.0 }++/// The nearest copper (track, arc, pad, via) to the real outline, edge of copper to the outline's line, mm. Pour+/// boundaries are left out: they are drawn on the edge and the tool pulls the poured copper back by its rules.+pub fn edge_distance(state: &Value) -> Option<(f64, Value)> {+ let ring = crate::coppermap::outline_ring(state);+ if ring.len() < 3 { return None; }+ let seg = |x: f64, y: f64| -> f64 {+ (0..ring.len()).map(|k| {+ let (a, b) = (ring[k], ring[(k + 1) % ring.len()]);+ let (dx, dy) = (b.0 - a.0, b.1 - a.1);+ let l2 = dx * dx + dy * dy;+ let t = if l2 > 0.0 { (((x - a.0) * dx + (y - a.1) * dy) / l2).clamp(0.0, 1.0) } else { 0.0 };+ ((a.0 + t * dx - x).powi(2) + (a.1 + t * dy - y).powi(2)).sqrt()+ }).fold(f64::MAX, f64::min)+ };+ let copper = |l: &Value| l.as_str().map(|s| s.ends_with(".Cu")).unwrap_or(false);+ let mut pts: Vec<(f64, f64, f64, Value)> = Vec::new();+ for t in state["tracks"].as_array().cloned().unwrap_or_default().iter().filter(|t| copper(&t["layer"])) {+ for p in [&t["start"], &t["end"]] { pts.push((f(&p["x"]), f(&p["y"]), f(&t["width"]) / 2.0, json!({"track": t["net"], "layer": t["layer"]}))); }+ }+ for v in state["vias"].as_array().cloned().unwrap_or_default() { pts.push((f(&v["position"]["x"]), f(&v["position"]["y"]), f(&v["size"]) / 2.0, json!({"via": v["net"]}))); }+ for p in state["pads"].as_array().cloned().unwrap_or_default() {+ let (rf, nm) = (p["ref"].as_str().unwrap_or(""), p["name"].as_str().unwrap_or(""));+ pts.push((f(&p["x"]), f(&p["y"]), f(&p["sizeX"]).max(f(&p["sizeY"])) / 2.0, json!({"pad": if rf.is_empty() { nm.to_string() } else { format!("{rf}.{nm}") }})));+ }+ pts.into_iter().map(|(x, y, half, mut what)| { what["at"] = json!([r3(x), r3(y)]); (r3(seg(x, y) - half), what) })+ .min_by(|a, b| a.0.partial_cmp(&b.0).unwrap())+}++/// The smallest of each feature with where it is. Pure, for the tests.+pub fn measure(state: &Value) -> Map<String, Value> {+ let mut m = Map::new();+ let mut min_by = |key: &str, items: Vec<(f64, Value)>| {+ if let Some((v, at)) = items.into_iter().filter(|(v, _)| *v > 0.0).min_by(|a, b| a.0.partial_cmp(&b.0).unwrap()) {+ m.insert(key.into(), json!({"mm": r3(v), "at": at}));+ }+ };+ // copper only: outline and drawing lines on mechanical layers (L57...) are not tracks a fab etches+ let copper = |l: &Value| l.as_str().map(|s| s == "F.Cu" || s == "B.Cu" || (s.starts_with("In") && s.ends_with(".Cu"))).unwrap_or(false);+ min_by("track", state["tracks"].as_array().cloned().unwrap_or_default().iter().filter(|t| copper(&t["layer"])).map(|t| (f(&t["width"]), json!({"net": t["net"], "layer": t["layer"], "from": [t["start"]["x"], t["start"]["y"]]}))).collect());+ let vias = state["vias"].as_array().cloned().unwrap_or_default();+ min_by("viaDrill", vias.iter().map(|v| (f(&v["drill"]), json!({"net": v["net"], "at": [v["position"]["x"], v["position"]["y"]]}))).collect());+ min_by("viaDiameter", vias.iter().map(|v| (f(&v["size"]), json!({"net": v["net"], "at": [v["position"]["x"], v["position"]["y"]]}))).collect());+ min_by("viaAnnularRing", vias.iter().map(|v| ((f(&v["size"]) - f(&v["drill"])) / 2.0, json!({"net": v["net"], "at": [v["position"]["x"], v["position"]["y"]]}))).collect());+ let pads = state["pads"].as_array().cloned().unwrap_or_default();+ let drilled: Vec<&Value> = pads.iter().filter(|p| f(&p["drill"]) > 0.0).collect();+ let label = |p: &Value| json!({"pad": format!("{}.{}", p["ref"].as_str().unwrap_or(""), p["name"].as_str().unwrap_or("")), "at": [p["x"], p["y"]]});+ min_by("padHole", drilled.iter().map(|p| (f(&p["drill"]), label(p))).collect());+ // a pad's ring on its narrow side (a round hole in an oblong pad)+ min_by("padAnnularRing", drilled.iter().filter(|p| f(&p["sizeX"]) > f(&p["drill"])).map(|p| ((f(&p["sizeX"]).min(f(&p["sizeY"])) - f(&p["drill"])) / 2.0, label(p))).collect());+ min_by("smdPad", pads.iter().filter(|p| f(&p["drill"]) == 0.0).map(|p| (f(&p["sizeX"]).min(f(&p["sizeY"])), label(p))).collect());+ if let Some((x0, y0, x1, y1)) = crate::geom::outline_bbox(state) {+ m.insert("boardSize".into(), json!({"mm": [r3(x1 - x0), r3(y1 - y0)]}));+ let _ = (x0, y0, x1, y1);+ if let Some((d, mut at)) = edge_distance(state) { at["mm"] = json!(d); m.insert("edgeClearance".into(), at); }+ }+ // drilled holes: the largest, and the closest pair edge to edge (via to via, and any pair with a pad hole)+ let mut holes: Vec<(f64, f64, f64, bool, Value)> = vias.iter().map(|v| (f(&v["position"]["x"]), f(&v["position"]["y"]), f(&v["drill"]), false, json!({"via": v["net"], "at": [v["position"]["x"], v["position"]["y"]]}))).collect();+ holes.extend(drilled.iter().map(|p| (f(&p["x"]), f(&p["y"]), f(&p["drill"]), true, label(p))));+ if let Some(h) = holes.iter().max_by(|a, b| a.2.partial_cmp(&b.2).unwrap()) { m.insert("largestDrill".into(), json!({"mm": r3(h.2), "at": h.4})); }+ holes.sort_by(|a, b| a.0.partial_cmp(&b.0).unwrap());+ let (mut vv, mut pp): (Option<(f64, Value)>, Option<(f64, Value)>) = (None, None);+ for i in 0..holes.len() {+ for j in i + 1..holes.len() {+ let (a, b) = (&holes[i], &holes[j]);+ if b.0 - a.0 > 10.0 { break; }+ let d = ((a.0 - b.0).powi(2) + (a.1 - b.1).powi(2)).sqrt() - (a.2 + b.2) / 2.0;+ if (a.0 - b.0).abs() < 1e-6 && (a.1 - b.1).abs() < 1e-6 { continue; } // a via in a pad+ let slot = if a.3 || b.3 { &mut pp } else { &mut vv };+ if slot.as_ref().map(|s| d < s.0).unwrap_or(true) { *slot = Some((d, json!([a.4.clone(), b.4.clone()]))); }+ }+ }+ if let Some((d, at)) = vv { m.insert("holeToHoleVia".into(), json!({"mm": r3(d), "at": at})); }+ if let Some((d, at)) = pp { m.insert("holeToHolePad".into(), json!({"mm": r3(d), "at": at})); }+ m.insert("counts".into(), json!({"tracks": state["tracks"].as_array().map(|a| a.len()), "vias": vias.len(), "pads": pads.len(), "drilledPads": drilled.len()}));+ m+}++/// The measured values against the caller's limits; each limit names its feature (min*, or max for board and layers).+pub fn compare(meas: &Map<String, Value>, limits: &Map<String, Value>, clearance: Option<f64>, layers: Option<i64>) -> Vec<Value> {+ let mut out = Vec::new();+ let got = |k: &str| meas.get(k).and_then(|v| v["mm"].as_f64());+ for (limit, feature) in [("minTrack", "track"), ("minViaDrill", "viaDrill"), ("minViaDiameter", "viaDiameter"), ("minViaAnnularRing", "viaAnnularRing"),+ ("minPadHole", "padHole"), ("minPadAnnularRing", "padAnnularRing"), ("minSmdPad", "smdPad"),+ ("minEdgeClearance", "edgeClearance"), ("minHoleToHoleVia", "holeToHoleVia"), ("minHoleToHolePad", "holeToHolePad"),+ ("minSilkLine", "silkLine"), ("minSilkText", "silkText")] {+ if let (Some(l), Some(v)) = (limits.get(limit).and_then(|x| x.as_f64()), got(feature)) {+ if v + 1e-9 < l { out.push(json!({"limit": limit, "limitMm": l, "boardMm": v, "at": meas[feature]["at"]})); }+ }+ }+ if let (Some(l), Some(c)) = (limits.get("minClearance").and_then(|x| x.as_f64()), clearance) {+ if c + 1e-9 < l { out.push(json!({"limit": "minClearance", "limitMm": l, "boardMm": c, "at": "the board's clearance rule"})); }+ }+ if let (Some(l), Some(n)) = (limits.get("maxLayers").and_then(|x| x.as_i64()), layers) {+ if n > l { out.push(json!({"limit": "maxLayers", "limit_": l, "board": n})); }+ }+ if let (Some(l), Some(v)) = (limits.get("maxDrill").and_then(|x| x.as_f64()), got("largestDrill")) {+ if v > l + 1e-9 { out.push(json!({"limit": "maxDrill", "limitMm": l, "boardMm": v, "at": meas["largestDrill"]["at"], "note": "larger holes are milled (routed) instead"})); }+ }+ if let (Some(lim), Some(sz)) = (limits.get("minBoardMm").and_then(|x| x.as_array()), meas.get("boardSize").and_then(|b| b["mm"].as_array())) {+ let (lw, lh) = (lim.first().and_then(|x| x.as_f64()).unwrap_or(0.0), lim.get(1).and_then(|x| x.as_f64()).unwrap_or(0.0));+ let (w, h) = (sz[0].as_f64().unwrap_or(0.0), sz[1].as_f64().unwrap_or(0.0));+ if w.min(h) + 1e-9 < lw.min(lh) || w.max(h) + 1e-9 < lw.max(lh) { out.push(json!({"limit": "minBoardMm", "limitMm": [lw, lh], "boardMm": [w, h]})); }+ }+ if let (Some(lim), Some(sz)) = (limits.get("maxBoardMm").and_then(|x| x.as_array()), meas.get("boardSize").and_then(|b| b["mm"].as_array())) {+ let (lw, lh) = (lim.first().and_then(|x| x.as_f64()).unwrap_or(f64::MAX), lim.get(1).and_then(|x| x.as_f64()).unwrap_or(f64::MAX));+ let (w, h) = (sz[0].as_f64().unwrap_or(0.0), sz[1].as_f64().unwrap_or(0.0));+ // either orientation fits+ if !((w <= lw && h <= lh) || (w <= lh && h <= lw)) { out.push(json!({"limit": "maxBoardMm", "limitMm": [lw, lh], "boardMm": [w, h]})); }+ }+ out+}++/// The smallest clearance among the board's enabled clearance rules, in mm. A rule gives it as a number+/// (`clearanceMm`, `gapMm` or `minMm`) or in a descriptor the tool wrote ("Gap=10mil", "Gap=0.2mm": Altium's form).+pub fn min_clearance(rules: &[Value]) -> Option<f64> {+ rules.iter().filter(|r| r["kind"].as_i64() == Some(0) || r["kind"].as_str().map(|k| k.eq_ignore_ascii_case("clearance")).unwrap_or(false)+ || r["kindName"].as_str() == Some("Clearance") || r["name"].as_str().map(|n| n.to_lowercase().contains("clearance")).unwrap_or(false))+ .filter(|r| r["enabled"].as_bool() != Some(false))+ .filter_map(|r| {+ if let Some(v) = ["clearanceMm", "gapMm", "minMm"].iter().find_map(|k| r[*k].as_f64()) { return Some(v); }+ let d = r["descriptor"].as_str()?;+ let i = d.find("Gap=")? + 4;+ let num: String = d[i..].chars().take_while(|c| c.is_ascii_digit() || *c == '.').collect();+ let v: f64 = num.parse().ok()?;+ let unit = &d[i + num.len()..];+ Some(if unit.starts_with("mil") { v * 0.0254 } else { v })+ }).reduce(f64::min).map(r3)+}++/// A pcb-design-rules record (one entry of `rules/records/<vendor>.json`'s `records`, with the file's `vendor`) as the+/// limits this check compares, plus what to say about where they came from. Limits the record does not give are left+/// out, never guessed. Pure.+pub fn limits_from_record(rec: &Value, vendor: &str) -> (Map<String, Value>, Value) {+ let mut l = Map::new();+ let mut put = |k: &str, v: Option<f64>| { if let Some(v) = v { l.insert(k.into(), json!(v)); } };+ put("minTrack", rec["minTraceWidth"]["mm"].as_f64());+ put("minClearance", rec["minCopperClearance"]["mm"].as_f64().or(rec["minSpacing"]["mm"].as_f64()));+ put("minViaDrill", rec["minVia"]["drillMm"].as_f64());+ put("minViaDiameter", rec["minVia"]["padMm"].as_f64());+ put("minPadHole", rec["minDrill"]["mm"].as_f64());+ // the record's annular ring is the plated-through-hole ring ("PTH ... absolute minimum")+ put("minPadAnnularRing", rec["annularRing"]["viaMm"].as_f64());+ put("minEdgeClearance", rec["copperToBoardEdge"]["mm"].as_f64());+ put("minHoleToHoleVia", rec["holeToHole"]["mm"].as_f64());+ put("minSilkLine", rec["silkLineWidth"]["mm"].as_f64());+ if let (Some(x), Some(y)) = (rec["maxBoardSize"]["xMm"].as_f64(), rec["maxBoardSize"]["yMm"].as_f64()) { l.insert("maxBoardMm".into(), json!([x, y])); }+ if let Some(n) = rec["layerCount"].as_i64() { l.insert("maxLayers".into(), json!(n)); }+ let src = rec["sources"].as_array().and_then(|s| s.first()).cloned().unwrap_or(Value::Null);+ let conditions: Map<String, Value> = rec.as_object().map(|o| o.iter().filter_map(|(k, v)| v.get("condition").map(|c| (k.clone(), c.clone()))).collect()).unwrap_or_default();+ let fab = json!({"name": vendor, "process": rec["process"], "layers": rec["layerCount"], "source": src["url"], "read": src["dateRead"],+ "conditions": conditions, "notes": rec["notes"]});+ (l, fab)+}++/// fab_check: input {board, stack?, rules?, silk?, fab?, args: {limits?, copperOz?}}. `fab` is a pcb-design-rules+/// record (one of a vendor file's `records`, with `vendor` beside it or given as args.vendor); `limits` adds or+/// overrides any limit by name, in mm.+pub fn fab_check(input: &Value) -> Value {+ let st = match crate::input::board(input) { Ok(b) => b, Err(e) => return e };+ let args = &input["args"];+ let mut meas = measure(&st);+ let rule_list = crate::input::rules(input);+ let clearance = min_clearance(&rule_list);+ if let Some(c) = clearance { meas.insert("clearanceRule".into(), json!({"mm": c})); }+ let stack = crate::input::stack(input);+ let layers = stack.as_ref().and_then(|s| s["copperLayers"].as_i64());+ if let Some(n) = layers { meas.insert("copperLayers".into(), json!(n)); }+ let mut limits = Map::new();+ let mut fab = Value::Null;+ if let Some(rec) = input.get("fab").filter(|r| !r.is_null()) {+ let vendor = rec["vendor"].as_str().or(args["vendor"].as_str()).unwrap_or("the fab").to_string();+ let (l, mut fv) = limits_from_record(rec, &vendor);+ if let (Some(want), Some(n)) = (rec["layerCount"].as_i64(), layers) {+ if want != n { fv["mismatch"] = json!(format!("the record is for {want} layers; the board has {n}: pass the {n}-layer record")); }+ }+ // the record's limits hold for its stated copper (1 oz outer as a rule); heavier copper needs wider tracks+ let outer_um = stack.as_ref().and_then(|s| s["layers"][0]["copperUm"].as_f64()).unwrap_or(35.0);+ let oz = args["copperOz"].as_f64().unwrap_or(outer_um / 35.0);+ fv["copperOz"] = json!(r3(oz));+ if oz >= 1.75 { fv["copperNote"] = json!("the board's outer copper is heavier than the record's 1 oz condition: its notes give the wider track and gap limits for heavier copper; pass them as limits"); }+ limits = l;+ fab = fv;+ }+ for (k, v) in args["limits"].as_object().cloned().unwrap_or_default() { limits.insert(k, v); }+ // silkscreen sizes from silk_state, only when a limit asks and the input has it+ if limits.contains_key("minSilkText") || limits.contains_key("minSilkLine") {+ if let Some(silk) = crate::input::part(input, "silk") {+ let mut texts: Vec<(f64, Value)> = silk["texts"].as_array().cloned().unwrap_or_default().iter().filter(|t| t["side"] != "other").map(|t| (f(&t["size"]), json!({"text": t["text"], "at": [t["x"], t["y"]]}))).collect();+ for c in silk["components"].as_array().cloned().unwrap_or_default() {+ for k in ["name", "comment"] { if c[k]["shown"].as_bool() == Some(true) { texts.push((f(&c[k]["size"]), json!({"ref": c["ref"], "text": c[k]["text"], "at": [c[k]["x"], c[k]["y"]]}))); } }+ }+ if let Some((v, at)) = texts.into_iter().filter(|t| t.0 > 0.0).min_by(|a, b| a.0.partial_cmp(&b.0).unwrap()) { meas.insert("silkText".into(), json!({"mm": r3(v), "at": at})); }+ if let Some(l) = silk["lines"].as_array().cloned().unwrap_or_default().iter().filter(|l| l["side"] != "other" && f(&l["width"]) > 0.0).min_by(|a, b| f(&a["width"]).partial_cmp(&f(&b["width"])).unwrap()) {+ meas.insert("silkLine".into(), json!({"mm": r3(f(&l["width"])), "at": [l["x1"], l["y1"]]}));+ }+ }+ }+ let mut fails = compare(&meas, &limits, clearance, layers);+ // each finding names where its limit came from+ if !fab.is_null() { for x in fails.iter_mut() { x["source"] = json!({"name": fab["name"], "url": fab["source"], "read": fab["read"]}); } }+ let unseen: Vec<&str> = [("minClearance", clearance.is_some()), ("minSilkText", meas.contains_key("silkText")), ("minSilkLine", meas.contains_key("silkLine")), ("maxLayers", layers.is_some())]+ .iter().filter(|(k, seen)| limits.contains_key(*k) && !seen).map(|(k, _)| *k).collect();+ json!({"success": true, "fab": fab, "measured": meas, "limitsChecked": limits.keys().collect::<Vec<_>>(), "outsideLimits": fails,+ "notChecked": unseen, "fits": if limits.is_empty() { Value::Null } else { json!(fails.is_empty()) },+ "costlierOrBelowRecommended": [],+ "_hint": if limits.is_empty() { "Measured only. Pass a fab's record from adom/pcb-design-rules as fab, or limits:{minTrack, minClearance, minViaDrill, minViaDiameter, minViaAnnularRing, minPadHole, minPadAnnularRing, minSmdPad, minEdgeClearance, minHoleToHoleVia, minHoleToHolePad, maxDrill, minSilkLine, minSilkText, maxLayers, minBoardMm:[w,h], maxBoardMm:[w,h]} in mm, to check them." }+ else { "outsideLimits names each feature below the fab's limit, where it is, and the page the limit came from. notChecked lists limits the input gave nothing to measure against (pass rules, stack or silk). Read fab.notes: costlier options and recommended sizes are there. Fix the board (set_track_width, add_rule, a footprint change) or choose the fab's advanced service; then run run_drc." }})+}++#[cfg(test)]+mod tests {+ use super::*;++ fn board() -> Value {+ json!({"tracks": [{"width": 0.25, "net": "A", "layer": "F.Cu", "start": {"x": 0.0, "y": 0.0}}, {"width": 0.1, "net": "B", "layer": "B.Cu", "start": {"x": 5.0, "y": 5.0}}, {"width": 0.05, "net": "", "layer": "L57", "start": {"x": 0.0, "y": 0.0}}],+ "vias": [{"size": 0.6, "drill": 0.3, "net": "GND", "position": {"x": 1.0, "y": 1.0}}, {"size": 0.45, "drill": 0.25, "net": "B", "position": {"x": 2.0, "y": 2.0}}],+ "pads": [{"ref": "J1", "name": "1", "x": 0.0, "y": 0.0, "sizeX": 1.7, "sizeY": 1.7, "drill": 1.0}, {"ref": "U1", "name": "3", "x": 3.0, "y": 0.0, "sizeX": 0.3, "sizeY": 1.0, "drill": 0.0}],+ "outline": [[0, 0], [50, 0], [50, 30], [0, 30]]})+ }++ #[test]+ fn the_smallest_features_are_found_with_where_they_are() {+ let m = measure(&board());+ assert_eq!(m["track"]["mm"], json!(0.1));+ assert_eq!(m["track"]["at"]["net"], json!("B"));+ assert_eq!((m["viaDrill"]["mm"].clone(), m["viaDiameter"]["mm"].clone(), m["viaAnnularRing"]["mm"].clone()), (json!(0.25), json!(0.45), json!(0.1)));+ assert_eq!((m["padHole"]["mm"].clone(), m["padAnnularRing"]["mm"].clone(), m["smdPad"]["mm"].clone()), (json!(1.0), json!(0.35), json!(0.3)));+ assert_eq!(m["boardSize"]["mm"], json!([50.0, 30.0]));+ }++ #[test]+ fn arc_edges_count_toward_the_board_size() {+ let b = json!({"outline": [[0, 0], [10, 0]], "outlineEdges": [{"kind": "arc", "center": [5.0, 0.0], "radius": 5.0, "angle1": 0.0, "angle2": 180.0}]});+ assert_eq!(measure(&b)["boardSize"]["mm"], json!([10.0, 5.0]));+ }++ #[test]+ fn limits_name_what_falls_short_and_a_board_fits_either_way_round() {+ let m = measure(&board());+ let lim = json!({"minTrack": 0.127, "minViaDrill": 0.3, "maxBoardMm": [30, 60], "maxLayers": 2, "minClearance": 0.127});+ let f = compare(&m, lim.as_object().unwrap(), Some(0.1), Some(2));+ let names: Vec<&str> = f.iter().map(|x| x["limit"].as_str().unwrap()).collect();+ assert_eq!(names, vec!["minTrack", "minViaDrill", "minClearance"]);+ }++ #[test]+ fn clearance_is_read_from_rule_descriptors_in_mil_or_mm() {+ let rules = vec![json!({"kind": 0, "descriptor": "Clearance Constraint (Gap=10mil) (All),(All)", "enabled": true}),+ json!({"kind": 0, "descriptor": "Clearance Constraint (Gap=0.15mm) (InNet('SW')),(All)", "enabled": true}),+ json!({"kind": 0, "descriptor": "Clearance Constraint (Gap=0.05mm) (All),(All)", "enabled": false})];+ assert_eq!(min_clearance(&rules), Some(0.15));+ }+ /// JLCPCB's 2-layer record as adom/pcb-design-rules gives it (rules/records/jlcpcb.json, read 2026-09-03), trimmed+ fn jlc_2l() -> Value {+ json!({"vendor": "JLCPCB", "process": "standard", "layerCount": 2, "minTraceWidth": {"mm": 0.1, "condition": "1 oz copper outer layer"},+ "minSpacing": {"mm": 0.1}, "minDrill": {"mm": 0.15}, "minVia": {"drillMm": 0.15, "padMm": 0.25}, "annularRing": {"viaMm": 0.18},+ "copperToBoardEdge": {"mm": 0.2}, "holeToHole": {"mm": 0.2}, "silkLineWidth": {"mm": 0.15}, "minCopperClearance": {"mm": 0.1},+ "maxBoardSize": {"xMm": 670.0, "yMm": 600.0}, "notes": "Min drill 0.15 mm costs more.",+ "sources": [{"url": "https://jlcpcb.com/capabilities/pcb-capabilities", "dateRead": "2026-09-03"}]})+ }++ #[test]+ fn a_pcb_design_rules_record_becomes_limits_with_its_source() {+ let (l, fab) = limits_from_record(&jlc_2l(), "JLCPCB");+ assert_eq!((l["minTrack"].clone(), l["minClearance"].clone(), l["minPadAnnularRing"].clone()), (json!(0.1), json!(0.1), json!(0.18)));+ assert_eq!(l["maxBoardMm"], json!([670.0, 600.0]));+ assert!(!l.contains_key("minSilkText"), "a limit the record does not give is not guessed");+ assert_eq!((fab["source"].as_str(), fab["read"].as_str()), (Some("https://jlcpcb.com/capabilities/pcb-capabilities"), Some("2026-09-03")));+ // a 0.08 mm track fails, holes 0.15 mm apart edge to edge fail the via rule; each finding names the page+ let st = json!({"tracks": [{"width": 0.08, "net": "A", "layer": "F.Cu", "start": {"x": 1.0, "y": 1.0}}],+ "vias": [{"drill": 0.3, "size": 0.6, "net": "A", "position": {"x": 0.0, "y": 0.0}}, {"drill": 0.3, "size": 0.6, "net": "B", "position": {"x": 0.45, "y": 0.0}}],+ "outline": [[-5, -5], [5, -5], [5, 5], [-5, 5]]});+ let r = fab_check(&json!({"board": st, "stack": {"copperLayers": 2, "layers": [{"copperUm": 35}, {"copperUm": 35}]}, "fab": jlc_2l()}));+ let fails: Vec<&str> = r["outsideLimits"].as_array().unwrap().iter().map(|f| f["limit"].as_str().unwrap()).collect();+ assert!(fails.contains(&"minTrack") && fails.contains(&"minHoleToHoleVia"), "{fails:?}");+ assert_eq!(r["outsideLimits"][0]["source"]["read"], "2026-09-03");+ assert_eq!(r["fits"], json!(false));+ // no rules in the input: the clearance limit is reported as not checked, never passed+ assert!(r["notChecked"].as_array().unwrap().contains(&json!("minClearance")));+ }++ #[test]+ fn clearance_from_a_standard_rule() {+ assert_eq!(min_clearance(&[json!({"kind": "clearance", "clearanceMm": 0.127}), json!({"kind": "clearance", "gapMm": 0.2})]), Some(0.127));+ }+}
bridge-rs/vendor/adom-eda-checks/src/geom.rsadded+23@@ -0,0 +1,23 @@+//! Board geometry shared by the checks: the outline's bounding box with its arc edges sampled.+use serde_json::Value;++fn f(v: &Value) -> f64 { v.as_f64().unwrap_or(0.0) }++/// The outline's bounding box (x0, y0, x1, y1) in mm, arc edges included.+pub fn outline_bbox(state: &Value) -> Option<(f64, f64, f64, f64)> {+ let mut o: Vec<(f64, f64)> = state["outline"].as_array().cloned().unwrap_or_default().iter().map(|p| (f(&p[0]), f(&p[1]))).collect();+ // an arc edge bulges past its end points: sample it (the Bluetooth Sentinel example measured 80 x 4.5 mm by its+ // vertices alone)+ for e in state["outlineEdges"].as_array().cloned().unwrap_or_default() {+ if e["kind"].as_str() != Some("arc") { continue; }+ let (cx, cy, r) = (f(&e["center"][0]), f(&e["center"][1]), f(&e["radius"]));+ let (a1, mut a2) = (f(&e["angle1"]), f(&e["angle2"]));+ if a2 <= a1 { a2 += 360.0; }+ let mut a = a1;+ while a <= a2 + 1e-9 { o.push((cx + r * a.to_radians().cos(), cy + r * a.to_radians().sin())); a += 2.0; }+ }+ if o.is_empty() { return None; }+ let (x0, x1) = o.iter().fold((f64::MAX, f64::MIN), |a, p| (a.0.min(p.0), a.1.max(p.0)));+ let (y0, y1) = o.iter().fold((f64::MAX, f64::MIN), |a, p| (a.0.min(p.1), a.1.max(p.1)));+ Some((x0, y0, x1, y1))+}
bridge-rs/vendor/adom-eda-checks/src/impedance.rsadded+234@@ -0,0 +1,234 @@+//! Controlled impedance from the board's stack-up (the layer_stack companion): the track width (and pair gap) each copper layer needs for a+//! target impedance, by closed-form models (Hammerstad-Jensen microstrip, Wheeler stripline, IPC-2141 coupling). Within+//! a few percent of a field solver for ordinary FR-4 geometry; the fab's stack-up and its solver have the last word.+use serde_json::{json, Value};+use std::f64::consts::PI;++fn r3(v: f64) -> f64 { (v * 1000.0).round() / 1000.0 }+fn r1(v: f64) -> f64 { (v * 10.0).round() / 10.0 }++/// Free-space impedance of a microstrip of width ratio u (Hammerstad-Jensen).+fn z01(u: f64) -> f64 {+ let f = 6.0 + (2.0 * PI - 6.0) * (-(30.666 / u).powf(0.7528)).exp();+ 60.0 * (f / u + (1.0 + 4.0 / (u * u)).sqrt()).ln()+}++fn eeff0(u: f64, er: f64) -> f64 {+ let a = 1.0 + ((u.powi(4) + (u / 52.0).powi(2)) / (u.powi(4) + 0.432)).ln() / 49.0 + (1.0 + (u / 18.1).powi(3)).ln() / 18.7;+ let b = 0.564 * ((er - 0.9) / (er + 3.0)).powf(0.053);+ (er + 1.0) / 2.0 + (er - 1.0) / 2.0 * (1.0 + 10.0 / u).powf(-a * b)+}++/// Uncoated microstrip: width w over a plane h below, copper t thick, dielectric er (any length unit).+pub fn microstrip(w: f64, h: f64, t: f64, er: f64) -> f64 {+ let u = w / h;+ let tn = t / h;+ let coth = |x: f64| x.cosh() / x.sinh();+ let du1 = if tn > 0.0 { tn / PI * (1.0 + 4.0 * std::f64::consts::E / (tn * coth((6.517 * u).sqrt()).powi(2))).ln() } else { 0.0 };+ let dur = 0.5 * (1.0 + 1.0 / (er - 1.0).sqrt().cosh()) * du1;+ let (u1, ur) = (u + du1, u + dur);+ let ee = eeff0(ur, er) * (z01(u1) / z01(ur)).powi(2);+ z01(ur) / ee.sqrt()+}++/// Centred stripline (Wheeler 1978, thickness corrected): width w between planes b apart, copper t.+fn stripline_sym(w: f64, b: f64, t: f64, er: f64) -> f64 {+ let x = t / b;+ let bt = b - t;+ let dw = if x > 0.0 {+ let n = 2.0 / (1.0 + 2.0 * x / (3.0 * (1.0 - x)));+ bt * (x / (PI * (1.0 - x))) * (1.0 - 0.5 * ((x / (2.0 - x)).powi(2) + (0.0796 * x / (w / b + 1.1 * x)).powf(n)).ln())+ } else { 0.0 };+ let m = (w + dw) / bt;+ let k = 8.0 / (PI * m);+ 30.0 / er.sqrt() * (1.0 + 4.0 / (PI * m) * (k + (k * k + 6.27).sqrt())).ln()+}++/// Stripline h1 above and h2 below the track (planes h1 + t + h2 apart): Cohn's combination of the two centred cases.+pub fn stripline(w: f64, h1: f64, h2: f64, t: f64, er: f64) -> f64 {+ let za = stripline_sym(w, 2.0 * h1 + t, t, er);+ let zb = stripline_sym(w, 2.0 * h2 + t, t, er);+ 2.0 * za * zb / (za + zb)+}++/// Edge-coupled differential impedance (IPC-2141): the single-ended z0, gap s, and h (microstrip) or plane spacing b+/// (stripline).+pub fn differential(z0: f64, s: f64, hb: f64, strip: bool) -> f64 {+ if strip { 2.0 * z0 * (1.0 - 0.374 * (-2.9 * s / hb).exp()) } else { 2.0 * z0 * (1.0 - 0.48 * (-0.96 * s / hb).exp()) }+}++/// The width (same unit as the geometry) where `z(w)` meets `target`; z falls as w grows. None when out of range.+fn solve(target: f64, lo: f64, hi: f64, z: impl Fn(f64) -> f64) -> Option<f64> {+ if z(lo) < target || z(hi) > target { return None; }+ let (mut a, mut b) = (lo, hi);+ for _ in 0..80 {+ let m = (a + b) / 2.0;+ if z(m) > target { a = m } else { b = m }+ }+ Some((a + b) / 2.0)+}++/// One copper layer's geometry from the stack (mm): the dielectric to the copper above and below, and their Dk.+#[derive(Debug, Clone)]+pub struct Geo { pub name: String, pub t: f64, pub above: Option<(f64, f64)>, pub below: Option<(f64, f64)> }++/// The stack summary (`layer_stack` data) as each copper layer's geometry.+pub fn geometry(stack: &Value) -> Vec<Geo> {+ let ls: Vec<Value> = stack["layers"].as_array().cloned().unwrap_or_default();+ let um = |v: &Value| v.as_f64().unwrap_or(0.0) / 1000.0;+ let diel = |l: &Value| -> Option<(f64, f64)> {+ let h = um(&l["dielectricUm"]);+ if h <= 0.0 { None } else { Some((h, l["dk1000"].as_f64().map(|d| d / 1000.0).unwrap_or(4.3))) }+ };+ (0..ls.len()).map(|i| Geo {+ name: ls[i]["name"].as_str().unwrap_or("").to_string(),+ t: um(&ls[i]["copperUm"]).max(0.0),+ above: if i > 0 { diel(&ls[i - 1]) } else { None },+ below: diel(&ls[i]),+ }).collect()+}++/// Width (and gap) for each layer, mm. `diff` is the differential target; `gap` fixes the pair gap (else gap = width).+pub fn widths(geo: &[Geo], z0: Option<f64>, diff: Option<f64>, gap: Option<f64>) -> Vec<Value> {+ geo.iter().map(|g| {+ let (strip, z): (bool, Box<dyn Fn(f64) -> f64>) = match (g.above, g.below) {+ (Some((h1, e1)), Some((h2, e2))) => {+ let er = (e1 * h1 + e2 * h2) / (h1 + h2);+ let t = g.t;+ (true, Box::new(move |w| stripline(w, h1, h2, t, er)))+ }+ (None, Some((h, er))) | (Some((h, er)), None) => { let t = g.t; (false, Box::new(move |w| microstrip(w, h, t, er))) }+ (None, None) => return json!({"layer": g.name, "error": "no dielectric next to this layer in the stack"}),+ };+ // the spacing the coupling term uses: h for microstrip, plane to plane for stripline+ let hb = match (g.above, g.below) { (Some((a, _)), Some((b, _))) => a + b, (Some((h, _)), None) | (None, Some((h, _))) => h, _ => 1.0 };+ let mut o = json!({"layer": g.name, "model": if strip { "stripline" } else { "microstrip" }, "copperUm": r1(g.t * 1000.0),+ "dielectricMm": [g.above.map(|a| r3(a.0)), g.below.map(|b| r3(b.0))]});+ if let Some(t) = z0 {+ match solve(t, 0.01, 20.0, &z) { Some(w) => { o["width"] = json!(r3(w)); o["z0"] = json!(r1(z(w))); } None => { o["z0Error"] = json!(format!("{t} ohm is out of reach on this layer (0.01 to 20 mm)")); } }+ }+ if let Some(t) = diff {+ let zd = |w: f64| differential(z(w), gap.unwrap_or(w), hb, strip);+ match solve(t, 0.01, 20.0, zd) {+ Some(w) => { o["diffWidth"] = json!(r3(w)); o["diffGap"] = json!(r3(gap.unwrap_or(w))); o["zdiff"] = json!(r1(zd(w))); o["diffZ0"] = json!(r1(z(w))); }+ None => { o["diffError"] = json!(format!("{t} ohm differential is out of reach on this layer with that gap")); }+ }+ }+ o+ }).collect()+}++/// impedance: input {stack, args: {z0?, diff?, gapMm?, layers?, apply?: {scope, name?}}}. Needs only the stack-up.+/// `apply` answers a plan, never writes: one `add_rule` per layer (a width rule, or a diffpair rule for `diff`) scoped+/// by the caller's `scope` in the tool's own query language, at +/-10%, for the bridge to run.+pub fn impedance(input: &Value) -> Value {+ let args = &input["args"];+ let z0 = args.get("z0").and_then(|v| v.as_f64());+ let diff = args.get("diff").and_then(|v| v.as_f64());+ let z0 = if z0.is_none() && diff.is_none() { Some(50.0) } else { z0 };+ let gap = args.get("gapMm").and_then(|v| v.as_f64());+ let Some(stack) = crate::input::stack(input) else { return crate::input::refuse("no_stack", "the input has no stack: pass the layer_stack companion as stack") };+ if stack.get("ok") == Some(&json!(false)) || stack["layers"].as_array().map(|a| a.is_empty()).unwrap_or(true) {+ return crate::input::refuse("no_stack", "the stack has no layers");+ }+ let mut geo = geometry(&stack);+ // each copper layer's board model name beside the tool's own (F.Cu, In1.Cu, B.Cu)+ let board_names: Vec<String> = crate::coppermap::stack_layers(&stack).into_iter().map(|l| l.0).collect();+ let mut named: Vec<(Geo, String)> = geo.drain(..).zip(board_names).collect();+ if let Some(want) = args.get("layers").and_then(|v| v.as_array()) {+ let names: Vec<String> = want.iter().filter_map(|v| v.as_str()).map(|s| s.to_ascii_lowercase()).collect();+ named.retain(|(g, b)| names.contains(&g.name.to_ascii_lowercase()) || names.contains(&b.to_ascii_lowercase()));+ }+ let geo: Vec<Geo> = named.iter().map(|n| n.0.clone()).collect();+ let mut rows = widths(&geo, z0, diff, gap);+ for (row, (_, b)) in rows.iter_mut().zip(&named) { row["boardLayer"] = json!(b); }+ // a rigid-flex stack (the Bluetooth Sentinel example) has a coverlay a few microns thick next to a copper layer:+ // the numbers are right for that geometry and useless for a rigid board, so say which rows to doubt+ let mut warnings = Vec::new();+ for (g, row) in geo.iter().zip(&rows) {+ for d in [g.above, g.below].iter().flatten() {+ if d.0 < 0.05 { warnings.push(format!("{}: a {} mm dielectric next to it (a flex coverlay or a stack-up typo?): check the stack-up in the tool", g.name, r3(d.0))); break; }+ }+ for k in ["width", "diffWidth", "diffGap"] {+ if let Some(w) = row[k].as_f64() { if w < 0.075 { warnings.push(format!("{}: {k} {w} mm is below what most fabs make (0.075 to 0.1 mm)", g.name)); } }+ }+ }+ let mut plan = Value::Null;+ if let Some(ap) = args.get("apply").filter(|a| !a.is_null()) {+ let Some(scope) = ap.get("scope").and_then(|v| v.as_str()) else { return crate::input::refuse("bad_args", "apply.scope is the tool's query for what the rule covers (Altium: InNetClass('RF'); KiCad: A.NetClass == 'RF')") };+ let base = ap.get("name").and_then(|v| v.as_str()).unwrap_or("Impedance");+ let mut rules = Vec::new();+ for row in &rows {+ let layer = row["layer"].as_str().unwrap_or("");+ let common = json!({"name": format!("{base} {layer}"), "scope": scope, "layer": row["boardLayer"], "toolLayer": layer});+ let mut a = if diff.is_some() {+ let (Some(w), Some(s)) = (row["diffWidth"].as_f64(), row["diffGap"].as_f64()) else { continue };+ json!({"kind": "diffpair", "width": w, "gap": s, "minWidth": r3(w * 0.9), "maxWidth": r3(w * 1.1), "minGap": r3(s * 0.9), "maxGap": r3(s * 1.1)})+ } else {+ let Some(w) = row["width"].as_f64() else { continue };+ json!({"kind": "width", "min": r3(w * 0.9), "preferred": w, "max": r3(w * 1.1)})+ };+ for (k, v) in common.as_object().unwrap() { a[k] = v.clone(); }+ rules.push(a);+ }+ plan = json!({"verb": "add_rule", "rules": rules, "note": "A plan only: nothing changed. Run add_rule once per rule; each is scoped to its layer and to scope."});+ }+ json!({"success": true, "targets": {"z0": z0, "diff": diff, "gapMm": gap}, "layers": rows, "apply": plan, "warnings": warnings,+ "stack": {"copperLayers": stack["copperLayers"], "totalUm": stack["totalUm"]},+ "_hint": "Widths are for uncoated copper: solder mask lowers an outer layer's impedance by about 1 to 3 ohm. Inner layers assume planes on both neighbours. Within a few percent of a field solver; send the fab the target and let its stack-up tune it. apply:{scope} answers one width or diffpair rule per layer at +/-10% for add_rule."})+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn microstrip_matches_the_textbook_50_ohm_line() {+ // FR-4 er 4.4, 1.6 mm, 35 um: a 50 ohm line is about 3.0 mm wide (Pozar, field solvers 2.9 to 3.1)+ let w = solve(50.0, 0.01, 20.0, |w| microstrip(w, 1.6, 0.035, 4.4)).unwrap();+ assert!((2.8..3.2).contains(&w), "{w}");+ }++ #[test]+ fn stripline_matches_the_textbook_case() {+ // centred stripline, planes 1 mm apart, er 4.3, t 17 um: IPC-2141's formula puts 50 ohm near 0.40 mm+ let w = solve(50.0, 0.01, 20.0, |w| stripline(w, 0.4915, 0.4915, 0.017, 4.3)).unwrap();+ assert!((0.38..0.48).contains(&w), "{w}");+ // off centre, the nearer plane pulls the impedance down+ assert!(stripline(0.3, 0.2, 0.8, 0.017, 4.3) < stripline(0.3, 0.5, 0.5, 0.017, 4.3));+ }++ #[test]+ fn geometry_and_widths_from_a_two_layer_stack() {+ let st = json!({"layers": [{"name": "Top Layer", "copperUm": 36, "dielectricUm": 320, "dk1000": 4800}, {"name": "Bottom Layer", "copperUm": 36}]});+ let g = geometry(&st);+ assert_eq!(g.len(), 2);+ assert!(g[1].above.is_some() && g[1].below.is_none());+ let rows = widths(&g, Some(50.0), Some(90.0), None);+ let w = rows[0]["width"].as_f64().unwrap();+ assert!((0.45..0.65).contains(&w), "{w}");+ assert_eq!(rows[0]["model"], "microstrip");+ // gap = width: a 90 ohm pair's tracks come out near the 50 ohm width+ assert!((rows[0]["diffWidth"].as_f64().unwrap() - w).abs() < 0.1);+ assert!(widths(&g, None, Some(90.0), Some(0.2))[0]["diffWidth"].as_f64().unwrap() < rows[0]["diffWidth"].as_f64().unwrap());+ assert!((rows[0]["zdiff"].as_f64().unwrap() - 90.0).abs() < 0.5);+ }++ #[test]+ fn apply_is_a_plan_of_add_rule_args_on_standard_layers() {+ let input = json!({"stack": {"copperLayers": 2, "layers": [{"name": "Top Layer", "copperUm": 36, "dielectricUm": 320, "dk1000": 4800}, {"name": "Bottom Layer", "copperUm": 36}]},+ "args": {"z0": 50, "apply": {"scope": "InNetClass('RF')"}}});+ let r = impedance(&input);+ assert_eq!(r["layers"][0]["boardLayer"], "F.Cu");+ assert_eq!(r["apply"]["verb"], "add_rule");+ let rule = &r["apply"]["rules"][1];+ assert_eq!((rule["kind"].as_str(), rule["layer"].as_str(), rule["toolLayer"].as_str()), (Some("width"), Some("B.Cu"), Some("Bottom Layer")));+ assert_eq!(rule["scope"], "InNetClass('RF')");+ // a filter by either name+ let only = impedance(&json!({"stack": input["stack"], "args": {"layers": ["B.Cu"]}}));+ assert_eq!(only["layers"].as_array().unwrap().len(), 1);+ assert_eq!(impedance(&json!({"args": {}}))["errorCode"], "no_stack");+ assert_eq!(impedance(&json!({"stack": input["stack"], "args": {"apply": {}}}))["errorCode"], "bad_args");+ }+}+
bridge-rs/vendor/adom-eda-checks/src/input.rsadded+55@@ -0,0 +1,55 @@+//! The input bundle every check takes: `{board, stack?, pours?, rules?, silk?, fab?, bodies?, sheetParts?, netlist?, args?}`, each the+//! standard model a bridge answers (schema/board.schema.json, schema/companions.schema.json). A bridge's whole reply+//! is accepted too: the model's keys at the top level, or under `data` (the reply envelope keys are ignored).+use serde_json::{json, Value};++/// A refusal in the standard reply envelope.+pub fn refuse(code: &str, error: &str) -> Value {+ json!({"success": false, "errorCode": code, "error": error})+}++/// The companion under `key`, unwrapped from a reply's `data` when it came as one.+pub fn part(input: &Value, key: &str) -> Option<Value> {+ let v = input.get(key)?;+ if v.is_null() { return None; }+ Some(if v.get("data").map(|d| d.is_object()).unwrap_or(false) { v["data"].clone() } else { v.clone() })+}++/// The board model, or `bad_args` when there is none or the bridge's reply was a refusal.+pub fn board(input: &Value) -> Result<Value, Value> {+ let Some(b) = part(input, "board") else { return Err(refuse("bad_args", "the input has no board: pass the board model (routing_state) as board")) };+ if b.get("success") == Some(&json!(false)) { return Err(b); }+ Ok(b)+}++/// The stack-up companion (layer_stack), if given.+pub fn stack(input: &Value) -> Option<Value> { part(input, "stack") }++/// The poured copper (pour_state's `zones`), empty when not given.+pub fn pours(input: &Value) -> Vec<Value> {+ let Some(p) = part(input, "pours") else { return Vec::new() };+ p.get("zones").or(Some(&p)).and_then(|z| z.as_array()).cloned().unwrap_or_default()+}++/// The board's rules (read_rules): a list, or a reply with `rules`.+pub fn rules(input: &Value) -> Vec<Value> {+ let Some(r) = part(input, "rules") else { return Vec::new() };+ r.get("rules").or(Some(&r)).and_then(|x| x.as_array()).cloned().unwrap_or_default()+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn companions_come_bare_or_in_a_reply() {+ let bare = json!({"board": {"outline": []}, "stack": {"layers": [{"name": "Top"}]}, "pours": {"zones": [{"net": "GND"}]}});+ let wrapped = json!({"board": {"success": true, "outline": []}, "stack": {"success": true, "data": {"layers": [{"name": "Top"}]}}, "pours": [{"net": "GND"}]});+ for i in [bare, wrapped] {+ assert!(board(&i).is_ok());+ assert_eq!(stack(&i).unwrap()["layers"][0]["name"], "Top");+ assert_eq!(pours(&i)[0]["net"], "GND");+ }+ assert_eq!(board(&json!({})).unwrap_err()["errorCode"], "bad_args");+ }+}
bridge-rs/vendor/adom-eda-checks/src/lib.rsadded+29@@ -0,0 +1,29 @@+//! adom-eda-checks: the EDA Bridge Standard's checks tier, computed from the board model and its companions as plain+//! JSON. No bridge calls, no tool, no I/O: a bridge links this crate (or runs the `adom-eda-checks` command) and+//! answers the check under its own prefix (`kicad_return_path`). Replies keep the standard envelope (`success`,+//! `errorCode`, `error`, `_hint`) and name verbs without a prefix.+//!+//! Every check takes one input bundle, `{board, stack?, pours?, rules?, silk?, fab?, bodies?, sheetParts?, netlist?, args?}` (see `input`).+use serde_json::Value;++pub mod coppermap;+pub mod current;+pub mod fab;+pub mod geom;+pub mod impedance;+pub mod input;++/// The checks this build answers, by standard verb name.+pub const CHECKS: &[&str] = &["copper_balance", "current_capacity", "fab_check", "impedance", "return_path"];++/// Run one check by its standard name.+pub fn run(check: &str, input: &Value) -> Value {+ match check {+ "copper_balance" => coppermap::copper_balance(input),+ "current_capacity" => current::current_capacity(input),+ "fab_check" => fab::fab_check(input),+ "impedance" => impedance::impedance(input),+ "return_path" => coppermap::return_path(input),+ _ => input::refuse("not_supported", &format!("{check} is not a check this engine answers (it answers {})", CHECKS.join(", "))),+ }+}
bridge-rs/vendor/adom-eda-checks/src/main.rsadded+48@@ -0,0 +1,48 @@+//! adom-eda-checks <check> [bundle.json | -]+//! adom-eda-checks <check> --board b.json [--stack s.json] [--pours p.json] [--args '{...}']+//! Prints the check's reply as JSON. `adom-eda-checks list` names the checks.+use serde_json::{json, Value};+use std::io::Read;++fn read(path: &str) -> Result<Value, String> {+ let text = if path == "-" {+ let mut s = String::new();+ std::io::stdin().read_to_string(&mut s).map_err(|e| format!("stdin: {e}"))?;+ s+ } else {+ std::fs::read_to_string(path).map_err(|e| format!("{path}: {e}"))?+ };+ serde_json::from_str(&text).map_err(|e| format!("{path}: {e}"))+}++fn bundle(rest: &[String]) -> Result<Value, String> {+ if rest.len() == 1 { return read(&rest[0]); }+ let mut b = json!({});+ let mut it = rest.iter();+ while let Some(flag) = it.next() {+ let val = it.next().ok_or_else(|| format!("{flag} needs a value"))?;+ match flag.as_str() {+ "--board" | "--stack" | "--pours" | "--rules" | "--silk" | "--fab" | "--bodies" | "--sheet-parts" | "--netlist" => {+ let key = match flag.as_str() { "--sheet-parts" => "sheetParts", f => &f[2..] };+ b[key] = read(val)?;+ }+ "--args" => b["args"] = serde_json::from_str(val).map_err(|e| format!("--args: {e}"))?,+ _ => return Err(format!("unknown flag {flag}")),+ }+ }+ Ok(b)+}++fn main() {+ let argv: Vec<String> = std::env::args().skip(1).collect();+ let out = match argv.first().map(String::as_str) {+ None | Some("-h") | Some("--help") => json!({"success": true, "usage": "adom-eda-checks <check> [bundle.json | -] | <check> --board b.json [--stack s.json] [--pours p.json] [--args '{...}']", "checks": adom_eda_checks::CHECKS}),+ Some("list") => json!({"success": true, "checks": adom_eda_checks::CHECKS}),+ Some(check) => match bundle(&argv[1..]) {+ Ok(b) => adom_eda_checks::run(check, &b),+ Err(e) => json!({"success": false, "errorCode": "bad_args", "error": e, "_hint": "Pass one bundle file {board, stack, pours, args}, or --board, --stack, --pours and --args."}),+ },+ };+ println!("{}", serde_json::to_string_pretty(&out).unwrap());+ if out.get("success") == Some(&json!(false)) { std::process::exit(1); }+}
bridge-rs/vendor/adom-eda-checks/tests/fixtures.rsadded+56@@ -0,0 +1,56 @@+//! The engine against a bridge's own answers on the same boards. Fixtures are not kept with the standard: each bridge's+//! page carries its own (Altium's: lane and the Bluetooth Sentinel, from altium-lane, bridge 0.2.76). Point+//! ADOM_EDA_FIXTURES at a folder holding `altium/<board>.<model>.json` and `altium/expected/<board>.<check>.json`;+//! without it these tests are skipped. The result keys must match exactly; hints and notes may differ, since the engine+//! names verbs without a prefix.+use serde_json::{json, Value};+use std::path::PathBuf;++fn dir() -> Option<PathBuf> {+ let d = PathBuf::from(std::env::var_os("ADOM_EDA_FIXTURES")?).join("altium");+ d.is_dir().then_some(d)+}++fn load(p: PathBuf) -> Option<Value> { Some(serde_json::from_str(&std::fs::read_to_string(p).ok()?).unwrap()) }++fn bundle(d: &PathBuf, board: &str) -> Option<Value> {+ Some(json!({"board": load(d.join(format!("{board}.routing_state.json")))?, "stack": load(d.join(format!("{board}.layer_stack.json")))?,+ "pours": load(d.join(format!("{board}.pour_state.json")))?, "rules": load(d.join(format!("{board}.read_rules.json"))),+ "silk": load(d.join(format!("{board}.silk_state.json"))), "args": {}}))+}++fn same(check: &str, keys: &[&str]) {+ let Some(d) = dir() else { eprintln!("skipped: set ADOM_EDA_FIXTURES to a fixtures folder to compare {check} with a bridge"); return };+ let mut ran = 0;+ for board in ["lane", "sentinel"] {+ let (Some(input), Some(want)) = (bundle(&d, board), load(d.join(format!("expected/{board}.{check}.json")))) else { continue };+ let got = adom_eda_checks::run(check, &input);+ assert_eq!(got["success"], json!(true), "{board} {check}: {got}");+ for k in keys {+ let ptr = format!("/{}", k.replace('.', "/"));+ let optional = k.starts_with("measured.") || (k.starts_with("fix.") && want["fix"].is_null());+ assert!(want.pointer(&ptr).is_some() || optional, "{board} {check}: the Altium reply has no {k}");+ assert_eq!(got.pointer(&ptr), want.pointer(&ptr), "{board} {check}: {k} differs from the Altium bridge");+ }+ ran += 1;+ }+ assert!(ran > 0, "no fixtures for {check} in {}", d.display());+}++#[test]+fn copper_balance_matches_altium() {+ same("copper_balance", &["boardMm2", "resolutionMm", "layers", "pairs", "balanced", "poursWithoutRegions"]);+}++#[test]+fn return_path_matches_altium() {+ same("return_path", &["referenceNets", "layersWithNoReferenceCopper", "nets", "ok", "resolutionMm",+ "fix.args", "fix.patches", "fix.closes", "fix.floating"]);+}++#[test]+fn fab_check_measures_what_altium_measures() {+ same("fab_check", &["measured.boardSize", "measured.clearanceRule", "measured.copperLayers", "measured.counts", "measured.edgeClearance", "measured.holeToHolePad",+ "measured.holeToHoleVia", "measured.largestDrill", "measured.padHole", "measured.smdPad", "measured.track",+ "measured.viaAnnularRing", "measured.viaDiameter", "measured.viaDrill", "outsideLimits", "limitsChecked"]);+}
bridge-rs/vendor/pcb-design-rules/records/adom-3rdpartyfab.jsonadded+257@@ -0,0 +1,257 @@+{+ "vendor": "3rd party fab",+ "vendorSlug": "adom-3rdpartyfab",+ "vendorUrl": null,+ "records": [+ {+ "process": "standard",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "1 oz copper"+ },+ "minSpacing": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "1 oz copper, different nets"+ },+ "minDrill": {+ "mm": 0.15,+ "mil": 5.91+ },+ "minVia": {+ "drillMm": 0.15,+ "drillMil": 5.91,+ "padMm": 0.25,+ "padMil": 9.84+ },+ "annularRing": {+ "viaMm": 0.1,+ "viaMil": 3.94,+ "padMm": 0.18,+ "padMil": 7.09,+ "note": "0.25 mm or above preferred"+ },+ "copperToBoardEdge": {+ "mm": 0.2,+ "mil": 7.87+ },+ "holeToHole": {+ "mm": 0.2,+ "mil": 7.87+ },+ "maskExpansion": {+ "mm": 0.038,+ "mil": 1.5+ },+ "maskSliver": null,+ "silkLineWidth": null,+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "different nets"+ },+ "boardThicknessOptionsMm": [+ 1.6+ ],+ "copperWeightOptionsOz": [+ 1,+ 2+ ],+ "surfaceFinishes": [],+ "maxBoardSize": null,+ "drillRange": {+ "minMm": 0.15,+ "maxMm": 6.3,+ "note": "holes with diameter >= 6.3 mm are CNC routed from a smaller drilled hole; min non-plated hole 0.50 mm"+ },+ "notes": "Baseline of the 3rd party fab service. Preferred values in the seed file: default class preferred track 0.2 mm, power class preferred 0.3 mm; preferred via hole 0.2 mm (0.25 mm in the shipped file). Min via allowed on 2-layer. Finished surface copper: 1 oz standard; 2 oz on request (John Lauer, 2026-10-12). Existing weight-conditioned DRC limits remain for 1 oz; confirm 2 oz DFM before use. Hole-barrel plating and thickness tolerances are not specified by this confirmation.",+ "sources": [+ {+ "url": "adom/fusion-bridge addin/AdomBridge/resources/dru/Adom-3rdPartyFab-2-Layer.edru",+ "dateRead": "2026-09-03",+ "kind": "bundled-rule-file"+ },+ {+ "url": "https://wiki.adom.inc/adom/pcb-design-rules/files/docs/3rdpartyfab-finished-copper.md",+ "dateRead": "2026-10-12",+ "kind": "user-confirmed-capability"+ }+ ],+ "finishedCopper": {+ "standardOz": 1,+ "onRequestOz": [+ 2+ ],+ "approximateThicknessMm": {+ "1": 0.035,+ "2": 0.07+ },+ "appliesTo": "Finished surface copper; not an inner-layer stackup or barrel-plating specification",+ "thicknessToleranceMm": null,+ "minimumBarrelPlatingMm": null,+ "confirmedBy": "John Lauer",+ "confirmedOn": "2026-10-12"+ },+ "silkscreenPolicy": {+ "schemaVersion": 1,+ "kind": "user-requested-authoring-policy",+ "source": {+ "date": "2026-10-15",+ "description": "User requested 0.8 mm component names, 0.3 mm values, screw sizes, bracket edges and screw clearances on appropriate faces"+ },+ "referenceHeightMm": 0.8,+ "valueHeightMm": 0.3,+ "referenceRequired": true,+ "valueRequired": true,+ "referenceMeaning": "reference designator, e.g. Q1, R12, J9",+ "preserveElectricalValue": true,+ "groupReferenceAndValue": true,+ "allowSilentOmissionOrShrinking": false,+ "mechanical": {+ "screwSizeRequired": true,+ "screwLengthWhenSpecified": true,+ "bracketOutlineOnMountingFace": true,+ "headWasherClearanceOnBearingFace": true,+ "toolAccessOutlineOnAccessFace": true,+ "avoidHolesMaskOpeningsAndFittedBodies": true+ },+ "validation": [+ "native text dimensions",+ "whole-board reference/value inventory",+ "both-face mask, body, hole, outline and text collision review",+ "assembled visibility and association",+ "silkscreen GLB export with drill markers disabled"+ ],+ "manufacturingLimitStatus": "Authoring requirement only; does not establish minimum printable stroke, spacing or legibility. Existing unknown silkLineWidth/silkToCopper remain null."+ }+ },+ {+ "process": "standard",+ "layerCount": 4,+ "minTraceWidth": {+ "mm": 0.09,+ "mil": 3.54,+ "condition": "1 oz copper, multilayer"+ },+ "minSpacing": {+ "mm": 0.09,+ "mil": 3.54,+ "condition": "1 oz copper, multilayer, different nets; 3 mil acceptable in BGA fan-outs"+ },+ "minDrill": {+ "mm": 0.15,+ "mil": 5.91+ },+ "minVia": {+ "drillMm": 0.15,+ "drillMil": 5.91,+ "padMm": 0.25,+ "padMil": 9.84+ },+ "annularRing": {+ "viaMm": 0.1,+ "viaMil": 3.94,+ "padMm": 0.18,+ "padMil": 7.09,+ "note": "0.25 mm or above preferred"+ },+ "copperToBoardEdge": {+ "mm": 0.2,+ "mil": 7.87+ },+ "holeToHole": {+ "mm": 0.2,+ "mil": 7.87+ },+ "maskExpansion": {+ "mm": 0.038,+ "mil": 1.5+ },+ "maskSliver": null,+ "silkLineWidth": null,+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.09,+ "mil": 3.54,+ "condition": "different nets"+ },+ "boardThicknessOptionsMm": [+ 1.6+ ],+ "copperWeightOptionsOz": [+ 1,+ 2+ ],+ "surfaceFinishes": [],+ "maxBoardSize": null,+ "drillRange": {+ "minMm": 0.15,+ "maxMm": 6.3,+ "note": "holes with diameter >= 6.3 mm are CNC routed from a smaller drilled hole; min non-plated hole 0.50 mm"+ },+ "notes": "BGA pad diameter >= 0.25 mm. BGA pad to trace clearance min 0.09 mm. Vias can be placed within BGA pads using filled and plated-over vias. Finished surface copper: 1 oz standard; 2 oz on request (John Lauer, 2026-10-12). Existing weight-conditioned DRC limits remain for 1 oz; confirm 2 oz DFM before use. Hole-barrel plating and thickness tolerances are not specified by this confirmation.",+ "sources": [+ {+ "url": "adom/fusion-bridge addin/AdomBridge/resources/dru/Adom-3rdPartyFab-4-Layer.edru",+ "dateRead": "2026-09-03",+ "kind": "bundled-rule-file"+ },+ {+ "url": "https://wiki.adom.inc/adom/pcb-design-rules/files/docs/3rdpartyfab-finished-copper.md",+ "dateRead": "2026-10-12",+ "kind": "user-confirmed-capability"+ }+ ],+ "finishedCopper": {+ "standardOz": 1,+ "onRequestOz": [+ 2+ ],+ "approximateThicknessMm": {+ "1": 0.035,+ "2": 0.07+ },+ "appliesTo": "Finished surface copper; not an inner-layer stackup or barrel-plating specification",+ "thicknessToleranceMm": null,+ "minimumBarrelPlatingMm": null,+ "confirmedBy": "John Lauer",+ "confirmedOn": "2026-10-12"+ },+ "silkscreenPolicy": {+ "schemaVersion": 1,+ "kind": "user-requested-authoring-policy",+ "source": {+ "date": "2026-10-15",+ "description": "User requested 0.8 mm component names, 0.3 mm values, screw sizes, bracket edges and screw clearances on appropriate faces"+ },+ "referenceHeightMm": 0.8,+ "valueHeightMm": 0.3,+ "referenceRequired": true,+ "valueRequired": true,+ "referenceMeaning": "reference designator, e.g. Q1, R12, J9",+ "preserveElectricalValue": true,+ "groupReferenceAndValue": true,+ "allowSilentOmissionOrShrinking": false,+ "mechanical": {+ "screwSizeRequired": true,+ "screwLengthWhenSpecified": true,+ "bracketOutlineOnMountingFace": true,+ "headWasherClearanceOnBearingFace": true,+ "toolAccessOutlineOnAccessFace": true,+ "avoidHolesMaskOpeningsAndFittedBodies": true+ },+ "validation": [+ "native text dimensions",+ "whole-board reference/value inventory",+ "both-face mask, body, hole, outline and text collision review",+ "assembled visibility and association",+ "silkscreen GLB export with drill markers disabled"+ ],+ "manufacturingLimitStatus": "Authoring requirement only; does not establish minimum printable stroke, spacing or legibility. Existing unknown silkLineWidth/silkToCopper remain null."+ }+ }+ ]+}
bridge-rs/vendor/pcb-design-rules/records/advanced-circuits-4pcb.jsonadded+528@@ -0,0 +1,528 @@+{+ "vendor": "Advanced Circuits (4PCB)",+ "vendorSlug": "advanced-circuits-4pcb",+ "vendorUrl": null,+ "records": [+ {+ "process": "standard",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "outer trace, standard spec"+ },+ "minSpacing": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "standard spec trace/space 5/5 mils"+ },+ "minDrill": {+ "mm": 0.254,+ "mil": 10.0+ },+ "minVia": {+ "drillMm": 0.254,+ "drillMil": 10.0,+ "padMm": null,+ "padMil": null+ },+ "annularRing": null,+ "copperToBoardEdge": null,+ "holeToHole": null,+ "maskExpansion": null,+ "maskSliver": null,+ "silkLineWidth": null,+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "different nets"+ },+ "boardThicknessOptionsMm": [+ 0.7874,+ 1.5748,+ 2.3622,+ 3.175+ ],+ "copperWeightOptionsOz": [+ 1,+ 2+ ],+ "surfaceFinishes": [+ "Lead-Free HAL"+ ],+ "maxBoardSize": {+ "xMm": 406.4,+ "yMm": 558.8+ },+ "notes": "Standard spec: FR-4, 0 to 12 layers, IPC Class 2, quantity 1 to 10000 plus, turn time same day to 5 day. Hole tolerance plus or minus 0.005 in (0.127 mm). Rout tolerance plus or minus 0.010 in (0.254 mm). Solder mask LPI green, legend white. Board thickness options 0.031, 0.062, 0.093, 0.125 in. Standard finish pricing assumes lead-free HAL; ENIG or immersion silver at no extra cost if HAL unavailable. Same spec applies to 2 and 4 layer; page does not differentiate by layer count below 12.",+ "sources": [+ {+ "url": "https://www.4pcb.com/laminate-material-vendors.html",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "standard (Standard Technology PCBs)"+ },+ {+ "process": "standard",+ "layerCount": 4,+ "minTraceWidth": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "outer trace, standard spec"+ },+ "minSpacing": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "standard spec trace/space 5/5 mils"+ },+ "minDrill": {+ "mm": 0.254,+ "mil": 10.0+ },+ "minVia": {+ "drillMm": 0.254,+ "drillMil": 10.0,+ "padMm": null,+ "padMil": null+ },+ "annularRing": null,+ "copperToBoardEdge": null,+ "holeToHole": null,+ "maskExpansion": null,+ "maskSliver": null,+ "silkLineWidth": null,+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "different nets"+ },+ "boardThicknessOptionsMm": [+ 0.7874,+ 1.5748,+ 2.3622,+ 3.175+ ],+ "copperWeightOptionsOz": [+ 1,+ 2+ ],+ "surfaceFinishes": [+ "Lead-Free HAL"+ ],+ "maxBoardSize": {+ "xMm": 406.4,+ "yMm": 558.8+ },+ "notes": "Same standard spec as 2 layer. Typical 4-layer stackup published at 0.020, 0.031, 0.062, 0.093, 0.125 in finished thickness with 1 oz copper, max board size 16 x 22 in for 0.031 to 0.093 in, 14 x 20 in (355.6 x 508 mm) at 0.125 in.",+ "sources": [+ {+ "url": "https://www.4pcb.com/laminate-material-vendors.html",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "standard (Standard Technology PCBs)"+ },+ {+ "process": "advanced-standard",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.1397,+ "mil": 5.5,+ "condition": "outer layer, 1 oz Cu base; other weights: 0.0762 mm (3 mil) at 1/4 and 3/8 oz base, 0.1143 mm (4.5 mil) at 1/2 oz base, 0.1778 mm (7 mil) at 2 oz, 0.2286 mm (9 mil) at 3 oz; inner layer 1 oz: 0.1143 mm (4.5 mil)"+ },+ "minSpacing": {+ "mm": 0.1397,+ "mil": 5.5,+ "condition": "outer layer trace to trace, 1 oz Cu base; 0.0762 mm (3 mil) at 1/4, 3/8, 1/2 oz base, 0.1778 mm (7 mil) at 2 oz, 0.2286 mm (9 mil) at 3 oz; inner layer 1 oz: 0.1143 mm (4.5 mil)"+ },+ "minDrill": {+ "mm": 0.1499,+ "mil": 5.9,+ "condition": "smallest mechanical PTH via, aspect ratio driven; smallest component PTH 0.381 mm (15 mil)"+ },+ "minVia": {+ "drillMm": 0.1499,+ "drillMil": 5.9,+ "padMm": 0.5309,+ "padMil": 20.9+ },+ "annularRing": {+ "viaMm": 0.1905,+ "viaMil": 7.5,+ "note": "derived from published no-breakout rule: pad = drill + 0.015 in, annular ring = 0.0075 in"+ },+ "copperToBoardEdge": {+ "mm": 0.254,+ "mil": 10.0+ },+ "holeToHole": {+ "mm": 0.3048,+ "mil": 12.0,+ "condition": "minimum hole to hole edge for PTH"+ },+ "maskExpansion": {+ "mm": 0.0762,+ "mil": 3.0,+ "condition": "solder mask clearance to pad, i.e. annular ring"+ },+ "maskSliver": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "solder mask web width over laminate between pads; 0.0762 mm (3 mil) over copper"+ },+ "silkLineWidth": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "minimum, white only, height 15 to 20 mil; standard silkscreen 5 mil width, 25 to 30 mil height"+ },+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.1397,+ "mil": 5.5,+ "condition": "different nets, outer layer 1 oz Cu base"+ },+ "boardThicknessOptionsMm": [],+ "copperWeightOptionsOz": [+ 0.25,+ 0.375,+ 0.5,+ 1,+ 2,+ 3,+ 4+ ],+ "surfaceFinishes": [],+ "maxBoardSize": {+ "xMm": 406.4,+ "yMm": 558.8+ },+ "notes": "Capabilities table is per facility and per tier; this object is Santa Clara, CA, Standard column. Min board thickness 0.01 in (0.254 mm), max board thickness 0.25 in (6.35 mm). PTH tolerance plus or minus 0.003 in (0.0762 mm). Drill to copper for PTH 0.01 in (0.254 mm). Minimum pad 0.015 in (0.381 mm), minimum isolated pad 0.01 in (0.254 mm). Min copper sliver between antipads 0.005 in (0.127 mm). Aspect ratio plated through holes 10:1 for drilled greater than 0.020 in, 10:1 for 0.010 to 0.019 in. Other facilities differ, e.g. Maple Grove MN standard outer 1 oz trace width is 0.1016 mm (4 mil), smallest mech via 0.0043 in (0.1092 mm).",+ "sources": [+ {+ "url": "https://www.4pcb.com/pcb-capabilities.html",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "advanced capabilities, Santa Clara CA facility, Standard tier"+ },+ {+ "process": "advanced-standard",+ "layerCount": 4,+ "minTraceWidth": {+ "mm": 0.1397,+ "mil": 5.5,+ "condition": "outer layer, 1 oz Cu base; inner layer 1 oz: 0.1143 mm (4.5 mil); inner 1/2 oz: 0.0889 mm (3.5 mil)"+ },+ "minSpacing": {+ "mm": 0.1397,+ "mil": 5.5,+ "condition": "outer layer trace to trace, 1 oz Cu base; inner layer 1 oz: 0.1143 mm (4.5 mil)"+ },+ "minDrill": {+ "mm": 0.1499,+ "mil": 5.9,+ "condition": "smallest mechanical PTH via, aspect ratio driven; smallest component PTH 0.381 mm (15 mil)"+ },+ "minVia": {+ "drillMm": 0.1499,+ "drillMil": 5.9,+ "padMm": 0.5309,+ "padMil": 20.9+ },+ "annularRing": {+ "viaMm": 0.1905,+ "viaMil": 7.5,+ "note": "derived from published no-breakout rule: pad = drill + 0.015 in, annular ring = 0.0075 in"+ },+ "copperToBoardEdge": {+ "mm": 0.254,+ "mil": 10.0+ },+ "holeToHole": {+ "mm": 0.3048,+ "mil": 12.0,+ "condition": "minimum hole to hole edge for PTH"+ },+ "maskExpansion": {+ "mm": 0.0762,+ "mil": 3.0,+ "condition": "solder mask clearance to pad, i.e. annular ring"+ },+ "maskSliver": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "solder mask web width over laminate between pads; 0.0762 mm (3 mil) over copper"+ },+ "silkLineWidth": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "minimum, white only, height 15 to 20 mil; standard silkscreen 5 mil width, 25 to 30 mil height"+ },+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.1397,+ "mil": 5.5,+ "condition": "different nets, outer layer 1 oz Cu base"+ },+ "boardThicknessOptionsMm": [],+ "copperWeightOptionsOz": [+ 0.25,+ 0.375,+ 0.5,+ 1,+ 2,+ 3,+ 4+ ],+ "surfaceFinishes": [],+ "maxBoardSize": {+ "xMm": 406.4,+ "yMm": 558.8+ },+ "notes": "Same capabilities table values as 2 layer; buried vias mechanical drill minimum 0.0059 in (0.1499 mm), blind vias mechanical 0.0059 in, laser drilled blind via minimum 0.004 in (0.1016 mm).",+ "sources": [+ {+ "url": "https://www.4pcb.com/pcb-capabilities.html",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "advanced capabilities, Santa Clara CA facility, Standard tier"+ },+ {+ "process": "advanced",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "outer layer, 1 oz Cu base; 0.0508 mm (2 mil) at 1/4 and 3/8 oz base, 0.0762 mm (3 mil) at 1/2 oz, 0.1397 mm (5.5 mil) at 2 oz, 0.1905 mm (7.5 mil) at 3 oz; inner 1 oz: 0.0889 mm (3.5 mil)"+ },+ "minSpacing": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "outer layer trace to trace, 1 oz Cu base; 0.0508 mm (2 mil) at 1/4 and 3/8 oz, 0.0635 mm (2.5 mil) at 1/2 oz, 0.1397 mm (5.5 mil) at 2 oz, 0.1905 mm (7.5 mil) at 3 oz"+ },+ "minDrill": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "smallest mechanical PTH via, aspect ratio driven"+ },+ "minVia": {+ "drillMm": 0.127,+ "drillMil": 5.0,+ "padMm": 0.508,+ "padMil": 20.0+ },+ "annularRing": {+ "viaMm": 0.1905,+ "viaMil": 7.5,+ "note": "derived from published no-breakout rule: pad = drill + 0.015 in, annular ring = 0.0075 in"+ },+ "copperToBoardEdge": {+ "mm": 0.2032,+ "mil": 8.0+ },+ "holeToHole": {+ "mm": 0.254,+ "mil": 10.0,+ "condition": "minimum hole to hole edge for PTH"+ },+ "maskExpansion": {+ "mm": 0.0508,+ "mil": 2.0,+ "condition": "solder mask clearance to pad, i.e. annular ring"+ },+ "maskSliver": {+ "mm": 0.0762,+ "mil": 3.0,+ "condition": "solder mask web width over laminate between pads; 0.0508 mm (2 mil) over copper"+ },+ "silkLineWidth": {+ "mm": 0.0762,+ "mil": 3.0,+ "condition": "minimum, white only, height 15 to 20 mil"+ },+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "different nets, outer layer 1 oz Cu base"+ },+ "boardThicknessOptionsMm": [],+ "copperWeightOptionsOz": [+ 0.25,+ 0.375,+ 0.5,+ 1,+ 2,+ 3,+ 4+ ],+ "surfaceFinishes": [],+ "maxBoardSize": {+ "xMm": 482.6,+ "yMm": 558.8+ },+ "notes": "Santa Clara CA, Advanced tier. Max board size 19 x 22 in. Min board thickness 0.008 in (0.2032 mm). PTH tolerance plus or minus 0.002 in (0.0508 mm). Minimum pad 0.01 in (0.254 mm). Min outer layer trace for filled and plated over vias 0.004 in (0.1016 mm). Aspect ratio PTH 12:1.",+ "sources": [+ {+ "url": "https://www.4pcb.com/pcb-capabilities.html",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "advanced capabilities, Santa Clara CA facility, Advanced tier"+ },+ {+ "process": "advanced",+ "layerCount": 4,+ "minTraceWidth": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "outer layer, 1 oz Cu base; inner 1 oz: 0.0889 mm (3.5 mil)"+ },+ "minSpacing": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "outer layer trace to trace, 1 oz Cu base; inner 1 oz: 0.1016 mm (4 mil)"+ },+ "minDrill": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "smallest mechanical PTH via, aspect ratio driven"+ },+ "minVia": {+ "drillMm": 0.127,+ "drillMil": 5.0,+ "padMm": 0.508,+ "padMil": 20.0+ },+ "annularRing": {+ "viaMm": 0.1905,+ "viaMil": 7.5,+ "note": "derived from published no-breakout rule: pad = drill + 0.015 in, annular ring = 0.0075 in"+ },+ "copperToBoardEdge": {+ "mm": 0.2032,+ "mil": 8.0+ },+ "holeToHole": {+ "mm": 0.254,+ "mil": 10.0,+ "condition": "minimum hole to hole edge for PTH"+ },+ "maskExpansion": {+ "mm": 0.0508,+ "mil": 2.0,+ "condition": "solder mask clearance to pad, i.e. annular ring"+ },+ "maskSliver": {+ "mm": 0.0762,+ "mil": 3.0,+ "condition": "solder mask web width over laminate between pads; 0.0508 mm (2 mil) over copper"+ },+ "silkLineWidth": {+ "mm": 0.0762,+ "mil": 3.0,+ "condition": "minimum, white only, height 15 to 20 mil"+ },+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "different nets, outer layer 1 oz Cu base"+ },+ "boardThicknessOptionsMm": [],+ "copperWeightOptionsOz": [+ 0.25,+ 0.375,+ 0.5,+ 1,+ 2,+ 3,+ 4+ ],+ "surfaceFinishes": [],+ "maxBoardSize": {+ "xMm": 482.6,+ "yMm": 558.8+ },+ "notes": "Same Advanced tier values as 2 layer for this facility.",+ "sources": [+ {+ "url": "https://www.4pcb.com/pcb-capabilities.html",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "advanced capabilities, Santa Clara CA facility, Advanced tier"+ },+ {+ "process": "development-npi",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.0762,+ "mil": 3.0,+ "condition": "outer layer, 1 oz Cu base; 0.0381 mm (1.5 mil) at 1/4 and 3/8 oz base, 0.0559 mm (2.2 mil) at 1/2 oz, 0.1016 mm (4 mil) at 2 oz, 0.1524 mm (6 mil) at 3 oz; inner 1 oz: 0.0762 mm (3 mil)"+ },+ "minSpacing": {+ "mm": 0.0762,+ "mil": 3.0,+ "condition": "outer layer trace to trace, 1 oz Cu base; 0.0381 mm (1.5 mil) at 1/4 and 3/8 oz, 0.0559 mm (2.2 mil) at 1/2 oz, 0.127 mm (5 mil) at 2 oz, 0.1524 mm (6 mil) at 3 oz"+ },+ "minDrill": null,+ "minVia": null,+ "annularRing": {+ "viaMm": 0.1905,+ "viaMil": 7.5,+ "note": "derived from published no-breakout rule: pad = drill + 0.015 in, annular ring = 0.0075 in"+ },+ "copperToBoardEdge": {+ "mm": 0.127,+ "mil": 5.0+ },+ "holeToHole": {+ "mm": 0.2032,+ "mil": 8.0,+ "condition": "minimum hole to hole edge for PTH"+ },+ "maskExpansion": {+ "mm": 0.0254,+ "mil": 1.0,+ "condition": "solder mask clearance to pad, i.e. annular ring"+ },+ "maskSliver": {+ "mm": 0.0508,+ "mil": 2.0,+ "condition": "solder mask web width over laminate between pads and over copper"+ },+ "silkLineWidth": null,+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.0762,+ "mil": 3.0,+ "condition": "different nets, outer layer 1 oz Cu base"+ },+ "boardThicknessOptionsMm": [],+ "copperWeightOptionsOz": [+ 0.5,+ 1,+ 2,+ 3+ ],+ "surfaceFinishes": [],+ "maxBoardSize": {+ "xMm": null,+ "yMm": null+ },+ "notes": "Santa Clara CA, Development (NPI) tier; maximum board size not published for this tier. Min board thickness 0.008 in (0.2032 mm). PTH tolerance plus or minus 0.0015 in (0.0381 mm). Minimum pad 0.008 in (0.2032 mm). Min outer layer trace for filled and plated over vias 0.003 in (0.0762 mm). Aspect ratio PTH 14:1. Smallest PTH fillable and plated over 0.005 in (0.127 mm).",+ "sources": [+ {+ "url": "https://www.4pcb.com/pcb-capabilities.html",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "advanced capabilities, Santa Clara CA facility, Development (NPI) tier"+ }+ ]+}
bridge-rs/vendor/pcb-design-rules/records/aisler.jsonadded+262@@ -0,0 +1,262 @@+{+ "vendor": "Aisler",+ "vendorSlug": "aisler",+ "vendorUrl": null,+ "records": [+ {+ "process": "enig",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.125,+ "mil": 5.0,+ "condition": "Cu 35um (1oz), ENIG finish"+ },+ "minSpacing": {+ "mm": 0.125,+ "mil": 5.0,+ "condition": "Cu 35um (1oz), ENIG finish"+ },+ "minDrill": {+ "mm": 0.25,+ "mil": 10.0,+ "condition": "via drill, drills up to 0.45mm are treated as vias and not adjusted; PTH drills start at 0.5mm"+ },+ "minVia": {+ "drillMm": 0.25,+ "drillMil": 10.0,+ "padMm": 0.45,+ "padMil": 17.72+ },+ "annularRing": {+ "viaMm": 0.1,+ "viaMil": 4.0,+ "note": "via, PTH annular ring 300um (12 mil)"+ },+ "copperToBoardEdge": {+ "mm": 0.3,+ "mil": 12.0+ },+ "holeToHole": {+ "mm": 0.3,+ "mil": 12.0+ },+ "maskExpansion": {+ "mm": 0.05,+ "mil": 2.0,+ "condition": "suggested soldermask expansion"+ },+ "maskSliver": {+ "mm": 0.1,+ "mil": 4.0,+ "condition": "minimum soldermask dam, recommended but not required for ENIG"+ },+ "silkLineWidth": {+ "mm": 0.15,+ "mil": 6.0+ },+ "silkToCopper": {+ "mm": 0.125,+ "mil": 5.0,+ "condition": "silkscreen to pad, silkscreen on pads not supported"+ },+ "minCopperClearance": {+ "mm": 0.125,+ "mil": 5.0,+ "condition": "different nets, copper to copper"+ },+ "boardThicknessOptionsMm": [+ 1.6+ ],+ "copperWeightOptionsOz": [+ 1+ ],+ "surfaceFinishes": [+ "ENIG"+ ],+ "maxBoardSize": {+ "xMm": 500.0,+ "yMm": 500.0+ },+ "notes": "Imperial measures are rounded from metric on the source page. Min board dimension greater than 10mm. Min SMD pad size 200um (8 mil). Copper to NPTH clearance 250um (10 mil), copper to NPTH slot clearance 300um (12 mil) for slots under and over 1.8mm. PTH drill range 0.5mm to 5.6mm, PTH annular ring 300um. Via drill range 0.25mm to 0.45mm, via annular ring 100um. NPTH drill range 0.5mm to 5.6mm. Min NPTH slot 0.8mm, min PTH slot 0.7mm, max PTH slot 2.6mm, PTH slot annular ring 300um. Min silkscreen text height 800um (32 mil). Max silkscreen coverage 25% per board side. Castellated edges supported free of charge. Green soldermask (Peters Elpemer AS 2467), buried, blind, micro, and tented vias not supported. Via pad diameter not published.",+ "sources": [+ {+ "url": "https://community.aisler.net/t/2-layer-1-6mm-enig-design-rules/3732",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "Beautiful Boards 2 Layer 1.6mm ENIG (35um copper)"+ },+ {+ "process": "hasl",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.2,+ "mil": 8.0,+ "condition": "Cu 35um (1oz), HASL finish"+ },+ "minSpacing": {+ "mm": 0.15,+ "mil": 6.0,+ "condition": "Cu 35um (1oz), HASL finish"+ },+ "minDrill": {+ "mm": 0.3,+ "mil": 12.0,+ "condition": "via drill, PTH drills start at 0.5mm"+ },+ "minVia": {+ "drillMm": 0.3,+ "drillMil": 12.0,+ "padMm": 0.7,+ "padMil": 27.56+ },+ "annularRing": {+ "viaMm": 0.2,+ "viaMil": 8.0,+ "note": "via, 175um absolute minimum to compensate for drill enlargement up to 0.45mm; PTH annular ring 300um (12 mil)"+ },+ "copperToBoardEdge": {+ "mm": 0.3,+ "mil": 12.0+ },+ "holeToHole": {+ "mm": 0.3,+ "mil": 12.0+ },+ "maskExpansion": {+ "mm": 0.05,+ "mil": 2.0,+ "condition": "suggested soldermask expansion"+ },+ "maskSliver": {+ "mm": 0.1,+ "mil": 4.0,+ "condition": "minimum soldermask dam, required for HASL"+ },+ "silkLineWidth": {+ "mm": 0.15,+ "mil": 6.0+ },+ "silkToCopper": {+ "mm": 0.125,+ "mil": 5.0,+ "condition": "silkscreen to pad, silkscreen on pads not supported"+ },+ "minCopperClearance": {+ "mm": 0.15,+ "mil": 6.0,+ "condition": "different nets, copper to copper"+ },+ "boardThicknessOptionsMm": [+ 1.6+ ],+ "copperWeightOptionsOz": [+ 1+ ],+ "surfaceFinishes": [+ "HASL"+ ],+ "maxBoardSize": {+ "xMm": 500.0,+ "yMm": 500.0+ },+ "notes": "Lead-free HASL. Imperial measures are rounded from metric on the source page. Min board dimension greater than 10mm. Via drill range 0.3mm to 0.45mm, drill may be enlarged up to 0.45mm. PTH drill range 0.5mm to 5.6mm, NPTH drill range 0.5mm to 5.6mm. Min NPTH slot 0.8mm, min PTH slot 0.7mm, max PTH slot 2.6mm. Min silkscreen text height 800um (32 mil). Castellated edges not supported with HASL. Green soldermask (Peters Elpemer AS 2467). Via pad diameter not published.",+ "sources": [+ {+ "url": "https://community.aisler.net/t/2-layer-1-6-mm-35-m-hasl-design-rules/3735",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "Beautiful Boards 2 Layer 1.6mm HASL (35um copper)"+ },+ {+ "process": "enig",+ "layerCount": 4,+ "minTraceWidth": {+ "mm": 0.125,+ "mil": 5.0,+ "condition": "Cu 35um (1oz), ENIG finish"+ },+ "minSpacing": {+ "mm": 0.125,+ "mil": 5.0,+ "condition": "Cu 35um (1oz), ENIG finish"+ },+ "minDrill": {+ "mm": 0.25,+ "mil": 10.0,+ "condition": "via drill, PTH drills start at 0.5mm"+ },+ "minVia": {+ "drillMm": 0.25,+ "drillMil": 10.0,+ "padMm": 0.45,+ "padMil": 17.72+ },+ "annularRing": {+ "viaMm": 0.1,+ "viaMil": 4.0,+ "note": "via, PTH annular ring 300um (12 mil)"+ },+ "copperToBoardEdge": {+ "mm": 0.3,+ "mil": 12.0+ },+ "holeToHole": {+ "mm": 0.3,+ "mil": 12.0+ },+ "maskExpansion": {+ "mm": 0.05,+ "mil": 2.0,+ "condition": "suggested soldermask expansion"+ },+ "maskSliver": {+ "mm": 0.1,+ "mil": 4.0,+ "condition": "minimum soldermask dam, recommended but not required for ENIG"+ },+ "silkLineWidth": {+ "mm": 0.15,+ "mil": 6.0+ },+ "silkToCopper": {+ "mm": 0.125,+ "mil": 5.0,+ "condition": "silkscreen to pad, silkscreen on pads not supported"+ },+ "minCopperClearance": {+ "mm": 0.125,+ "mil": 5.0,+ "condition": "different nets, copper to copper"+ },+ "boardThicknessOptionsMm": [+ 0.8,+ 1.6+ ],+ "copperWeightOptionsOz": [+ 1+ ],+ "surfaceFinishes": [+ "ENIG"+ ],+ "maxBoardSize": {+ "xMm": 500.0,+ "yMm": 500.0+ },+ "notes": "Source page states rules are valid for both 0.8mm and 1.6mm PCB thickness. Imperial measures are rounded from metric on the source page. Min board dimension greater than 10mm. PTH drill range 0.5mm to 5.6mm, via drill range 0.25mm to 0.45mm, via annular ring 100um, NPTH drill range 0.5mm to 5.6mm. Min NPTH slot 0.8mm, min PTH slot 0.7mm, max PTH slot 2.6mm. Min silkscreen text height 800um (32 mil). Castellated edges supported free of charge. Green soldermask. Via pad diameter not published.",+ "sources": [+ {+ "url": "https://community.aisler.net/t/4-layer-35-m-enig-design-rules/3733",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "Beautiful Boards 4 Layer ENIG (35um copper, 0.8mm and 1.6mm)"+ }+ ],+ "unreachable": [+ "https://aisler.net/about/manufacturing (404)",+ "https://aisler.net/pages/technical-capabilities (returned login page)",+ "https://aisler.net/capabilities (404)"+ ]+}
bridge-rs/vendor/pcb-design-rules/records/allpcb.jsonadded+340@@ -0,0 +1,340 @@+{+ "vendor": "ALLPCB",+ "vendorSlug": "allpcb",+ "vendorUrl": null,+ "records": [+ {+ "process": "standard",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "all copper weights; vendor suggests 6mil (0.15mm) or more to save cost"+ },+ "minSpacing": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "all copper weights; vendor suggests 6mil (0.15mm) or more to save cost"+ },+ "minDrill": {+ "mm": 0.2,+ "mil": 7.87+ },+ "minVia": null,+ "annularRing": {+ "viaMm": 0.153,+ "viaMil": 6.02+ },+ "copperToBoardEdge": {+ "mm": 0.3,+ "mil": 11.81+ },+ "holeToHole": {+ "mm": 0.2032,+ "mil": 8.0+ },+ "maskExpansion": null,+ "maskSliver": {+ "mm": 0.1,+ "mil": 3.94+ },+ "silkLineWidth": {+ "mm": 0.15,+ "mil": 5.91+ },+ "silkToCopper": null,+ "minCopperClearance": null,+ "boardThicknessOptionsMm": [+ 0.4,+ 3.2+ ],+ "copperWeightOptionsOz": [+ 0.5,+ 1,+ 2+ ],+ "surfaceFinishes": [+ "HASL",+ "Immersion Gold",+ "Immersion Silver",+ "Immersion Tin",+ "OSP",+ "Hard Gold plating",+ "Soft Gold plating",+ "NiPdAu"+ ],+ "maxBoardSize": {+ "xMm": 506,+ "yMm": 580+ },+ "notes": "Single published limit set covers 1 to 14 layers, so this entry also applies to 4 and 6 layer boards. Board thickness is a continuous 0.4 to 3.2mm range. Copper: outer 1oz to 2oz (35 to 70um), inner 0.5oz to 2oz (18 to 70um). Min dimension 80x80mm. Drill range 0.2 to 6.5mm, finished CNC hole 0.2 to 6.5mm, hole size tolerance \u00b10.075mm. Copper to V-cut line 0.4mm (15.748mil) for panelized boards. Via space same net 8mil (0.2032mm), different nets 17mil (0.4318mm), component vias different nets 24mil (0.6096mm). Annular ring 6mil or larger where surrounded by traces. Min slot width 0.6mm, finished slot 0.45mm for HASL and 0.5mm for other finishes. Board thickness to via diameter ratio 6:1, 7:1 to 8:1 adds a fabrication day. Min character height 0.8mm (31.4961mil), width to height ratio 1:5. Mask sliver recorded from solder mask bridge value 0.1mm (price may rise).",+ "sources": [+ {+ "url": "https://www.allpcb.com/standard_pcb_manufacturing_capability.html",+ "dateRead": "2026-09-03"+ }+ ]+ },+ {+ "process": "advanced",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.076,+ "mil": 3.0,+ "condition": "1oz copper"+ },+ "minSpacing": {+ "mm": 0.076,+ "mil": 3.0,+ "condition": "1oz copper"+ },+ "minDrill": {+ "mm": 0.15,+ "mil": 5.91+ },+ "minVia": {+ "drillMm": 0.2,+ "drillMil": 7.87,+ "padMm": 0.5,+ "padMil": 19.68+ },+ "annularRing": {+ "viaMm": 0.18,+ "viaMil": 7.09+ },+ "copperToBoardEdge": {+ "mm": 0.3,+ "mil": 11.81+ },+ "holeToHole": null,+ "maskExpansion": null,+ "maskSliver": {+ "mm": 0.075,+ "mil": 2.95+ },+ "silkLineWidth": {+ "mm": 0.1,+ "mil": 3.94+ },+ "silkToCopper": {+ "mm": 0.15,+ "mil": 5.91+ },+ "minCopperClearance": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "pad edge to trace edge; BGA pad to trace 0.075mm (2.9528mil)"+ },+ "boardThicknessOptionsMm": [+ 0.4,+ 4.0+ ],+ "copperWeightOptionsOz": [+ 1,+ 2,+ 3,+ 4,+ 5,+ 6+ ],+ "surfaceFinishes": [+ "Bare Copper",+ "OSP",+ "HASL With Lead",+ "HASL Lead-free",+ "Immersion Gold",+ "Immersion Tin",+ "Immersion Silver",+ "Nickel Palladium Gold",+ "OSP plus Selective Immersion Gold",+ "Lead-free HASL plus Selective Immersion Gold",+ "Lead-free HASL plus Selective Gold Plating"+ ],+ "maxBoardSize": {+ "xMm": 630,+ "yMm": 520+ },+ "notes": "Double-side board via/pad: 0.2mm inner diameter, 0.5mm outer diameter; outer diameter must be 0.1mm larger than inner, 0.15mm preferred; preferred min via hole 0.2mm. Trace/spacing by copper weight: 1oz 0.076mm, 2oz 0.14mm (5.5118mil), 3oz 0.2mm (7.874mil), 4oz 0.25mm (9.8425mil), 5oz 0.35mm (13.7795mil), 6oz 0.45mm (17.7165mil). Trace width tolerance \u00b120%. Annular ring: plated DIP holes 1oz recommended 0.2mm, limit 0.18mm; non-plated DIP holes recommended 0.4mm (15.748mil). Min plated slot 0.7mm (27.5591mil), min non-plated slot 0.8mm (31.4961mil). Board thickness to min plated hole ratio 10:1. Plated half hole diameter 0.4mm or more, spacing 0.35mm (13.7795mil). Min single PCB size 10x5mm. Copper to board edge 0.3mm at non-stamp-hole panel areas; V-cut line to copper 0.4mm. Mask sliver recorded from min solder bridge width: green 0.075mm, other colors 0.125mm (4.9213mil). Silk text height 0.75mm (29.5276mil). BGA pad diameter 0.2mm or more. Edge rail 4mm or more.",+ "sources": [+ {+ "url": "https://www.allpcb.com/advanced_pcb_manufacturing_capability.html",+ "dateRead": "2026-09-03"+ }+ ]+ },+ {+ "process": "advanced",+ "layerCount": 4,+ "minTraceWidth": {+ "mm": 0.076,+ "mil": 3.0,+ "condition": "1oz copper"+ },+ "minSpacing": {+ "mm": 0.076,+ "mil": 3.0,+ "condition": "1oz copper"+ },+ "minDrill": {+ "mm": 0.15,+ "mil": 5.91+ },+ "minVia": {+ "drillMm": 0.15,+ "drillMil": 5.91,+ "padMm": 0.25,+ "padMil": 9.84+ },+ "annularRing": {+ "viaMm": 0.18,+ "viaMil": 7.09+ },+ "copperToBoardEdge": {+ "mm": 0.3,+ "mil": 11.81+ },+ "holeToHole": null,+ "maskExpansion": null,+ "maskSliver": {+ "mm": 0.075,+ "mil": 2.95+ },+ "silkLineWidth": {+ "mm": 0.1,+ "mil": 3.94+ },+ "silkToCopper": {+ "mm": 0.15,+ "mil": 5.91+ },+ "minCopperClearance": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "pad edge to trace edge; BGA pad to trace 0.075mm (2.9528mil)"+ },+ "boardThicknessOptionsMm": [+ 0.4,+ 4.0+ ],+ "copperWeightOptionsOz": [+ 1,+ 2,+ 3,+ 4,+ 5,+ 6+ ],+ "surfaceFinishes": [+ "Bare Copper",+ "OSP",+ "HASL With Lead",+ "HASL Lead-free",+ "Immersion Gold",+ "Immersion Tin",+ "Immersion Silver",+ "Nickel Palladium Gold",+ "OSP plus Selective Immersion Gold",+ "Lead-free HASL plus Selective Immersion Gold",+ "Lead-free HASL plus Selective Gold Plating"+ ],+ "maxBoardSize": {+ "xMm": 630,+ "yMm": 520+ },+ "notes": "Multi-layer board via/pad: 0.15mm inner diameter, 0.25mm outer diameter. Other limits as 2 layer entry.",+ "sources": [+ {+ "url": "https://www.allpcb.com/advanced_pcb_manufacturing_capability.html",+ "dateRead": "2026-09-03"+ }+ ]+ },+ {+ "process": "advanced",+ "layerCount": 6,+ "minTraceWidth": {+ "mm": 0.076,+ "mil": 3.0,+ "condition": "1oz copper"+ },+ "minSpacing": {+ "mm": 0.076,+ "mil": 3.0,+ "condition": "1oz copper"+ },+ "minDrill": {+ "mm": 0.15,+ "mil": 5.91+ },+ "minVia": {+ "drillMm": 0.15,+ "drillMil": 5.91,+ "padMm": 0.25,+ "padMil": 9.84+ },+ "annularRing": {+ "viaMm": 0.18,+ "viaMil": 7.09+ },+ "copperToBoardEdge": {+ "mm": 0.3,+ "mil": 11.81+ },+ "holeToHole": null,+ "maskExpansion": null,+ "maskSliver": {+ "mm": 0.075,+ "mil": 2.95+ },+ "silkLineWidth": {+ "mm": 0.1,+ "mil": 3.94+ },+ "silkToCopper": {+ "mm": 0.15,+ "mil": 5.91+ },+ "minCopperClearance": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "pad edge to trace edge; BGA pad to trace 0.075mm (2.9528mil)"+ },+ "boardThicknessOptionsMm": [+ 0.6,+ 4.0+ ],+ "copperWeightOptionsOz": [+ 1,+ 2,+ 3,+ 4,+ 5,+ 6+ ],+ "surfaceFinishes": [+ "Bare Copper",+ "OSP",+ "HASL With Lead",+ "HASL Lead-free",+ "Immersion Gold",+ "Immersion Tin",+ "Immersion Silver",+ "Nickel Palladium Gold",+ "OSP plus Selective Immersion Gold",+ "Lead-free HASL plus Selective Immersion Gold",+ "Lead-free HASL plus Selective Gold Plating"+ ],+ "maxBoardSize": {+ "xMm": 630,+ "yMm": 520+ },+ "notes": "6 layer board thickness range 0.6 to 4.0mm, differs from 2 and 4 layer range 0.4 to 4.0mm. Other limits as 4 layer entry.",+ "sources": [+ {+ "url": "https://www.allpcb.com/advanced_pcb_manufacturing_capability.html",+ "dateRead": "2026-09-03"+ }+ ]+ }+ ]+}
bridge-rs/vendor/pcb-design-rules/records/elecrow.jsonadded+208@@ -0,0 +1,208 @@+{+ "vendor": "Elecrow",+ "vendorSlug": "elecrow",+ "vendorUrl": null,+ "records": [+ {+ "process": "standard",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "minimum, recommend greater than 8 mil"+ },+ "minSpacing": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "trace to trace, minimum, recommend greater than 8 mil; pad to pad minimum is 8 mil (0.2032 mm)"+ },+ "minDrill": {+ "mm": 0.3,+ "mil": 11.81+ },+ "minVia": {+ "drillMm": 0.3,+ "drillMil": 11.81,+ "padMm": null,+ "padMil": null+ },+ "annularRing": null,+ "copperToBoardEdge": null,+ "holeToHole": null,+ "maskExpansion": null,+ "maskSliver": null,+ "silkLineWidth": {+ "mm": 0.15,+ "mil": 5.91+ },+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "different nets"+ },+ "boardThicknessOptionsMm": [+ 0.6,+ 0.8,+ 1.0,+ 1.2,+ 1.6,+ 2.0+ ],+ "copperWeightOptionsOz": [+ 1,+ 2+ ],+ "surfaceFinishes": [+ "HASL",+ "HASL Lead Free",+ "ENIG"+ ],+ "maxBoardSize": {+ "xMm": 550.0,+ "yMm": 550.0+ },+ "notes": "Specs apply to regular custom PCB online ordering service, 1 to 8 layers share these limits. Maximum size 55cm x 55cm, minimum board dimension 10mm. Inner layer copper 17um (0.5 oz) or 35um (1 oz). Order form also offers OSP finish, 2.5mm thickness, and min castellated hole 0.60mm. Drill tolerance plated 0.1mm, non-plated 0.05mm. Outline tolerance plus or minus 0.20mm. Min silkscreen text height 0.8mm.",+ "sources": [+ {+ "url": "https://www.elecrow.com/pcb-manufacturing.html",+ "dateRead": "2026-09-03"+ }+ ]+ },+ {+ "process": "standard",+ "layerCount": 4,+ "minTraceWidth": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "minimum, recommend greater than 8 mil"+ },+ "minSpacing": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "trace to trace, minimum, recommend greater than 8 mil; pad to pad minimum is 8 mil (0.2032 mm)"+ },+ "minDrill": {+ "mm": 0.3,+ "mil": 11.81+ },+ "minVia": {+ "drillMm": 0.3,+ "drillMil": 11.81,+ "padMm": null,+ "padMil": null+ },+ "annularRing": null,+ "copperToBoardEdge": null,+ "holeToHole": null,+ "maskExpansion": null,+ "maskSliver": null,+ "silkLineWidth": {+ "mm": 0.15,+ "mil": 5.91+ },+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "different nets"+ },+ "boardThicknessOptionsMm": [+ 0.6,+ 0.8,+ 1.0,+ 1.2,+ 1.6,+ 2.0+ ],+ "copperWeightOptionsOz": [+ 1,+ 2+ ],+ "surfaceFinishes": [+ "HASL",+ "HASL Lead Free",+ "ENIG"+ ],+ "maxBoardSize": {+ "xMm": 550.0,+ "yMm": 550.0+ },+ "notes": "Same published spec table as 2 layer: multi layers 1-2-4-6-8 share these limits. 4 layer adds two inner layers (G1, G2 gerbers). Inner layer copper 17um (0.5 oz) or 35um (1 oz).",+ "sources": [+ {+ "url": "https://www.elecrow.com/pcb-manufacturing.html",+ "dateRead": "2026-09-03"+ }+ ]+ },+ {+ "process": "standard",+ "layerCount": 6,+ "minTraceWidth": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "minimum, recommend greater than 8 mil"+ },+ "minSpacing": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "trace to trace, minimum, recommend greater than 8 mil; pad to pad minimum is 8 mil (0.2032 mm)"+ },+ "minDrill": {+ "mm": 0.3,+ "mil": 11.81+ },+ "minVia": {+ "drillMm": 0.3,+ "drillMil": 11.81,+ "padMm": null,+ "padMil": null+ },+ "annularRing": null,+ "copperToBoardEdge": null,+ "holeToHole": null,+ "maskExpansion": null,+ "maskSliver": null,+ "silkLineWidth": {+ "mm": 0.15,+ "mil": 5.91+ },+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "different nets"+ },+ "boardThicknessOptionsMm": [+ 0.6,+ 0.8,+ 1.0,+ 1.2,+ 1.6,+ 2.0+ ],+ "copperWeightOptionsOz": [+ 1,+ 2+ ],+ "surfaceFinishes": [+ "HASL",+ "HASL Lead Free",+ "ENIG"+ ],+ "maxBoardSize": {+ "xMm": 550.0,+ "yMm": 550.0+ },+ "notes": "Same published spec table as 2 layer: multi layers 1-2-4-6-8 share these limits. Inner layer copper 17um (0.5 oz) or 35um (1 oz).",+ "sources": [+ {+ "url": "https://www.elecrow.com/pcb-manufacturing.html",+ "dateRead": "2026-09-03"+ }+ ]+ }+ ]+}
bridge-rs/vendor/pcb-design-rules/records/eurocircuits.jsonadded+502@@ -0,0 +1,502 @@+{+ "vendor": "Eurocircuits",+ "vendorSlug": "eurocircuits",+ "vendorUrl": null,+ "records": [+ {+ "process": "proto",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.15,+ "mil": 5.91,+ "condition": "all services, pattern class 6"+ },+ "minSpacing": {+ "mm": 0.15,+ "mil": 5.91,+ "condition": "track to track, pattern class 6; class 5 is 0.175 mm (6.8898 mil), class 7 is 0.125 mm (4.9213 mil)"+ },+ "minDrill": {+ "mm": 0.25,+ "mil": 9.84,+ "condition": "min finished PTH hole; NPTH 0.35 mm (13.7795 mil)"+ },+ "minVia": {+ "drillMm": 0.25,+ "drillMil": 9.84,+ "padMm": 0.6,+ "padMil": 23.62+ },+ "annularRing": {+ "viaMm": 0.125,+ "viaMil": 4.92,+ "note": "outer and inner, plated holes, pattern class 6; recommended NPTH annular ring 0.30 mm (11.811 mil)"+ },+ "copperToBoardEdge": {+ "mm": 0.25,+ "mil": 9.84,+ "condition": "outer layers, routed; inner layers 0.40 mm (15.748 mil)"+ },+ "holeToHole": {+ "mm": 0.25,+ "mil": 9.84,+ "condition": "drill to drill, edge to edge of TOOLSIZE"+ },+ "maskExpansion": {+ "mm": 0.03,+ "mil": 1.18,+ "condition": "mask annular ring MAR, LDI colors green, black, red, blue; PI white or transparent 0.10 mm (3.937 mil); minimum SM opening 0.40 mm (15.748 mil)"+ },+ "maskSliver": {+ "mm": 0.075,+ "mil": 2.95,+ "condition": "mask segment MSM, LDI colors; PI white or transparent 0.130 mm (5.1181 mil)"+ },+ "silkLineWidth": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "min legend line width; min text height 1.00 mm (39.5 mil)"+ },+ "silkToCopper": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "legend to exposed copper or surface finished copper; also 0.10 mm to holes and cutouts"+ },+ "minCopperClearance": {+ "mm": 0.15,+ "mil": 5.91,+ "condition": "different nets, pattern class 6 (standard); IPI clearance unconnected hole to copper 0.200 mm (7.874 mil)"+ },+ "boardThicknessOptionsMm": [+ 1.55+ ],+ "copperWeightOptionsOz": [+ 0.5,+ 1+ ],+ "surfaceFinishes": [+ "ENIG",+ "LF HAL"+ ],+ "maxBoardSize": {+ "xMm": 580.0,+ "yMm": 425.0+ },+ "notes": "Min board 20 x 20 mm. Base copper foil: outer layers 18 \u00b5m (0.5 oz), inner layers 35 \u00b5m (1 oz). Minimum pad diameter: PTH is finished hole plus 0.350 mm on outer and inner layers, NPTH is finished hole plus 0.250 mm. Tool size equals finished PTH hole size plus 0.10 mm (4 mil), NPTH tool size equals finished size. Drill bits in 0.05 mm increments. Standard PTH hole tolerance plus/minus 0.10 mm (0.20 mm range) for holes 4 mm or less, NPTH plus/minus 0.05 mm. Holes with finished size 0.45 mm or smaller are defined as via holes. Pattern class 5 (all services): track/gap 0.175 mm (6.8898 mil), OAR/IAR 0.150 mm (5.9055 mil), IPI 0.225 mm (8.8583 mil). Legend to board edge: 0.250 mm routing, 0.450 mm scoring. Soldermask design rules LDI: pad to pad 0.135 mm (5.315 mil), track to pad 0.090 mm (3.5433 mil); PI colors: pad to pad 0.330 mm (12.9921 mil), track to pad 0.190 mm (7.4803 mil). Mask overlap clearance MOC: LDI 0.060 mm (2.3622 mil), PI 0.090 mm (3.5433 mil).",+ "sources": [+ {+ "url": "https://www.eurocircuits.com/services/pcb-proto/",+ "dateRead": "2026-09-03"+ },+ {+ "url": "https://www.eurocircuits.com/technical-guidelines/pcb-design-guidelines/classification/",+ "dateRead": "2026-09-03"+ },+ {+ "url": "https://www.eurocircuits.com/content/uploads/2025/04/EC-classification-ENGLISH-5-2024-V3.png",+ "dateRead": "2026-09-03"+ },+ {+ "url": "https://www.eurocircuits.com/technical-guidelines/pcb-design-guidelines/drilled-holes/",+ "dateRead": "2026-09-03"+ },+ {+ "url": "https://www.eurocircuits.com/technical-guidelines/pcb-design-guidelines/soldermask/",+ "dateRead": "2026-09-03"+ },+ {+ "url": "https://www.eurocircuits.com/technical-guidelines/pcb-design-guidelines/legend-print/",+ "dateRead": "2026-09-03"+ },+ {+ "url": "https://www.eurocircuits.com/technical-guidelines/pcb-design-guidelines/copper-layers/",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "PCB proto"+ },+ {+ "process": "proto",+ "layerCount": 4,+ "minTraceWidth": {+ "mm": 0.15,+ "mil": 5.91,+ "condition": "outer and inner layers, pattern class 6"+ },+ "minSpacing": {+ "mm": 0.15,+ "mil": 5.91,+ "condition": "pattern class 6; class 5 is 0.175 mm (6.8898 mil)"+ },+ "minDrill": {+ "mm": 0.25,+ "mil": 9.84,+ "condition": "min finished PTH hole; NPTH 0.35 mm (13.7795 mil)"+ },+ "minVia": {+ "drillMm": 0.25,+ "drillMil": 9.84,+ "padMm": 0.6,+ "padMil": 23.62+ },+ "annularRing": {+ "viaMm": 0.125,+ "viaMil": 4.92,+ "note": "outer and inner, plated holes, pattern class 6; recommended NPTH 0.30 mm (11.811 mil)"+ },+ "copperToBoardEdge": {+ "mm": 0.25,+ "mil": 9.84,+ "condition": "outer layers, routed; inner layers 0.40 mm (15.748 mil)"+ },+ "holeToHole": {+ "mm": 0.25,+ "mil": 9.84,+ "condition": "drill to drill, edge to edge of TOOLSIZE"+ },+ "maskExpansion": {+ "mm": 0.03,+ "mil": 1.18,+ "condition": "MAR, LDI colors; PI white or transparent 0.10 mm (3.937 mil); min SM opening 0.40 mm (15.748 mil)"+ },+ "maskSliver": {+ "mm": 0.075,+ "mil": 2.95,+ "condition": "MSM, LDI colors; PI white or transparent 0.130 mm (5.1181 mil)"+ },+ "silkLineWidth": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "min legend line width; min text height 1.00 mm (39.5 mil)"+ },+ "silkToCopper": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "legend to exposed copper"+ },+ "minCopperClearance": {+ "mm": 0.15,+ "mil": 5.91,+ "condition": "different nets, pattern class 6; IPI 0.200 mm (7.874 mil)"+ },+ "boardThicknessOptionsMm": [+ 1.55+ ],+ "copperWeightOptionsOz": [+ 0.5,+ 1+ ],+ "surfaceFinishes": [+ "ENIG",+ "LF HAL"+ ],+ "maxBoardSize": {+ "xMm": 500.0,+ "yMm": 425.0+ },+ "notes": "4 layer max board size 500 x 425 mm. Same build parameters as 2 layer. Blind and buried vias not available in PCB proto.",+ "sources": [+ {+ "url": "https://www.eurocircuits.com/services/pcb-proto/",+ "dateRead": "2026-09-03"+ },+ {+ "url": "https://www.eurocircuits.com/technical-guidelines/pcb-design-guidelines/classification/",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "PCB proto"+ },+ {+ "process": "standard",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "pooling; non-pooling 0.090 mm (3.5433 mil)"+ },+ "minSpacing": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "pooling; non-pooling 0.090 mm (3.5433 mil); pattern class table: class 6 track/gap 0.150 mm (5.9055 mil), class 7 0.125 mm (4.9213 mil), class 8 0.100 mm (3.937 mil), class 9 0.090 mm (3.5433 mil), class 5 0.175 mm (6.8898 mil)"+ },+ "minDrill": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "min finished PTH hole; NPTH 0.20 mm (7.874 mil); classification drill classes by service: class A (all services) PTH 0.50 mm (19.685 mil), class B PTH 0.35 mm (13.7795 mil), class C PTH 0.25 mm (9.8425 mil), class D PTH 0.15 mm (5.9055 mil), class E PTH 0.10 mm (3.937 mil)"+ },+ "minVia": {+ "drillMm": 0.1,+ "drillMil": 3.94,+ "padMm": 0.4,+ "padMil": 15.75+ },+ "annularRing": {+ "viaMm": 0.125,+ "viaMil": 4.92,+ "note": "outer and inner, plated holes, pattern class 6; class 8 is 0.100 mm (3.937 mil); recommended NPTH 0.30 mm (11.811 mil)"+ },+ "copperToBoardEdge": {+ "mm": 0.25,+ "mil": 9.84,+ "condition": "outer layers routed; inner layers routed 0.40 mm (15.748 mil); V-cut 0.45 mm (17.7165 mil) outer and inner"+ },+ "holeToHole": {+ "mm": 0.25,+ "mil": 9.84,+ "condition": "drill to drill, edge to edge of TOOLSIZE"+ },+ "maskExpansion": {+ "mm": 0.03,+ "mil": 1.18,+ "condition": "MAR, LDI colors; PI white or transparent 0.10 mm (3.937 mil); min SM opening 0.40 mm (15.748 mil)"+ },+ "maskSliver": {+ "mm": 0.075,+ "mil": 2.95,+ "condition": "MSM, LDI colors; PI white or transparent 0.130 mm (5.1181 mil)"+ },+ "silkLineWidth": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "min legend line width; min text height 1.00 mm (39.5 mil)"+ },+ "silkToCopper": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "legend to exposed copper"+ },+ "minCopperClearance": {+ "mm": 0.15,+ "mil": 5.91,+ "condition": "different nets, pattern class 6 (default); class 5 0.175 mm (6.8898 mil), class 7 0.125 mm (4.9213 mil), class 8 0.100 mm (3.937 mil), class 9 0.090 mm (3.5433 mil); IPI unconnected hole to copper 0.200 mm (7.874 mil)"+ },+ "boardThicknessOptionsMm": [+ 1.0,+ 1.55,+ 2.4+ ],+ "copperWeightOptionsOz": [+ 0.5,+ 0.67,+ 1,+ 2+ ],+ "surfaceFinishes": [+ "ENIG",+ "LF HAL",+ "Immersion Silver"+ ],+ "maxBoardSize": {+ "xMm": 580.0,+ "yMm": 425.0+ },+ "notes": "Min board 5 x 5 mm. Base copper foil pooling 2 layer: 12 \u00b5m (0.33 oz), 18 \u00b5m (0.5 oz), 35 \u00b5m (1 oz), 70 \u00b5m (2 oz); inner layers 18 \u00b5m and 35 \u00b5m. Minimum pad diameter: outer PTH finished hole plus 0.300 mm, outer NPTH plus 0.200 mm, inner PTH plus 0.350 mm, inner NPTH plus 0.250 mm. Classification min pattern values also limited by base copper foil: 12 \u00b5m 0.090 mm (3.5 mil), 18 \u00b5m 0.100 mm (4 mil), 35 \u00b5m 0.125 mm (5 mil), 70 \u00b5m 0.200 mm (8 mil), 105 \u00b5m 0.250 mm (10 mil), for both outer and inner layers. Drill class minimum TOOLSIZE: class A 0.60 mm (23.622 mil), B 0.45 mm (17.7165 mil), C 0.35 mm (13.7795 mil), D 0.25 mm (9.8425 mil), E 0.20 mm (7.874 mil); max board thickness per drill class: A and B 3.20 mm, C 2.40 mm, D 2.00 mm, E 1.60 mm; aspect ratio 1:8. TOOLSIZE equals finished PTH size plus 0.10 mm (4 mil). Soldermask colors pooling: green, blue, black, white, red; non-pooling transparent. Legend white one or both sides, non-pooling black and white.",+ "sources": [+ {+ "url": "https://www.eurocircuits.com/services/standard-pool/",+ "dateRead": "2026-09-03"+ },+ {+ "url": "https://www.eurocircuits.com/technical-guidelines/pcb-design-guidelines/classification/",+ "dateRead": "2026-09-03"+ },+ {+ "url": "https://www.eurocircuits.com/content/uploads/2025/04/EC-classification-ENGLISH-5-2024-V3.png",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "STANDARD pool"+ },+ {+ "process": "standard",+ "layerCount": 4,+ "minTraceWidth": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "pooling; non-pooling 0.090 mm (3.5433 mil); inner layer same classification values"+ },+ "minSpacing": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "pooling; non-pooling 0.090 mm (3.5433 mil); pattern class 6 is 0.150 mm (5.9055 mil)"+ },+ "minDrill": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "min finished PTH hole; NPTH 0.20 mm (7.874 mil); drill classes A 0.50 mm to E 0.10 mm finished PTH"+ },+ "minVia": {+ "drillMm": 0.1,+ "drillMil": 3.94,+ "padMm": 0.4,+ "padMil": 15.75+ },+ "annularRing": {+ "viaMm": 0.125,+ "viaMil": 4.92,+ "note": "outer and inner, plated holes, pattern class 6; recommended NPTH 0.30 mm (11.811 mil)"+ },+ "copperToBoardEdge": {+ "mm": 0.25,+ "mil": 9.84,+ "condition": "outer layers routed; inner layers routed 0.40 mm (15.748 mil); V-cut 0.45 mm (17.7165 mil)"+ },+ "holeToHole": {+ "mm": 0.25,+ "mil": 9.84,+ "condition": "drill to drill, edge to edge of TOOLSIZE"+ },+ "maskExpansion": {+ "mm": 0.03,+ "mil": 1.18,+ "condition": "MAR, LDI colors; PI 0.10 mm (3.937 mil); min SM opening 0.40 mm (15.748 mil)"+ },+ "maskSliver": {+ "mm": 0.075,+ "mil": 2.95,+ "condition": "MSM, LDI colors; PI 0.130 mm (5.1181 mil)"+ },+ "silkLineWidth": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "min legend line width; min text height 1.00 mm (39.5 mil)"+ },+ "silkToCopper": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "legend to exposed copper"+ },+ "minCopperClearance": {+ "mm": 0.15,+ "mil": 5.91,+ "condition": "different nets, pattern class 6; IPI 0.200 mm (7.874 mil)"+ },+ "boardThicknessOptionsMm": [+ 1.0,+ 1.55+ ],+ "copperWeightOptionsOz": [+ 0.5,+ 0.67,+ 1,+ 2+ ],+ "surfaceFinishes": [+ "ENIG",+ "LF HAL",+ "Immersion Silver"+ ],+ "maxBoardSize": {+ "xMm": 500.0,+ "yMm": 425.0+ },+ "notes": "4 layer pooling board thickness 1.00 mm; 1.55 mm pooling for 6 to 16 layers. Multilayer max dimension 500 x 425 mm. Standard buildups pooled, 8 predefined non-pooling builds; blind and buried vias non-pooling specials. Base copper inner layers pooling 18 \u00b5m and 35 \u00b5m.",+ "sources": [+ {+ "url": "https://www.eurocircuits.com/services/standard-pool/",+ "dateRead": "2026-09-03"+ },+ {+ "url": "https://www.eurocircuits.com/technical-guidelines/pcb-design-guidelines/classification/",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "STANDARD pool"+ },+ {+ "process": "standard",+ "layerCount": 6,+ "minTraceWidth": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "pooling; non-pooling 0.090 mm (3.5433 mil)"+ },+ "minSpacing": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "pooling; non-pooling 0.090 mm (3.5433 mil)"+ },+ "minDrill": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "min finished PTH hole; NPTH 0.20 mm (7.874 mil)"+ },+ "minVia": {+ "drillMm": 0.1,+ "drillMil": 3.94,+ "padMm": 0.4,+ "padMil": 15.75+ },+ "annularRing": {+ "viaMm": 0.125,+ "viaMil": 4.92,+ "note": "outer and inner, plated holes, pattern class 6"+ },+ "copperToBoardEdge": {+ "mm": 0.25,+ "mil": 9.84,+ "condition": "outer layers routed; inner 0.40 mm (15.748 mil); V-cut 0.45 mm (17.7165 mil)"+ },+ "holeToHole": {+ "mm": 0.25,+ "mil": 9.84,+ "condition": "drill to drill, edge to edge of TOOLSIZE"+ },+ "maskExpansion": {+ "mm": 0.03,+ "mil": 1.18,+ "condition": "MAR, LDI colors; PI 0.10 mm (3.937 mil)"+ },+ "maskSliver": {+ "mm": 0.075,+ "mil": 2.95,+ "condition": "MSM, LDI colors; PI 0.130 mm (5.1181 mil)"+ },+ "silkLineWidth": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "min legend line width"+ },+ "silkToCopper": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "legend to exposed copper"+ },+ "minCopperClearance": {+ "mm": 0.15,+ "mil": 5.91,+ "condition": "different nets, pattern class 6; IPI 0.200 mm (7.874 mil)"+ },+ "boardThicknessOptionsMm": [+ 1.55+ ],+ "copperWeightOptionsOz": [+ 0.5,+ 0.67,+ 1,+ 2+ ],+ "surfaceFinishes": [+ "ENIG",+ "LF HAL",+ "Immersion Silver"+ ],+ "maxBoardSize": {+ "xMm": 500.0,+ "yMm": 425.0+ },+ "notes": "6 and 8 layers pooling in STANDARD pool; 10 to 16 layers non-pooling. Pooling board thickness for multilayers 6 layers and above is 1.55 mm. Same pattern and drill classification system applies.",+ "sources": [+ {+ "url": "https://www.eurocircuits.com/services/standard-pool/",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "STANDARD pool"+ }+ ],+ "unreachable": [+ "https://www.eurocircuits.com/our-services/eurocircuits-pcb-specifications/ (404)"+ ]+}
bridge-rs/vendor/pcb-design-rules/records/jlcpcb.jsonadded+290@@ -0,0 +1,290 @@+{+ "vendor": "JLCPCB",+ "vendorSlug": "jlcpcb",+ "vendorUrl": null,+ "records": [+ {+ "process": "standard",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.1,+ "mil": 4.0,+ "condition": "1 oz copper outer layer"+ },+ "minSpacing": {+ "mm": 0.1,+ "mil": 4.0,+ "condition": "1 oz copper, different nets"+ },+ "minDrill": {+ "mm": 0.15,+ "mil": 5.91+ },+ "minVia": {+ "drillMm": 0.15,+ "drillMil": 5.91,+ "padMm": 0.25,+ "padMil": 9.84+ },+ "annularRing": {+ "viaMm": 0.18,+ "viaMil": 7.09,+ "note": "PTH, 1 oz outer, absolute minimum, recommended 0.25 mm"+ },+ "copperToBoardEdge": {+ "mm": 0.2,+ "mil": 7.87,+ "condition": "routed edge, 0.4 mm for V-cut edge"+ },+ "holeToHole": {+ "mm": 0.2,+ "mil": 7.87,+ "condition": "via hole to via hole, pad hole to pad hole is 0.45 mm"+ },+ "maskExpansion": {+ "mm": 0.0,+ "mil": 0.0,+ "condition": "LDI, 1:1 pad to soldermask opening since June 2025"+ },+ "maskSliver": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "1 oz, soldermask bridge, green/red/yellow/blue/purple, 0.13 mm for black/white, 0.20 mm for 2 oz"+ },+ "silkLineWidth": {+ "mm": 0.15,+ "mil": 5.91+ },+ "silkToCopper": {+ "mm": 0.15,+ "mil": 5.91,+ "condition": "pad to silkscreen minimum distance"+ },+ "minCopperClearance": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "different nets, 1 oz"+ },+ "boardThicknessOptionsMm": [+ 0.4,+ 0.6,+ 0.8,+ 1.0,+ 1.2,+ 1.6,+ 2.0+ ],+ "copperWeightOptionsOz": [+ 1,+ 2,+ 2.5,+ 3.5,+ 4.5+ ],+ "surfaceFinishes": [+ "HASL leaded",+ "HASL lead-free",+ "ENIG"+ ],+ "maxBoardSize": {+ "xMm": 670.0,+ "yMm": 600.0,+ "condition": "absolute max 1020 x 600 mm for 2 layer FR4"+ },+ "notes": "2 oz: min trace/spacing 0.16/0.16 mm (6.5/6.5 mil). 2.5 oz: 0.2/0.2 mm (8/8 mil). 3.5 oz: 0.25/0.25 mm (10/10 mil). 4.5 oz: 0.3/0.3 mm (12/12 mil). Min drill 0.15 mm costs more. Via diameter should be 0.1 mm (0.15 mm preferred) larger than via hole, preferred min via hole 0.2 mm. PTH annular ring 2 oz: 0.254 mm or above. NPTH pad annular ring 0.45 mm recommended. Min NPTH 0.5 mm. Min plated slot width 0.5 mm. Pad to track clearance 0.1 mm. SMD pad to pad clearance different nets 0.15 mm. Via hole to track 0.2 mm, PTH to track 0.28 mm (0.35 recommended), NPTH to track 0.2 mm. Same-net track spacing 0.25 mm. Min silk text height 1.0 mm (40 mil). Soldermask opening to neighboring trace clearance 0.09 mm. Trace width tolerance plus/minus 20 percent.",+ "sources": [+ {+ "url": "https://jlcpcb.com/capabilities/pcb-capabilities",+ "dateRead": "2026-09-03"+ }+ ]+ },+ {+ "process": "standard",+ "layerCount": 4,+ "minTraceWidth": {+ "mm": 0.09,+ "mil": 3.5,+ "condition": "1 oz copper outer layer, 3 mil acceptable in BGA fan-outs"+ },+ "minSpacing": {+ "mm": 0.09,+ "mil": 3.5,+ "condition": "1 oz copper, different nets"+ },+ "minDrill": {+ "mm": 0.15,+ "mil": 5.91+ },+ "minVia": {+ "drillMm": 0.15,+ "drillMil": 5.91,+ "padMm": 0.25,+ "padMil": 9.84+ },+ "annularRing": {+ "viaMm": 0.15,+ "viaMil": 5.91,+ "note": "PTH, 1 oz outer, absolute minimum, recommended 0.20 mm"+ },+ "copperToBoardEdge": {+ "mm": 0.2,+ "mil": 7.87,+ "condition": "routed edge, 0.4 mm for V-cut edge"+ },+ "holeToHole": {+ "mm": 0.2,+ "mil": 7.87,+ "condition": "via hole to via hole, pad hole to pad hole is 0.45 mm"+ },+ "maskExpansion": {+ "mm": 0.0,+ "mil": 0.0,+ "condition": "LDI, 1:1 pad to soldermask opening since June 2025"+ },+ "maskSliver": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "1 oz, soldermask bridge, green/red/yellow/blue/purple, 0.13 mm for black/white, 0.20 mm for 2 oz"+ },+ "silkLineWidth": {+ "mm": 0.15,+ "mil": 5.91+ },+ "silkToCopper": {+ "mm": 0.15,+ "mil": 5.91,+ "condition": "pad to silkscreen minimum distance"+ },+ "minCopperClearance": {+ "mm": 0.09,+ "mil": 3.5,+ "condition": "different nets, 1 oz, 0.09 mm locally for BGA pads"+ },+ "boardThicknessOptionsMm": [+ 0.4,+ 0.6,+ 0.8,+ 1.0,+ 1.2,+ 1.6,+ 2.0+ ],+ "copperWeightOptionsOz": [+ 1,+ 2+ ],+ "surfaceFinishes": [+ "HASL leaded",+ "HASL lead-free",+ "ENIG"+ ],+ "maxBoardSize": {+ "xMm": 663.0,+ "yMm": 593.0,+ "condition": "absolute max 1016 x 596 mm for 4 layer FR4"+ },+ "notes": "Same source page as 2 layer, multilayer column. Inner layer copper 0.5/1/2 oz, 0.5 oz default. Inner layer via hole to copper clearance 0.2 mm, inner PTH pad hole to copper clearance 0.3 mm. 2 oz outer: min trace/spacing 0.15/0.15 mm (6/6 mil). Min plated slot width 0.35 mm multilayer. Controlled impedance available. Blind/buried vias not supported, through holes only.",+ "sources": [+ {+ "url": "https://jlcpcb.com/capabilities/pcb-capabilities",+ "dateRead": "2026-09-03"+ }+ ]+ },+ {+ "process": "standard",+ "layerCount": 6,+ "minTraceWidth": {+ "mm": 0.09,+ "mil": 3.5,+ "condition": "1 oz copper outer layer, 3 mil acceptable in BGA fan-outs"+ },+ "minSpacing": {+ "mm": 0.09,+ "mil": 3.5,+ "condition": "1 oz copper, different nets"+ },+ "minDrill": {+ "mm": 0.15,+ "mil": 5.91+ },+ "minVia": {+ "drillMm": 0.15,+ "drillMil": 5.91,+ "padMm": 0.25,+ "padMil": 9.84+ },+ "annularRing": {+ "viaMm": 0.15,+ "viaMil": 5.91,+ "note": "PTH, 1 oz outer, absolute minimum, recommended 0.20 mm"+ },+ "copperToBoardEdge": {+ "mm": 0.2,+ "mil": 7.87,+ "condition": "routed edge, 0.4 mm for V-cut edge"+ },+ "holeToHole": {+ "mm": 0.2,+ "mil": 7.87,+ "condition": "via hole to via hole, pad hole to pad hole is 0.45 mm"+ },+ "maskExpansion": {+ "mm": 0.0,+ "mil": 0.0,+ "condition": "LDI, 1:1 pad to soldermask opening since June 2025"+ },+ "maskSliver": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "1 oz, soldermask bridge, green/red/yellow/blue/purple, 0.13 mm for black/white, 0.20 mm for 2 oz"+ },+ "silkLineWidth": {+ "mm": 0.15,+ "mil": 5.91+ },+ "silkToCopper": {+ "mm": 0.15,+ "mil": 5.91,+ "condition": "pad to silkscreen minimum distance"+ },+ "minCopperClearance": {+ "mm": 0.09,+ "mil": 3.5,+ "condition": "different nets, 1 oz"+ },+ "boardThicknessOptionsMm": [+ 0.4,+ 0.6,+ 0.8,+ 1.0,+ 1.2,+ 1.6,+ 2.0+ ],+ "copperWeightOptionsOz": [+ 1,+ 2+ ],+ "surfaceFinishes": [+ "ENIG"+ ],+ "maxBoardSize": {+ "xMm": 656.0,+ "yMm": 586.0,+ "condition": "6 layer and above"+ },+ "notes": "Same source page as 2 layer, multilayer column. 6 layer and above boards only have ENIG surface finish. Via-in-pad epoxy filled and capped is the default process for 6 layer and above boards, compatible with via diameters 0.15 to 0.55 mm. 2 oz outer: min trace/spacing 0.15/0.15 mm (6/6 mil). Backdrill supported on 4 to 32 layer FR4, thickness 0.8 mm or more.",+ "sources": [+ {+ "url": "https://jlcpcb.com/capabilities/pcb-capabilities",+ "dateRead": "2026-09-03"+ }+ ]+ }+ ],+ "unreachable": [+ "https://jlcpcb.com/help/article/59-How-to-Set-Up-DRC-in-EAGLE (JS-rendered help article, no DRC numbers retrievable)"+ ]+}
bridge-rs/vendor/pcb-design-rules/records/macrofab.jsonadded+281@@ -0,0 +1,281 @@+{+ "vendor": "MacroFab",+ "vendorSlug": "macrofab",+ "vendorUrl": null,+ "records": [+ {+ "process": "extended",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.0762,+ "mil": 3.0,+ "condition": "extended specs, not available on 2 oz copper"+ },+ "minSpacing": {+ "mm": 0.0762,+ "mil": 3.0,+ "condition": "extended specs, not available on 2 oz copper"+ },+ "minDrill": {+ "mm": 0.1016,+ "mil": 4.0+ },+ "minVia": {+ "drillMm": 0.1016,+ "drillMil": 4.0,+ "padMm": 0.254,+ "padMil": 10.0+ },+ "annularRing": {+ "viaMm": 0.0762,+ "viaMil": 3.0+ },+ "copperToBoardEdge": {+ "mm": 0.0762,+ "mil": 3.0+ },+ "holeToHole": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "NPTH drill to drill; PTH drill to drill 0.5 mm (19.69 mil)"+ },+ "maskExpansion": null,+ "maskSliver": {+ "mm": 0.1,+ "mil": 3.93,+ "condition": "soldermask dam minimum"+ },+ "silkLineWidth": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "silkscreen size minimum; text height minimum 0.8 mm (32 mil)"+ },+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.0762,+ "mil": 3.0,+ "condition": "different nets"+ },+ "boardThicknessOptionsMm": [+ 1.6+ ],+ "copperWeightOptionsOz": [+ 0.5,+ 1+ ],+ "surfaceFinishes": [+ "ENIG"+ ],+ "maxBoardSize": {+ "xMm": 378.46,+ "yMm": 378.46+ },+ "notes": "Extended DRC minimums as published. Board thickness 1.6 mm standard, other custom thicknesses supported; thickness tolerance T below 1.0 mm plus minus 15 percent, 1.0 to 1.6 mm plus minus 10 percent, T at or above 1.6 mm plus minus 10 percent. Min via pad derived from published min drill plus 2x annular ring: 4 mil plus 6 mil. NPTH hole size tolerance plus minus 0.05 mm, PTH plus minus 0.08 mm. Board edge tolerance plus minus 0.15 mm. Extended option disabled for 2 oz copper. Paste aperture min 0.1524 mm, paste clearance 0.1524 mm. Silkscreen text height min 0.8 mm.",+ "sources": [+ {+ "url": "https://www.macrofab.com/capabilities/",+ "dateRead": "2026-09-03"+ },+ {+ "url": "https://www.macrofab.com/pcba/specs/",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "extended manufacturing specifications"+ },+ {+ "process": "extended",+ "layerCount": 4,+ "minTraceWidth": {+ "mm": 0.0762,+ "mil": 3.0,+ "condition": "extended specs, not available on 2 oz copper"+ },+ "minSpacing": {+ "mm": 0.0762,+ "mil": 3.0,+ "condition": "extended specs, not available on 2 oz copper"+ },+ "minDrill": {+ "mm": 0.1016,+ "mil": 4.0+ },+ "minVia": {+ "drillMm": 0.1016,+ "drillMil": 4.0,+ "padMm": 0.254,+ "padMil": 10.0+ },+ "annularRing": {+ "viaMm": 0.0762,+ "viaMil": 3.0+ },+ "copperToBoardEdge": {+ "mm": 0.0762,+ "mil": 3.0+ },+ "holeToHole": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "NPTH drill to drill; PTH drill to drill 0.5 mm (19.69 mil)"+ },+ "maskExpansion": null,+ "maskSliver": {+ "mm": 0.1,+ "mil": 3.93,+ "condition": "soldermask dam minimum"+ },+ "silkLineWidth": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "silkscreen size minimum; text height minimum 0.8 mm (32 mil)"+ },+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.0762,+ "mil": 3.0,+ "condition": "different nets"+ },+ "boardThicknessOptionsMm": [+ 1.6+ ],+ "copperWeightOptionsOz": [+ 0.5,+ 1+ ],+ "surfaceFinishes": [+ "ENIG"+ ],+ "maxBoardSize": {+ "xMm": 378.46,+ "yMm": 378.46+ },+ "notes": "Same extended DRC table published for all layer counts; MacroFab supports 2 to 36 layer boards per capabilities page. 2 oz copper requires larger trace, spacing, annular ring and disables the extended option; specific 2 oz numbers not published on the read pages.",+ "sources": [+ {+ "url": "https://www.macrofab.com/capabilities/",+ "dateRead": "2026-09-03"+ },+ {+ "url": "https://www.macrofab.com/pcba/specs/",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "extended manufacturing specifications"+ },+ {+ "process": "standard",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "standard manufacturing specifications"+ },+ "minSpacing": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "standard manufacturing specifications"+ },+ "minDrill": {+ "mm": 0.3048,+ "mil": 12.0+ },+ "minVia": null,+ "annularRing": null,+ "copperToBoardEdge": null,+ "holeToHole": null,+ "maskExpansion": null,+ "maskSliver": null,+ "silkLineWidth": null,+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "different nets"+ },+ "boardThicknessOptionsMm": [+ 1.6+ ],+ "copperWeightOptionsOz": [+ 0.5,+ 1+ ],+ "surfaceFinishes": [+ "ENIG"+ ],+ "maxBoardSize": {+ "xMm": 378.46,+ "yMm": 378.46+ },+ "notes": "Standard (default, non-extended) manufacturing specifications per MacroFab help article: minimum trace width 5 mil, minimum drill 12 mil; page notes the standard tier was later reduced (5 mil spacing, 10 mil drill announced December 2018) but the help article body was only visible via search index, not fully readable on load.",+ "sources": [+ {+ "url": "https://support.macrofab.com/s/article/pcb-specifications-and-drc",+ "dateRead": "2026-09-03"+ },+ {+ "url": "https://support.macrofab.com/s/article/can-i-customize-my-pcb",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "standard manufacturing specifications"+ },+ {+ "process": "standard",+ "layerCount": 4,+ "minTraceWidth": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "standard manufacturing specifications"+ },+ "minSpacing": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "standard manufacturing specifications"+ },+ "minDrill": {+ "mm": 0.3048,+ "mil": 12.0+ },+ "minVia": null,+ "annularRing": null,+ "copperToBoardEdge": null,+ "holeToHole": null,+ "maskExpansion": null,+ "maskSliver": null,+ "silkLineWidth": null,+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "different nets"+ },+ "boardThicknessOptionsMm": [+ 1.6+ ],+ "copperWeightOptionsOz": [+ 0.5,+ 1+ ],+ "surfaceFinishes": [+ "ENIG"+ ],+ "maxBoardSize": {+ "xMm": 378.46,+ "yMm": 378.46+ },+ "notes": "Same standard specifications as 2-layer; help article does not differentiate by layer count.",+ "sources": [+ {+ "url": "https://support.macrofab.com/s/article/pcb-specifications-and-drc",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "standard manufacturing specifications"+ }+ ],+ "unreachable": [+ "https://help.macrofab.com/docs/design-rules/standard-pcb-design-rules (JS shell only, no content rendered)",+ "https://support.macrofab.com/s/article/pcb-specifications-and-drc (JS shell only, content visible in search index)"+ ]+}
bridge-rs/vendor/pcb-design-rules/records/nextpcb.jsonadded+319@@ -0,0 +1,319 @@+{+ "vendor": "NextPCB",+ "vendorSlug": "nextpcb",+ "vendorUrl": null,+ "records": [+ {+ "process": "standard",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.0635,+ "mil": 2.5,+ "condition": "H/HOZ 0.5oz inner layer copper"+ },+ "minSpacing": {+ "mm": 0.0762,+ "mil": 3.0,+ "condition": "H/HOZ 0.5oz inner layer copper"+ },+ "minDrill": {+ "mm": 0.15,+ "mil": 5.91+ },+ "minVia": {+ "drillMm": 0.2,+ "drillMil": 7.87,+ "padMm": 0.3278,+ "padMil": 12.91+ },+ "annularRing": {+ "viaMm": 0.0889,+ "viaMil": 3.5+ },+ "copperToBoardEdge": {+ "mm": 0.2,+ "mil": 7.87+ },+ "holeToHole": {+ "mm": 0.3048,+ "mil": 12.0+ },+ "maskExpansion": {+ "mm": 0.0381,+ "mil": 1.5+ },+ "maskSliver": {+ "mm": 0.0889,+ "mil": 3.5+ },+ "silkLineWidth": {+ "mm": 0.0762,+ "mil": 3.0+ },+ "silkToCopper": {+ "mm": 0.1524,+ "mil": 6.0+ },+ "minCopperClearance": {+ "mm": 0.1778,+ "mil": 7.0,+ "condition": "via to track"+ },+ "boardThicknessOptionsMm": [+ 0.6,+ 0.8,+ 1.0,+ 1.2,+ 1.6,+ 2.0,+ 2.5,+ 3.0,+ 3.2+ ],+ "copperWeightOptionsOz": [+ 0.5,+ 1,+ 2+ ],+ "surfaceFinishes": null,+ "maxBoardSize": {+ "xMm": 1500,+ "yMm": 600+ },+ "notes": "Trace/spacing table is by copper weight, not layer count: 0.5oz inner 2.5mil width/3mil spacing, 1oz outer 3mil/3mil, 2oz outer 5.5mil/5.5mil. Annular ring: 3.5mil for 1oz, 4.5mil for 2oz. Min drill 0.15mm only for board thickness 1.2mm or less. PTH hole size 0.2mm or larger single side. Copper to V-cut line 0.4mm (15.748mil). Hole to hole different nets 12mil for CAF avoidance; via to via same net 8mil (0.2032mm); PTH to track 9mil (0.2286mm); NPTH to track 8mil (0.2032mm); SMD pad to track 4mil (0.1016mm); SMD pad to SMD pad 0.15mm; pad to pad with hole different nets 0.40mm. Mask sliver (solder bridge dam): green 3.5mil, black/white 5mil (0.127mm), other colors 4mil (0.1016mm). Silk line width: silkscreen printing 5mil (0.127mm), printer printing 3mil (0.0762mm). Finished copper outer 1oz/2oz, inner 0.5oz/1oz/2oz. Surface finish cell left blank on page. BGA 1oz: min pad 0.2mm, min pad distance 0.15mm. Layer count 1 to 32 supported.",+ "sources": [+ {+ "url": "https://www.nextpcb.com/pcb-capabilities",+ "dateRead": "2026-09-03"+ }+ ]+ },+ {+ "process": "standard",+ "layerCount": 4,+ "minTraceWidth": {+ "mm": 0.0635,+ "mil": 2.5,+ "condition": "H/HOZ 0.5oz inner layer copper"+ },+ "minSpacing": {+ "mm": 0.0762,+ "mil": 3.0,+ "condition": "H/HOZ 0.5oz inner layer copper"+ },+ "minDrill": {+ "mm": 0.15,+ "mil": 5.91+ },+ "minVia": {+ "drillMm": 0.2,+ "drillMil": 7.87,+ "padMm": 0.3278,+ "padMil": 12.91+ },+ "annularRing": {+ "viaMm": 0.0889,+ "viaMil": 3.5+ },+ "copperToBoardEdge": {+ "mm": 0.2,+ "mil": 7.87+ },+ "holeToHole": {+ "mm": 0.3048,+ "mil": 12.0+ },+ "maskExpansion": {+ "mm": 0.0381,+ "mil": 1.5+ },+ "maskSliver": {+ "mm": 0.0889,+ "mil": 3.5+ },+ "silkLineWidth": {+ "mm": 0.0762,+ "mil": 3.0+ },+ "silkToCopper": {+ "mm": 0.1524,+ "mil": 6.0+ },+ "minCopperClearance": {+ "mm": 0.1778,+ "mil": 7.0,+ "condition": "via to track"+ },+ "boardThicknessOptionsMm": [+ 0.6,+ 0.8,+ 1.0,+ 1.2,+ 1.6,+ 2.0,+ 2.5,+ 3.0,+ 3.2+ ],+ "copperWeightOptionsOz": [+ 0.5,+ 1,+ 2+ ],+ "surfaceFinishes": null,+ "maxBoardSize": {+ "xMm": 1500,+ "yMm": 500+ },+ "notes": "Same published limits as 2 layer except max dimension 1500x500mm for 4 layers. Trace/spacing by copper weight: 0.5oz inner 2.5mil/3mil, 1oz outer 3mil/3mil, 2oz outer 5.5mil/5.5mil.",+ "sources": [+ {+ "url": "https://www.nextpcb.com/pcb-capabilities",+ "dateRead": "2026-09-03"+ }+ ]+ },+ {+ "process": "standard",+ "layerCount": 6,+ "minTraceWidth": {+ "mm": 0.0635,+ "mil": 2.5,+ "condition": "H/HOZ 0.5oz inner layer copper"+ },+ "minSpacing": {+ "mm": 0.0762,+ "mil": 3.0,+ "condition": "H/HOZ 0.5oz inner layer copper"+ },+ "minDrill": {+ "mm": 0.15,+ "mil": 5.91+ },+ "minVia": {+ "drillMm": 0.2,+ "drillMil": 7.87,+ "padMm": 0.3278,+ "padMil": 12.91+ },+ "annularRing": {+ "viaMm": 0.0889,+ "viaMil": 3.5+ },+ "copperToBoardEdge": {+ "mm": 0.2,+ "mil": 7.87+ },+ "holeToHole": {+ "mm": 0.3048,+ "mil": 12.0+ },+ "maskExpansion": {+ "mm": 0.0381,+ "mil": 1.5+ },+ "maskSliver": {+ "mm": 0.0889,+ "mil": 3.5+ },+ "silkLineWidth": {+ "mm": 0.0762,+ "mil": 3.0+ },+ "silkToCopper": {+ "mm": 0.1524,+ "mil": 6.0+ },+ "minCopperClearance": {+ "mm": 0.1778,+ "mil": 7.0,+ "condition": "via to track"+ },+ "boardThicknessOptionsMm": [+ 0.6,+ 0.8,+ 1.0,+ 1.2,+ 1.6,+ 2.0,+ 2.5,+ 3.0,+ 3.2+ ],+ "copperWeightOptionsOz": [+ 0.5,+ 1,+ 2+ ],+ "surfaceFinishes": null,+ "maxBoardSize": {+ "xMm": 500,+ "yMm": 400+ },+ "notes": "Max dimension 500x400mm applies to 6 or more layers. Other limits as 2 layer entry.",+ "sources": [+ {+ "url": "https://www.nextpcb.com/pcb-capabilities",+ "dateRead": "2026-09-03"+ }+ ]+ },+ {+ "process": "advanced",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.0635,+ "mil": 2.5,+ "condition": "FR4 complex designs, general advanced"+ },+ "minSpacing": {+ "mm": 0.0635,+ "mil": 2.5,+ "condition": "FR4 complex designs, general advanced"+ },+ "minDrill": {+ "mm": 0.15,+ "mil": 5.91+ },+ "minVia": {+ "drillMm": 0.075,+ "drillMil": 2.95,+ "padMm": null,+ "padMil": null+ },+ "annularRing": null,+ "copperToBoardEdge": null,+ "holeToHole": null,+ "maskExpansion": null,+ "maskSliver": null,+ "silkLineWidth": null,+ "silkToCopper": null,+ "minCopperClearance": null,+ "boardThicknessOptionsMm": null,+ "copperWeightOptionsOz": null,+ "surfaceFinishes": [+ "HASL",+ "Lead Free HASL",+ "ENIG",+ "OSP",+ "Hard Gold",+ "Electrolytic Gold",+ "Gold Fingers",+ "Immersion Tin",+ "Immersion Silver",+ "ENEPIG"+ ],+ "maxBoardSize": {+ "xMm": 500,+ "yMm": 600+ },+ "notes": "Up to 32 layers, HDI III and any-layer HDI (ELIC). Trace/space by technology: HDI 2.0mil/2.0mil (0.0508mm), heavy copper 3oz 8mil/8mil (0.2032mm), FPC advanced 1.5mil/1.5mil (0.0381mm). Min laser drill microvia 0.075mm, microvia aspect ratio 0.8:1 to 1:1. Min mechanical drill 0.15mm quoted for rigid-flex. Copper up to 10oz outer (heavy copper section) and 4 to 6oz inner; summary banner states up to 6oz outer/4oz inner. Max board size 500x600mm quoted for high-Tg boards. Rigid-flex up to 20 rigid layers plus 8 flex layers. High-speed boards up to 40 layers. Drill aspect ratio up to 20:1. 0.15mm min drill also on rigid-flex section.",+ "sources": [+ {+ "url": "https://www.nextpcb.com/advanced-pcb-manufacturing-capabilities",+ "dateRead": "2026-09-03"+ }+ ]+ }+ ]+}
bridge-rs/vendor/pcb-design-rules/records/osh-park.jsonadded+451@@ -0,0 +1,451 @@+{+ "vendor": "OSH Park",+ "vendorSlug": "osh-park",+ "vendorUrl": null,+ "records": [+ {+ "process": "standard",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "1oz copper"+ },+ "minSpacing": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "1oz copper"+ },+ "minDrill": {+ "mm": 0.254,+ "mil": 10.0+ },+ "minVia": {+ "drillMm": 0.254,+ "drillMil": 10.0,+ "padMm": 0.508,+ "padMil": 20.0+ },+ "annularRing": {+ "viaMm": 0.127,+ "viaMil": 5.0+ },+ "copperToBoardEdge": {+ "mm": 0.381,+ "mil": 15.0+ },+ "holeToHole": {+ "mm": 0.127,+ "mil": 5.0+ },+ "maskExpansion": null,+ "maskSliver": {+ "mm": 0.1016,+ "mil": 4.0+ },+ "silkLineWidth": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "recommended minimum, 3 mil (0.0762mm) for short lines, text, graphics"+ },+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "different nets"+ },+ "boardThicknessOptionsMm": [+ 1.6+ ],+ "copperWeightOptionsOz": [+ 1+ ],+ "surfaceFinishes": [+ "ENIG"+ ],+ "maxBoardSize": {+ "xMm": 406.4,+ "yMm": 558.8+ },+ "notes": "Soldermask SMOBC purple both sides. Maximum soldermask alignment 3 mil (0.0762mm) covering retraction, expansion, and shift. Minimum board size 0.25in (6.35mm) square. Maximum soldermask web 4 mil is the minimum web, listed under maskSliver. Substrate 175Tg FR4. Via pad diameter not published. Minimum slot size 20 mil (0.508mm) drill slot only. Blind, buried, and filled+plated vias not supported.",+ "sources": [+ {+ "url": "https://docs.oshpark.com/services/two-layer/",+ "dateRead": "2026-09-03"+ },+ {+ "url": "https://docs.oshpark.com/services/",+ "dateRead": "2026-09-03"+ }+ ]+ },+ {+ "process": "standard",+ "layerCount": 4,+ "minTraceWidth": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "1oz outer, 0.5oz inner copper"+ },+ "minSpacing": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "1oz outer, 0.5oz inner copper"+ },+ "minDrill": {+ "mm": 0.254,+ "mil": 10.0+ },+ "minVia": {+ "drillMm": 0.254,+ "drillMil": 10.0,+ "padMm": 0.4572,+ "padMil": 18.0+ },+ "annularRing": {+ "viaMm": 0.1016,+ "viaMil": 4.0+ },+ "copperToBoardEdge": {+ "mm": 0.381,+ "mil": 15.0+ },+ "holeToHole": {+ "mm": 0.127,+ "mil": 5.0+ },+ "maskExpansion": null,+ "maskSliver": {+ "mm": 0.1016,+ "mil": 4.0+ },+ "silkLineWidth": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "recommended minimum, 3 mil (0.0762mm) for short lines, text, graphics"+ },+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "different nets"+ },+ "boardThicknessOptionsMm": [+ 1.6+ ],+ "copperWeightOptionsOz": [+ 1+ ],+ "surfaceFinishes": [+ "ENIG"+ ],+ "maxBoardSize": {+ "xMm": 406.4,+ "yMm": 558.8+ },+ "notes": "Copper weight is 1oz outer, 0.5oz inner. Plated drill to internal layer copper clearance 10 mil (0.254mm). Substrate 190Tg FR408-HR. Blind and buried vias not supported. Minimum board size 0.25in (6.35mm) square. Via pad diameter not published.",+ "sources": [+ {+ "url": "https://docs.oshpark.com/services/four-layer/",+ "dateRead": "2026-09-03"+ },+ {+ "url": "https://docs.oshpark.com/services/",+ "dateRead": "2026-09-03"+ }+ ]+ },+ {+ "process": "standard",+ "layerCount": 6,+ "minTraceWidth": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "1oz outer, 0.5oz inner copper"+ },+ "minSpacing": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "1oz outer, 0.5oz inner copper"+ },+ "minDrill": {+ "mm": 0.2032,+ "mil": 8.0+ },+ "minVia": {+ "drillMm": 0.2032,+ "drillMil": 8.0,+ "padMm": 0.4064,+ "padMil": 16.0+ },+ "annularRing": {+ "viaMm": 0.1016,+ "viaMil": 4.0+ },+ "copperToBoardEdge": {+ "mm": 0.381,+ "mil": 15.0+ },+ "holeToHole": {+ "mm": 0.127,+ "mil": 5.0+ },+ "maskExpansion": null,+ "maskSliver": {+ "mm": 0.1016,+ "mil": 4.0+ },+ "silkLineWidth": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "recommended minimum, 3 mil (0.0762mm) for short lines, text, graphics"+ },+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "different nets"+ },+ "boardThicknessOptionsMm": [+ 1.6+ ],+ "copperWeightOptionsOz": [+ 1+ ],+ "surfaceFinishes": [+ "ENIG"+ ],+ "maxBoardSize": {+ "xMm": 406.4,+ "yMm": 558.8+ },+ "notes": "Summary values from the services index page. Blind and buried vias not supported.",+ "sources": [+ {+ "url": "https://docs.oshpark.com/services/",+ "dateRead": "2026-09-03"+ }+ ]+ },+ {+ "process": "after-dark",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "1oz copper"+ },+ "minSpacing": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "1oz copper"+ },+ "minDrill": {+ "mm": 0.254,+ "mil": 10.0+ },+ "minVia": {+ "drillMm": 0.254,+ "drillMil": 10.0,+ "padMm": 0.508,+ "padMil": 20.0+ },+ "annularRing": {+ "viaMm": 0.127,+ "viaMil": 5.0+ },+ "copperToBoardEdge": {+ "mm": 0.381,+ "mil": 15.0+ },+ "holeToHole": {+ "mm": 0.127,+ "mil": 5.0+ },+ "maskExpansion": null,+ "maskSliver": {+ "mm": 0.1016,+ "mil": 4.0+ },+ "silkLineWidth": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "recommended minimum, 3 mil (0.0762mm) for short lines, text, graphics"+ },+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "different nets"+ },+ "boardThicknessOptionsMm": [+ 1.6+ ],+ "copperWeightOptionsOz": [+ 1+ ],+ "surfaceFinishes": [+ "ENIG"+ ],+ "maxBoardSize": {+ "xMm": 406.4,+ "yMm": 558.8+ },+ "notes": "Clear soldermask on black 180Tg FR4 (Ventec VT 447 b), opaque light blocking. Same copper and drill rules as standard 2 layer. Minimum board size 0.25in (6.35mm) square.",+ "sources": [+ {+ "url": "https://docs.oshpark.com/services/afterdark/",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "After Dark (clear mask on black substrate, 2 layer)"+ },+ {+ "process": "flex",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "1oz copper"+ },+ "minSpacing": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "1oz copper"+ },+ "minDrill": {+ "mm": 0.254,+ "mil": 10.0+ },+ "minVia": {+ "drillMm": 0.254,+ "drillMil": 10.0,+ "padMm": 0.508,+ "padMil": 20.0+ },+ "annularRing": {+ "viaMm": 0.127,+ "viaMil": 5.0+ },+ "copperToBoardEdge": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "required, copper within 15 mil (0.381mm) of edge will be fabbed but may be damaged in shipping"+ },+ "holeToHole": {+ "mm": 0.127,+ "mil": 5.0+ },+ "maskExpansion": null,+ "maskSliver": {+ "mm": 0.1016,+ "mil": 4.0+ },+ "silkLineWidth": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "recommended minimum, 3 mil (0.0762mm) for short lines, text, graphics"+ },+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "different nets"+ },+ "boardThicknessOptionsMm": [+ 0.1016+ ],+ "copperWeightOptionsOz": [+ 1+ ],+ "surfaceFinishes": [+ "ENIG"+ ],+ "maxBoardSize": {+ "xMm": 406.4,+ "yMm": 254.0+ },+ "notes": "Service temporarily suspended. Panasonic Felios polyimide, 4 mil (0.1016mm) core, clear soldermask. Recommended minimum flex strip width 250 mil (6.35mm). Minimum board size 0.25in (6.35mm) square.",+ "sources": [+ {+ "url": "https://docs.oshpark.com/services/flex/",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "Flex (polyimide, 2 layer, temporarily suspended)"+ },+ {+ "process": "2oz-0.8mm",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "2oz copper"+ },+ "minSpacing": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "2oz copper"+ },+ "minDrill": {+ "mm": 0.254,+ "mil": 10.0+ },+ "minVia": {+ "drillMm": 0.254,+ "drillMil": 10.0,+ "padMm": 0.508,+ "padMil": 20.0+ },+ "annularRing": {+ "viaMm": 0.127,+ "viaMil": 5.0+ },+ "copperToBoardEdge": {+ "mm": 0.381,+ "mil": 15.0+ },+ "holeToHole": {+ "mm": 0.127,+ "mil": 5.0+ },+ "maskExpansion": null,+ "maskSliver": {+ "mm": 0.1016,+ "mil": 4.0+ },+ "silkLineWidth": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "recommended minimum, 3 mil (0.0762mm) for short lines, text, graphics"+ },+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "different nets"+ },+ "boardThicknessOptionsMm": [+ 0.8+ ],+ "copperWeightOptionsOz": [+ 2+ ],+ "surfaceFinishes": [+ "ENIG"+ ],+ "maxBoardSize": {+ "xMm": 406.4,+ "yMm": 558.8+ },+ "notes": "0.032in (0.8mm) thick PCB with 2oz (2.8 mil, 70um) copper, 180Tg FR4 (Ventec VT-47). Minimum board size 0.25in (6.35mm) square.",+ "sources": [+ {+ "url": "https://docs.oshpark.com/services/two-layer-hhdc/",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "2oz 0.8mm (heavy copper thin 2 layer)"+ }+ ]+}
bridge-rs/vendor/pcb-design-rules/records/pcbway.jsonadded+616@@ -0,0 +1,616 @@+{+ "vendor": "PCBWay",+ "vendorSlug": "pcbway",+ "vendorUrl": null,+ "records": [+ {+ "process": "standard",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "prototype process, any copper weight; per copper weight outer layer limits are 0.5oz: 4/5mil, 1oz: 5/6mil, 2oz: 7/8mil, 3oz: 10/12mil (before compensation)"+ },+ "minSpacing": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "prototype process, different nets; per copper weight outer layer limits are 0.5oz: 4/5mil, 1oz: 5/6mil, 2oz: 7/8mil, 3oz: 10/12mil (before compensation)"+ },+ "minDrill": {+ "mm": 0.2,+ "mil": 7.87+ },+ "minVia": {+ "drillMm": 0.2,+ "drillMil": 7.87,+ "padMm": 0.454,+ "padMil": 17.87+ },+ "annularRing": {+ "viaMm": 0.127,+ "viaMil": 5.0,+ "note": "via, 1oz outer copper; 0.5oz via: 5mil, component hole 1oz: 10mil"+ },+ "copperToBoardEdge": {+ "mm": 0.25,+ "mil": 9.84,+ "condition": "line to board edge, CNC routing"+ },+ "holeToHole": {+ "mm": 0.2794,+ "mil": 11.0,+ "condition": "via hole to via hole, via diameter 0.45mm or less; component holes: 16mil (0.4064mm)"+ },+ "maskExpansion": {+ "mm": 0.0508,+ "mil": 2.0,+ "condition": "green solder mask opening"+ },+ "maskSliver": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "solder mask bridge, copper under 2oz; 2oz and above: 5mil (0.127mm)"+ },+ "silkLineWidth": {+ "mm": 0.15,+ "mil": 5.91,+ "condition": "minimum legend character width; minimum character height 0.8mm"+ },+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "different nets, prototype process"+ },+ "boardThicknessOptionsMm": [+ 0.4,+ 0.6,+ 0.8,+ 1.0,+ 1.2,+ 1.6,+ 2.0,+ 2.4+ ],+ "copperWeightOptionsOz": [+ 0.5,+ 1,+ 2,+ 3,+ 4+ ],+ "surfaceFinishes": [+ "HASL with lead",+ "HASL lead free",+ "Immersion gold (ENIG)",+ "OSP",+ "Immersion Tin"+ ],+ "maxBoardSize": {+ "xMm": 508.0,+ "yMm": 610.0+ },+ "notes": "Min board thickness 0.3mm, max board thickness 3.2mm. Prototype quote page lists max PCB size 500x1100mm and drill range 0.2 to 6.3mm. Grid trace 1oz: 9/11mil. Hole diameter tolerance PTH: plus or minus 0.075mm. Panel size max 20x24 inch.",+ "sources": [+ {+ "url": "https://www.pcbway.com/capabilities.html",+ "dateRead": "2026-09-03"+ },+ {+ "url": "https://m.pcbway.com/capabilities.html",+ "dateRead": "2026-09-03"+ }+ ]+ },+ {+ "process": "standard",+ "layerCount": 4,+ "minTraceWidth": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "inner layer, 1oz (35um) copper, before compensation; inner 0.5oz: 4mil, 2oz: 6mil, 3oz: 8mil. Outer layer 1oz: 5mil"+ },+ "minSpacing": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "inner layer, 1oz (35um) copper, before compensation; inner 0.5oz: 5mil (4/4mil class), 2oz: 8mil, 3oz: 11mil. Outer layer 1oz: 6mil"+ },+ "minDrill": {+ "mm": 0.2,+ "mil": 7.87+ },+ "minVia": {+ "drillMm": 0.2,+ "drillMil": 7.87,+ "padMm": 0.454,+ "padMil": 17.87+ },+ "annularRing": {+ "viaMm": 0.127,+ "viaMil": 5.0,+ "note": "via, 1oz outer copper; component hole 1oz: 10mil"+ },+ "copperToBoardEdge": {+ "mm": 0.25,+ "mil": 9.84,+ "condition": "line to board edge, CNC routing"+ },+ "holeToHole": {+ "mm": 0.2794,+ "mil": 11.0,+ "condition": "via hole to via hole, via diameter 0.45mm or less; component holes: 16mil (0.4064mm)"+ },+ "maskExpansion": {+ "mm": 0.0508,+ "mil": 2.0,+ "condition": "green solder mask opening"+ },+ "maskSliver": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "solder mask bridge, copper under 2oz; 2oz and above: 5mil (0.127mm)"+ },+ "silkLineWidth": {+ "mm": 0.15,+ "mil": 5.91,+ "condition": "minimum legend character width; minimum character height 0.8mm"+ },+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "different nets, inner layer 0.5oz base copper"+ },+ "boardThicknessOptionsMm": [+ 0.6,+ 0.8,+ 1.0,+ 1.2,+ 1.6,+ 2.0,+ 2.4+ ],+ "copperWeightOptionsOz": [+ 0.5,+ 1,+ 1.5,+ 2,+ 3,+ 4+ ],+ "surfaceFinishes": [+ "HASL with lead",+ "HASL lead free",+ "Immersion gold (ENIG)",+ "OSP",+ "Immersion Tin"+ ],+ "maxBoardSize": {+ "xMm": 508.0,+ "yMm": 600.0+ },+ "notes": "Min board thickness 0.6mm, max board thickness 3.2mm. Min inner layer isolation ring (hole to inner layer conductor, before compensation) 7mil (0.1778mm). Inner layer copper weight options 1oz or 1.5oz. Max aspect ratio 8:1.",+ "sources": [+ {+ "url": "https://www.pcbway.com/capabilities.html",+ "dateRead": "2026-09-03"+ }+ ]+ },+ {+ "process": "standard",+ "layerCount": 6,+ "minTraceWidth": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "inner layer, 1oz (35um) copper, before compensation; outer layer 1oz: 5mil"+ },+ "minSpacing": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "inner layer, 1oz (35um) copper, before compensation; inner 2oz: 8mil, 3oz: 11mil. Outer layer 1oz: 6mil"+ },+ "minDrill": {+ "mm": 0.2,+ "mil": 7.87+ },+ "minVia": {+ "drillMm": 0.2,+ "drillMil": 7.87,+ "padMm": 0.454,+ "padMil": 17.87+ },+ "annularRing": {+ "viaMm": 0.127,+ "viaMil": 5.0,+ "note": "via, 1oz outer copper; component hole 1oz: 10mil"+ },+ "copperToBoardEdge": {+ "mm": 0.25,+ "mil": 9.84,+ "condition": "line to board edge, CNC routing"+ },+ "holeToHole": {+ "mm": 0.2794,+ "mil": 11.0,+ "condition": "via hole to via hole, via diameter 0.45mm or less; component holes: 16mil (0.4064mm)"+ },+ "maskExpansion": {+ "mm": 0.0508,+ "mil": 2.0,+ "condition": "green solder mask opening"+ },+ "maskSliver": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "solder mask bridge, copper under 2oz; 2oz and above: 5mil (0.127mm)"+ },+ "silkLineWidth": {+ "mm": 0.15,+ "mil": 5.91,+ "condition": "minimum legend character width; minimum character height 0.8mm"+ },+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "different nets, inner layer 0.5oz base copper"+ },+ "boardThicknessOptionsMm": [+ 0.8,+ 1.0,+ 1.2,+ 1.6,+ 2.0,+ 2.4+ ],+ "copperWeightOptionsOz": [+ 0.5,+ 1,+ 1.5,+ 2,+ 3,+ 4+ ],+ "surfaceFinishes": [+ "HASL with lead",+ "HASL lead free",+ "Immersion gold (ENIG)",+ "OSP",+ "Immersion Tin"+ ],+ "maxBoardSize": {+ "xMm": 508.0,+ "yMm": 600.0+ },+ "notes": "Min board thickness 0.9mm, max board thickness 3.2mm. Min inner layer isolation ring (hole to inner layer conductor, before compensation) 8mil (0.2032mm). Inner layer copper weight options 1oz or 1.5oz. Max aspect ratio 8:1.",+ "sources": [+ {+ "url": "https://www.pcbway.com/capabilities.html",+ "dateRead": "2026-09-03"+ }+ ]+ },+ {+ "process": "advanced",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.0508,+ "mil": 2.0,+ "condition": "outer layer, 1/3 oz base copper, only part of traces on the board, not whole board; capabilities table advanced outer 0.5oz: 4mil with parts 3.5mil (0.0889mm) in BGA chip area"+ },+ "minSpacing": {+ "mm": 0.0508,+ "mil": 2.0,+ "condition": "outer layer, 1/3 oz base copper, partial traces only; capabilities table advanced outer 0.5oz: 4mil, parts 3.5mil"+ },+ "minDrill": {+ "mm": 0.15,+ "mil": 5.91,+ "condition": "CNC drilled; laser blind or buried via 0.1mm (3.937mil)"+ },+ "minVia": {+ "drillMm": 0.15,+ "drillMil": 5.91,+ "padMm": 0.3024,+ "padMil": 11.91+ },+ "annularRing": {+ "viaMm": 0.0762,+ "viaMil": 3.0,+ "note": "via; component hole annular ring 5mil (0.127mm)"+ },+ "copperToBoardEdge": {+ "mm": 0.2,+ "mil": 7.87,+ "condition": "line to board edge, CNC routing, advanced capability"+ },+ "holeToHole": {+ "mm": 0.3556,+ "mil": 14.0,+ "condition": "component hole to hole, advanced range 14 to 16mil"+ },+ "maskExpansion": {+ "mm": 0.0381,+ "mil": 1.5,+ "condition": "solder mask opening, advanced; 1mil (0.0254mm) only concentrated in BGA area"+ },+ "maskSliver": {+ "mm": 0.0889,+ "mil": 3.5,+ "condition": "min solder mask bridge width advanced, capabilities table range 3 to 4mil (0.0762 to 0.1016mm); copper 2oz and above: 4mil"+ },+ "silkLineWidth": {+ "mm": 0.15,+ "mil": 5.91,+ "condition": "minimum legend character width"+ },+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.0508,+ "mil": 2.0,+ "condition": "different nets, advanced process, partial traces"+ },+ "boardThicknessOptionsMm": [+ 0.4,+ 0.6,+ 0.8,+ 1.0,+ 1.2,+ 1.6,+ 2.0,+ 2.4+ ],+ "copperWeightOptionsOz": [+ 0.33,+ 0.5,+ 1,+ 2,+ 3,+ 4,+ 6,+ 8+ ],+ "surfaceFinishes": [+ "ENIG",+ "HAL",+ "HAL lead free",+ "OSP",+ "Immersion Sn",+ "Immersion silver",+ "Plating hard gold",+ "Plating silver"+ ],+ "maxBoardSize": {+ "xMm": 609.0,+ "yMm": 889.0+ },+ "notes": "Advanced page does not distinguish limits by layer count for 2 layers. Min board thickness 0.25mm. Max aspect ratio 20:1. Max layer count 64. Min BGA pad diameter 8mil, min BGA pitch 0.4mm. Min base copper 1/3 oz, max finished copper 8 oz. Min insulating layer thickness 2mil. Max board thickness 4.5mm.",+ "sources": [+ {+ "url": "https://www.pcbway.com/advanced-pcb-capabilities.html",+ "dateRead": "2026-09-03"+ },+ {+ "url": "https://www.pcbway.com/capabilities.html",+ "dateRead": "2026-09-03"+ }+ ]+ },+ {+ "process": "advanced",+ "layerCount": 4,+ "minTraceWidth": {+ "mm": 0.0508,+ "mil": 2.0,+ "condition": "inner layer 2/2mil with H/H oz base copper (partial traces only); capabilities table advanced inner 0.5oz: 4mil, parts 3.5mil. Outer layer 2/2mil with 1/3 oz base copper"+ },+ "minSpacing": {+ "mm": 0.0508,+ "mil": 2.0,+ "condition": "inner layer H/H oz or outer 1/3 oz base copper, partial traces only; capabilities table advanced inner 0.5oz: 3.5mil spacing (4/3.5mil), outer 0.5oz: 4mil"+ },+ "minDrill": {+ "mm": 0.15,+ "mil": 5.91,+ "condition": "CNC drilled; laser blind or buried via 0.1mm (3.937mil)"+ },+ "minVia": {+ "drillMm": 0.15,+ "drillMil": 5.91,+ "padMm": 0.3024,+ "padMil": 11.91+ },+ "annularRing": {+ "viaMm": 0.0762,+ "viaMil": 3.0,+ "note": "via; component hole annular ring 5mil (0.127mm)"+ },+ "copperToBoardEdge": {+ "mm": 0.2,+ "mil": 7.87,+ "condition": "line to board edge, CNC routing, advanced capability"+ },+ "holeToHole": {+ "mm": 0.3556,+ "mil": 14.0,+ "condition": "component hole to hole, advanced range 14 to 16mil"+ },+ "maskExpansion": {+ "mm": 0.0381,+ "mil": 1.5,+ "condition": "solder mask opening, advanced; 1mil (0.0254mm) only concentrated in BGA area"+ },+ "maskSliver": {+ "mm": 0.0889,+ "mil": 3.5,+ "condition": "min solder mask bridge width advanced, range 3 to 4mil (0.0762 to 0.1016mm); copper 2oz and above: 4mil"+ },+ "silkLineWidth": {+ "mm": 0.15,+ "mil": 5.91,+ "condition": "minimum legend character width"+ },+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.0508,+ "mil": 2.0,+ "condition": "different nets, hole to inner layer conductor 6mil (0.1524mm) advanced"+ },+ "boardThicknessOptionsMm": [+ 0.4,+ 0.6,+ 0.8,+ 1.0,+ 1.2,+ 1.6,+ 2.0,+ 2.4+ ],+ "copperWeightOptionsOz": [+ 0.33,+ 0.5,+ 1,+ 2,+ 3,+ 4,+ 6,+ 8+ ],+ "surfaceFinishes": [+ "ENIG",+ "HAL",+ "HAL lead free",+ "OSP",+ "Immersion Sn",+ "Immersion silver",+ "Plating hard gold",+ "Plating silver"+ ],+ "maxBoardSize": {+ "xMm": 609.0,+ "yMm": 889.0+ },+ "notes": "Advanced page does not distinguish limits by layer count; same published values apply to 4 layers. Min board thickness 0.4mm (advanced), standard 0.6mm. Min inner layer isolation ring advanced 6mil (0.1524mm) before compensation. Max aspect ratio 20:1. HDI 1 to 7 steps. Max board thickness 4.5mm.",+ "sources": [+ {+ "url": "https://www.pcbway.com/advanced-pcb-capabilities.html",+ "dateRead": "2026-09-03"+ },+ {+ "url": "https://www.pcbway.com/capabilities.html",+ "dateRead": "2026-09-03"+ }+ ]+ },+ {+ "process": "advanced",+ "layerCount": 6,+ "minTraceWidth": {+ "mm": 0.0508,+ "mil": 2.0,+ "condition": "inner layer 2/2mil with H/H oz base copper (partial traces only); capabilities table advanced inner 0.5oz: 4mil, parts 3.5mil. Outer layer 2/2mil with 1/3 oz base copper"+ },+ "minSpacing": {+ "mm": 0.0508,+ "mil": 2.0,+ "condition": "inner layer H/H oz or outer 1/3 oz base copper, partial traces only; capabilities table advanced inner 0.5oz: 3.5mil spacing, outer 0.5oz: 4mil"+ },+ "minDrill": {+ "mm": 0.15,+ "mil": 5.91,+ "condition": "CNC drilled; laser blind or buried via 0.1mm (3.937mil)"+ },+ "minVia": {+ "drillMm": 0.15,+ "drillMil": 5.91,+ "padMm": 0.3024,+ "padMil": 11.91+ },+ "annularRing": {+ "viaMm": 0.0762,+ "viaMil": 3.0,+ "note": "via; component hole annular ring 5mil (0.127mm)"+ },+ "copperToBoardEdge": {+ "mm": 0.2,+ "mil": 7.87,+ "condition": "line to board edge, CNC routing, advanced capability"+ },+ "holeToHole": {+ "mm": 0.3556,+ "mil": 14.0,+ "condition": "component hole to hole, advanced range 14 to 16mil"+ },+ "maskExpansion": {+ "mm": 0.0381,+ "mil": 1.5,+ "condition": "solder mask opening, advanced; 1mil (0.0254mm) only concentrated in BGA area"+ },+ "maskSliver": {+ "mm": 0.0889,+ "mil": 3.5,+ "condition": "min solder mask bridge width advanced, range 3 to 4mil (0.0762 to 0.1016mm); copper 2oz and above: 4mil"+ },+ "silkLineWidth": {+ "mm": 0.15,+ "mil": 5.91,+ "condition": "minimum legend character width"+ },+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.0508,+ "mil": 2.0,+ "condition": "different nets, hole to inner layer conductor 6mil (0.1524mm) advanced"+ },+ "boardThicknessOptionsMm": [+ 0.7,+ 0.8,+ 1.0,+ 1.2,+ 1.6,+ 2.0,+ 2.4+ ],+ "copperWeightOptionsOz": [+ 0.33,+ 0.5,+ 1,+ 2,+ 3,+ 4,+ 6,+ 8+ ],+ "surfaceFinishes": [+ "ENIG",+ "HAL",+ "HAL lead free",+ "OSP",+ "Immersion Sn",+ "Immersion silver",+ "Plating hard gold",+ "Plating silver"+ ],+ "maxBoardSize": {+ "xMm": 609.0,+ "yMm": 889.0+ },+ "notes": "Advanced page does not distinguish limits by layer count; same published values apply to 6 layers. Min board thickness 0.7mm (advanced), standard 0.9mm. Min inner layer isolation ring advanced 6.5mil (0.1651mm) before compensation. Max aspect ratio 20:1. HDI 1 to 7 steps. Max board thickness 4.5mm.",+ "sources": [+ {+ "url": "https://www.pcbway.com/advanced-pcb-capabilities.html",+ "dateRead": "2026-09-03"+ },+ {+ "url": "https://www.pcbway.com/capabilities.html",+ "dateRead": "2026-09-03"+ }+ ]+ }+ ],+ "unreachable": [+ "https://www.pcbway.com/pcb_prototype.html",+ "https://www.pcbway.com/advanced-pcb.html"+ ]+}
bridge-rs/vendor/pcb-design-rules/records/seeed-fusion.jsonadded+468@@ -0,0 +1,468 @@+{+ "vendor": "Seeed Fusion",+ "vendorSlug": "seeed-fusion",+ "vendorUrl": null,+ "records": [+ {+ "process": "standard",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "1 oz copper, 4/4 mil option"+ },+ "minSpacing": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "1 oz copper, 4/4 mil option"+ },+ "minDrill": {+ "mm": 0.2,+ "mil": 7.87+ },+ "minVia": {+ "drillMm": 0.2,+ "drillMil": 7.87,+ "padMm": 0.4,+ "padMil": 15.75+ },+ "annularRing": {+ "viaMm": 0.1,+ "viaMil": 3.94,+ "note": "vias, PTH is 0.152 mm (5.9843 mil)"+ },+ "copperToBoardEdge": {+ "mm": 0.3,+ "mil": 11.81+ },+ "holeToHole": {+ "mm": 0.3,+ "mil": 11.81,+ "condition": "vias, PTH is 0.45 mm (17.7165 mil)"+ },+ "maskExpansion": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "solder mask dam, 0.1 mm option, green; 0.13 mm (5.1181 mil) other colors; normal dam 0.32 mm (12.5984 mil) green, 0.35 mm (13.7795 mil) other colors"+ },+ "maskSliver": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "min solder mask dam, green, 0.1 mm option"+ },+ "silkLineWidth": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "min silkscreen trace width; min character height 0.5842 mm (23 mil)"+ },+ "silkToCopper": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "pad to silkscreen clearance"+ },+ "minCopperClearance": {+ "mm": 0.3048,+ "mil": 12.0,+ "condition": "plated holes to traces; inner trace to plated holes 0.2 mm (7.874 mil)"+ },+ "boardThicknessOptionsMm": [+ 0.6,+ 0.8,+ 1.0,+ 1.2,+ 1.6,+ 2.0,+ 2.5,+ 3.0+ ],+ "copperWeightOptionsOz": [+ 1,+ 2,+ 3+ ],+ "surfaceFinishes": [+ "HASL",+ "HASL lead-free",+ "ENIG",+ "OSP",+ "Hard Gold"+ ],+ "maxBoardSize": {+ "xMm": 500.0,+ "yMm": 500.0+ },+ "notes": "Trace width/spacing by copper weight: 1 oz: 4/4, 5/5, or 6/6 mil options (0.1016/0.127/0.1524 mm); 2 oz: 10/10 mil (0.254 mm); 3 oz: 15/15 mil (0.381 mm). RF coil designs require 6/6 mil but select 4/4 mil option. Min board size 10 x 10 mm. Drill ranges: NPTH 0.2 to 6.3 mm, PTH 0.2 to 5.8 mm, via holes 0.2 to 0.5 mm (vias 0.3 mm and smaller guarantee full mask tenting). Min via pad not published directly, min annular ring 0.1 mm implies pad = drill + 0.2 mm. Min plated slot 0.65 mm, non-plated slot 0.8 mm. BGA pitch guidance: 0.45 mm pitch with 6/6 mil, 0.35 mm with 5/5 mil, 0.25 mm with 4/4 mil.",+ "sources": [+ {+ "url": "https://support.seeed.cc/portal/en/kb/articles/fusion-pcb-specification",+ "dateRead": "2026-09-03"+ },+ {+ "url": "https://www.seeedstudio.com/fusion_pcb.html",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "standard (Quickturn) PCB"+ },+ {+ "process": "standard",+ "layerCount": 4,+ "minTraceWidth": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "outer layer, 1 oz copper, 4/4 mil option"+ },+ "minSpacing": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "outer layer, 1 oz copper, 4/4 mil option"+ },+ "minDrill": {+ "mm": 0.2,+ "mil": 7.87+ },+ "minVia": {+ "drillMm": 0.2,+ "drillMil": 7.87,+ "padMm": 0.4,+ "padMil": 15.75+ },+ "annularRing": {+ "viaMm": 0.1,+ "viaMil": 3.94,+ "note": "vias, PTH is 0.152 mm (5.9843 mil)"+ },+ "copperToBoardEdge": {+ "mm": 0.3,+ "mil": 11.81+ },+ "holeToHole": {+ "mm": 0.3,+ "mil": 11.81,+ "condition": "vias, PTH is 0.45 mm (17.7165 mil)"+ },+ "maskExpansion": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "solder mask dam, 0.1 mm option, green; 0.13 mm (5.1181 mil) other colors"+ },+ "maskSliver": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "min solder mask dam, green, 0.1 mm option"+ },+ "silkLineWidth": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "min silkscreen trace width; min character height 0.5842 mm (23 mil)"+ },+ "silkToCopper": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "pad to silkscreen clearance"+ },+ "minCopperClearance": {+ "mm": 0.3048,+ "mil": 12.0,+ "condition": "plated holes to traces; min distance inner trace to plated holes 0.2 mm (7.874 mil)"+ },+ "boardThicknessOptionsMm": [+ 0.8,+ 1.0,+ 1.2,+ 1.6,+ 2.0,+ 2.5,+ 3.0+ ],+ "copperWeightOptionsOz": [+ 1,+ 2,+ 3+ ],+ "surfaceFinishes": [+ "HASL",+ "HASL lead-free",+ "ENIG",+ "OSP",+ "Hard Gold"+ ],+ "maxBoardSize": {+ "xMm": 500.0,+ "yMm": 500.0+ },+ "notes": "Minimum trace width in inner layers for 4 layer boards: 0.15 mm (6 mil). Inner layer base copper 0.017 mm (0.5 oz), outer 0.035 to 0.07 mm (1 to 2 oz). Same trace width/spacing options by copper weight as 2 layer: 1 oz 4/4, 5/5, 6/6 mil; 2 oz 10/10 mil; 3 oz 15/15 mil. Min board size 10 x 10 mm. Castellated holes (plated half-holes) min 0.50 mm.",+ "sources": [+ {+ "url": "https://support.seeed.cc/portal/en/kb/articles/fusion-pcb-specification",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "standard (Quickturn) PCB"+ },+ {+ "process": "standard",+ "layerCount": 6,+ "minTraceWidth": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "outer layer, 1 oz copper, 4/4 mil option"+ },+ "minSpacing": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "outer layer, 1 oz copper, 4/4 mil option"+ },+ "minDrill": {+ "mm": 0.2,+ "mil": 7.87+ },+ "minVia": {+ "drillMm": 0.2,+ "drillMil": 7.87,+ "padMm": 0.4,+ "padMil": 15.75+ },+ "annularRing": {+ "viaMm": 0.1,+ "viaMil": 3.94,+ "note": "vias, PTH is 0.152 mm (5.9843 mil)"+ },+ "copperToBoardEdge": {+ "mm": 0.3,+ "mil": 11.81+ },+ "holeToHole": {+ "mm": 0.3,+ "mil": 11.81,+ "condition": "vias, PTH is 0.45 mm (17.7165 mil)"+ },+ "maskExpansion": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "solder mask dam, 0.1 mm option, green; 0.13 mm (5.1181 mil) other colors"+ },+ "maskSliver": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "min solder mask dam, green, 0.1 mm option"+ },+ "silkLineWidth": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "min silkscreen trace width; min character height 0.5842 mm (23 mil)"+ },+ "silkToCopper": {+ "mm": 0.1524,+ "mil": 6.0,+ "condition": "pad to silkscreen clearance"+ },+ "minCopperClearance": {+ "mm": 0.3048,+ "mil": 12.0,+ "condition": "plated holes to traces"+ },+ "boardThicknessOptionsMm": [+ 1.0,+ 1.2,+ 1.6,+ 2.0,+ 2.5,+ 3.0+ ],+ "copperWeightOptionsOz": [+ 1,+ 2,+ 3+ ],+ "surfaceFinishes": [+ "HASL",+ "HASL lead-free",+ "ENIG",+ "OSP",+ "Hard Gold"+ ],+ "maxBoardSize": {+ "xMm": 500.0,+ "yMm": 500.0+ },+ "notes": "Seeed standard service supports 1 to 6 layers (layers table extends to 16). Board thickness options listed are for 6 and 8 layer boards. Inner layer trace width limit not separately published for 6 layer; 4 layer value is 0.15 mm (6 mil).",+ "sources": [+ {+ "url": "https://support.seeed.cc/portal/en/kb/articles/fusion-pcb-specification",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "standard (Quickturn) PCB"+ },+ {+ "process": "advanced",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "outer layer, 1 oz copper"+ },+ "minSpacing": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "outer layer, 1 oz copper"+ },+ "minDrill": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "minimum mechanical via diameter, PCB thickness 0.6 mm or less"+ },+ "minVia": {+ "drillMm": 0.1,+ "drillMil": 3.94,+ "padMm": 0.3032,+ "padMil": 11.94+ },+ "annularRing": {+ "viaMm": 0.1016,+ "viaMil": 4.0,+ "note": "vias, through-holes 0.2032 mm (8 mil)"+ },+ "copperToBoardEdge": null,+ "holeToHole": {+ "mm": 0.2286,+ "mil": 9.0,+ "condition": "via wall to via wall, different nets, prototype; 12 mil (0.3048 mm) mass production"+ },+ "maskExpansion": {+ "mm": 0.08,+ "mil": 3.15,+ "condition": "min solder mask dam, green; 0.12 mm (4.7244 mil) other colors"+ },+ "maskSliver": {+ "mm": 0.08,+ "mil": 3.15,+ "condition": "min solder mask dam, green"+ },+ "silkLineWidth": null,+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.2286,+ "mil": 9.0,+ "condition": "via to traces inner layers, prototype, different nets; 12 mil (0.3048 mm) mass production"+ },+ "boardThicknessOptionsMm": [],+ "copperWeightOptionsOz": [+ 0.33,+ 0.5,+ 1,+ 2,+ 3,+ 4,+ 5,+ 6+ ],+ "surfaceFinishes": [+ "HASL",+ "HASL lead-free",+ "ENIG",+ "Hard Gold",+ "Immersion Tin",+ "Immersion Silver",+ "OSP"+ ],+ "maxBoardSize": {+ "xMm": null,+ "yMm": null+ },+ "notes": "Outer layer trace/spacing by copper weight: 1/3 oz 3/3 mil (0.0762 mm), 0.5 oz 4/4 mil (0.1016 mm), 1 oz 5/5 mil (0.127 mm), 2 oz 6/8 mil (0.1524/0.2032 mm), 3 oz 7/10 mil (0.1778/0.254 mm), 4 oz 8/13 mil (0.2032/0.3302 mm), 5 oz 10/16 mil (0.254/0.4064 mm), 6 oz 12/18 mil (0.3048/0.4572 mm). Board thickness rigid 0.2 to 8.0 mm. Min castellated hole diameter 0.35 mm. Plugged vias finished diameter 0.15 to 0.8 mm. HDI stacks 1+n+1, 1+1+n+1+1, 2+n+2. Outline, V-cut and milling slot tolerance 0.10 mm. Solder mask colors include purple, matte green, customized. Board size limits not published on this page.",+ "sources": [+ {+ "url": "https://support.seeed.cc/portal/en/kb/articles/fusion-advanced-pcb-specification",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "advanced PCB"+ },+ {+ "process": "advanced",+ "layerCount": 4,+ "minTraceWidth": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "inner layer, 1 oz copper"+ },+ "minSpacing": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "inner layer, 1 oz copper"+ },+ "minDrill": {+ "mm": 0.1,+ "mil": 3.94,+ "condition": "minimum mechanical via diameter, PCB thickness 0.6 mm or less"+ },+ "minVia": {+ "drillMm": 0.1,+ "drillMil": 3.94,+ "padMm": 0.3032,+ "padMil": 11.94+ },+ "annularRing": {+ "viaMm": 0.1016,+ "viaMil": 4.0,+ "note": "vias, through-holes 0.2032 mm (8 mil)"+ },+ "copperToBoardEdge": null,+ "holeToHole": {+ "mm": 0.2286,+ "mil": 9.0,+ "condition": "via wall to via wall, different nets, prototype; 12 mil (0.3048 mm) mass production"+ },+ "maskExpansion": {+ "mm": 0.08,+ "mil": 3.15,+ "condition": "min solder mask dam, green; 0.12 mm (4.7244 mil) other colors"+ },+ "maskSliver": {+ "mm": 0.08,+ "mil": 3.15,+ "condition": "min solder mask dam, green"+ },+ "silkLineWidth": null,+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.2286,+ "mil": 9.0,+ "condition": "via to traces inner layers, prototype, different nets; 12 mil (0.3048 mm) mass production"+ },+ "boardThicknessOptionsMm": [],+ "copperWeightOptionsOz": [+ 0.5,+ 1,+ 2,+ 3,+ 4,+ 5,+ 6+ ],+ "surfaceFinishes": [+ "HASL",+ "HASL lead-free",+ "ENIG",+ "Hard Gold",+ "Immersion Tin",+ "Immersion Silver",+ "OSP"+ ],+ "maxBoardSize": {+ "xMm": null,+ "yMm": null+ },+ "notes": "Inner layer trace/spacing by copper weight: 0.5 oz 3/3 mil (0.0762 mm), 1 oz 4/4 mil (0.1016 mm), 2 oz 5/6 mil (0.127/0.1524 mm), 3 oz 7/9 mil (0.1778/0.2286 mm), 4 oz 8/12 mil (0.2032/0.3048 mm), 5 oz 10/15 mil (0.254/0.381 mm), 6 oz 12/18 mil (0.3048/0.4572 mm). For outer layer values see the 2 layer entry. FR4 1 to 30 layers, rigid-flex up to 36 rigid layers, board thickness rigid 0.2 to 8.0 mm. Back drilling diameter 0.5 to 6.3 mm, depth tolerance 0.10 mm. Min BGA pad diameter 7 mil (0.1778 mm) with 4/4 mil trace/spacing.",+ "sources": [+ {+ "url": "https://support.seeed.cc/portal/en/kb/articles/fusion-advanced-pcb-specification",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "advanced PCB"+ }+ ]+}
bridge-rs/vendor/pcb-design-rules/records/sierra-circuits.jsonadded+266@@ -0,0 +1,266 @@+{+ "vendor": "Sierra Circuits",+ "vendorSlug": "sierra-circuits",+ "vendorUrl": null,+ "records": [+ {+ "process": "standard",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "STANDARD tier"+ },+ "minSpacing": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "STANDARD tier"+ },+ "minDrill": {+ "mm": 0.15,+ "mil": 5.9+ },+ "minVia": {+ "drillMm": 0.15,+ "drillMil": 5.9,+ "padMm": 0.4547,+ "padMil": 17.9+ },+ "annularRing": {+ "viaMm": 0.0254,+ "viaMil": 1.0+ },+ "copperToBoardEdge": {+ "mm": 0.254,+ "mil": 10.0,+ "condition": "V-score edge to copper, STANDARD tier"+ },+ "holeToHole": null,+ "maskExpansion": null,+ "maskSliver": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "solder mask min dam size, based on green solder mask color"+ },+ "silkLineWidth": null,+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "different nets, STANDARD tier"+ },+ "boardThicknessOptionsMm": [+ 0.254,+ 7.62+ ],+ "copperWeightOptionsOz": [+ 4+ ],+ "surfaceFinishes": [+ "HASL",+ "Lead-Free HASL",+ "OSP (Shikoku F2)",+ "OSP (Entek)",+ "ENIG",+ "Immersion Silver",+ "Electrolytic Soft Gold",+ "Electrolytic Hard Gold",+ "Selective Gold"+ ],+ "maxBoardSize": {+ "xMm": 304.8,+ "yMm": 457.2+ },+ "notes": "Values from the rigid PCB STANDARD tier table, published per process tier, not broken out by layer count, so 2-layer uses the same STANDARD values. Min board thickness 0.010 in (0.254 mm), max 0.300 in (7.62 mm). Max finished copper: outer layer 4 oz, inner layer 4 oz, min starting foil 3 microns. Min via pad derived from published process pad formula D plus 0.012 in, i.e. min drill 5.9 mil plus 12 mil. Annular ring 1 mil as stated in the process pad row. Max panel size STANDARD tier 12 x 18 in. Smallest laser drill 5 mil (0.127 mm), min finished hole 4 mil (0.102 mm). Solder mask registration 2 mil (0.0508 mm), solder mask feature tolerance 1.5 mil (0.0381 mm).",+ "sources": [+ {+ "url": "https://www.protoexpress.com/products/rigid-pcb/",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "standard rigid PCB (Sierra Circuits fabrication STANDARD tier)"+ },+ {+ "process": "standard",+ "layerCount": 4,+ "minTraceWidth": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "STANDARD tier"+ },+ "minSpacing": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "STANDARD tier"+ },+ "minDrill": {+ "mm": 0.15,+ "mil": 5.9+ },+ "minVia": {+ "drillMm": 0.15,+ "drillMil": 5.9,+ "padMm": 0.4547,+ "padMil": 17.9+ },+ "annularRing": {+ "viaMm": 0.0254,+ "viaMil": 1.0+ },+ "copperToBoardEdge": {+ "mm": 0.254,+ "mil": 10.0,+ "condition": "V-score edge to copper, STANDARD tier"+ },+ "holeToHole": null,+ "maskExpansion": null,+ "maskSliver": {+ "mm": 0.127,+ "mil": 5.0,+ "condition": "solder mask min dam size, based on green solder mask color"+ },+ "silkLineWidth": null,+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "different nets, STANDARD tier"+ },+ "boardThicknessOptionsMm": [+ 0.254,+ 7.62+ ],+ "copperWeightOptionsOz": [+ 4+ ],+ "surfaceFinishes": [+ "HASL",+ "Lead-Free HASL",+ "OSP (Shikoku F2)",+ "OSP (Entek)",+ "ENIG",+ "Immersion Silver",+ "Electrolytic Soft Gold",+ "Electrolytic Hard Gold",+ "Selective Gold"+ ],+ "maxBoardSize": {+ "xMm": 304.8,+ "yMm": 457.2+ },+ "notes": "Same STANDARD tier table as 2-layer, Sierra does not publish separate 4-layer limits on this page. Blind and buried vias available. Controlled impedance tolerance 10 percent STANDARD tier.",+ "sources": [+ {+ "url": "https://www.protoexpress.com/products/rigid-pcb/",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "standard rigid PCB (Sierra Circuits fabrication STANDARD tier)"+ },+ {+ "process": "turnkey-pro",+ "layerCount": 2,+ "minTraceWidth": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "Turnkey PRO quick-turn prototype"+ },+ "minSpacing": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "Turnkey PRO quick-turn prototype"+ },+ "minDrill": null,+ "minVia": null,+ "annularRing": null,+ "copperToBoardEdge": null,+ "holeToHole": null,+ "maskExpansion": null,+ "maskSliver": null,+ "silkLineWidth": null,+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "different nets, Turnkey PRO"+ },+ "boardThicknessOptionsMm": [+ 0.7874,+ 1.5748,+ 2.3622+ ],+ "copperWeightOptionsOz": [+ 1,+ 2+ ],+ "surfaceFinishes": [+ "ENIG",+ "HASL"+ ],+ "maxBoardSize": null,+ "notes": "Online Turnkey PRO service: layer count 2, 4, 6, 8; board thickness 0.031, 0.062, 0.093 in; inner layer copper 1 oz, outer layer finished copper 1 oz or 2 oz; FR-4 lead-free; IPC-6012 Class 2. No drill or via numbers published for this tier on the page.",+ "sources": [+ {+ "url": "https://www.protoexpress.com/",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "Turnkey PRO prototype online service (2, 4, 6, 8 layer quick-turn)"+ },+ {+ "process": "turnkey-pro",+ "layerCount": 4,+ "minTraceWidth": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "Turnkey PRO quick-turn prototype"+ },+ "minSpacing": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "Turnkey PRO quick-turn prototype"+ },+ "minDrill": null,+ "minVia": null,+ "annularRing": null,+ "copperToBoardEdge": null,+ "holeToHole": null,+ "maskExpansion": null,+ "maskSliver": null,+ "silkLineWidth": null,+ "silkToCopper": null,+ "minCopperClearance": {+ "mm": 0.1016,+ "mil": 4.0,+ "condition": "different nets, Turnkey PRO"+ },+ "boardThicknessOptionsMm": [+ 0.7874,+ 1.5748,+ 2.3622+ ],+ "copperWeightOptionsOz": [+ 1,+ 2+ ],+ "surfaceFinishes": [+ "ENIG",+ "HASL"+ ],+ "maxBoardSize": null,+ "notes": "Same Turnkey PRO limits as 2-layer, page does not differentiate by layer count.",+ "sources": [+ {+ "url": "https://www.protoexpress.com/",+ "dateRead": "2026-09-03"+ }+ ],+ "processDetail": "Turnkey PRO prototype online service (2, 4, 6, 8 layer quick-turn)"+ }+ ],+ "unreachable": [+ "https://www.sierracircuits.com/pcb-manufacturing-capabilities (404)",+ "https://www.sierracircuits.com/pcb-capabilities (404)",+ "https://www.protoexpress.com/pcb-capabilities/ (404)"+ ]+}
src/agent/AdomAgent.pas.tmpl+1−1@@ -4687,7 +4687,7 @@ Begin While (L <> Nil) And (N < 64) Do Begin If S <> '' Then S := S + ',';- S := S + '{' + JStr('name', L.Name) + ',' + JRaw('copperUm', IntToStr(Round(CoordToMils(L.CopperThickness) * 25.4)));+ S := S + '{' + JStr('name', L.Name) + ',' + JRaw('layerId', IntToStr(L.V6_LayerID)) + ',' + JRaw('copperUm', IntToStr(Round(CoordToMils(L.CopperThickness) * 25.4))); If (L.V6_LayerID >= eInternalPlane1) And (L.V6_LayerID <= eInternalPlane16) Then S := S + ',' + JStr('kind', 'plane') + ',' + JStr('net', L.NetName) + ',' + JRaw('plane', IntToStr(L.V6_LayerID - eInternalPlane1 + 1)) Else If (L.V6_LayerID >= eMidLayer1) And (L.V6_LayerID <= eMidLayer30) Then