by adom
adom-lbr — the EDA library translator. Bring a component in from any supported EDA tool and convert it to any other (KiCad ⇄ Altium ⇄ EAGLE/Fusion) through one canonical adom-lbr JSON — symbol + footprint + 3D + pin↔pad map. Altium is written natively (no Altium needed). Includes the adom-lbr Manager: browse wiki components and view symbol/footprint/3D + the per-EDA layer stackup.
← Commit history
2.47.6: no_connect pins become EAGLE nc; boxed symbols keep pin names under artwork (#33 #34); GH 4d38f6e
11 files changed
+262−10
CHANGELOG.md+4@@ -1,5 +1,9 @@ # Changelog +## 2.47.6 (2026-10-21)+- `generate` writes a KiCad `no_connect` pin as EAGLE `direction="nc"`. It used to fall through to `io`, so Fusion's ERC treated an unconnected pin (a connector's mounting tab, say) as a bidirectional signal. All twelve KiCad pin types are mapped (`free` becomes `pas`), an unrecognized type is named in a `WARN: [pin-type-unmapped]` line, and importing an EAGLE `nc` pin writes KiCad's `no_connect`. (#33)+- A boxed symbol keeps its pin names when it carries artwork inside the box, such as adom-symbol's chip outline. Names are hidden only on small drawings like LEDs and crystals, whose pins do not end on a body rectangle. (#34)+ ## 2.47.5 (2026-10-12) - `generate` refuses a supplied footprint that has no pads (`ERROR: [ZERO_PAD_FOOTPRINT]`, exit 2, nothing written) instead of inventing copper. A mechanical-only footprint for an off-board part (a flying-lead sensor whose leads land on a separate connector) used to come out with two touching placeholder SMD pads and only a lint warning. A zero-pad package variant is refused the same way, and the Manager returns a structured error. Generating with no `--fp` still makes the documented placeholder. (John)
Cargo.lock+1−1@@ -10,7 +10,7 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "adom-lbr"-version = "2.47.5"+version = "2.47.6" dependencies = [ "altium-codec", "anyhow",
Cargo.toml+1−1@@ -1,6 +1,6 @@ [package] name = "adom-lbr"-version = "2.47.5"+version = "2.47.6" edition = "2021" description = "adom-lbr generator / EDA translator: the canonical adom-lbr JSON is the hub, with native converters to Altium (.SchLib/.PcbLib/.IntLib), EAGLE/Fusion (.lbr), and KiCad. Altium output is written natively — no Altium needed at conversion time."
VERSION+1−1@@ -1 +1 @@-2.47.5+2.47.6
bin/adom-lbr⋯ 1 unchanged line ⋯
package.json+1−1@@ -1,6 +1,6 @@ { "slug": "adom-lbr",- "version": "2.47.5",+ "version": "2.47.6", "type": "app", "description": "adom-lbr \u2014 the EDA library translator. Bring a component in from any supported EDA tool and convert it to any other (KiCad \u21c4 Altium \u21c4 EAGLE/Fusion) through one canonical adom-lbr JSON \u2014 symbol + footprint + 3D + pin\u2194pad map. Altium is written natively (no Altium needed). Includes the adom-lbr Manager: browse wiki components and view symbol/footprint/3D + the per-EDA layer stackup.", "dependencies": {},
page.json+1−1@@ -1,6 +1,6 @@ { "slug": "adom-lbr",- "version": "2.47.5",+ "version": "2.47.6", "type": "app", "description": "adom-lbr — the EDA library translator. Bring a component in from any supported EDA tool and convert it to any other (KiCad ⇄ Altium ⇄ EAGLE/Fusion) through one canonical adom-lbr JSON — symbol + footprint + 3D + pin↔pad map. Altium is written natively (no Altium needed). Includes the adom-lbr Manager: browse wiki components and view symbol/footprint/3D + the per-EDA layer stackup.", "dependencies": {},
src/main.rs+107−5@@ -682,7 +682,7 @@ fn parse_eagle_lbr(content: &str) -> Result<ParsedSymbol, String> { "out" => "output", "io" => "bidirectional", "pas" => "passive",- "nc" => "unconnected",+ "nc" => "no_connect", "hiz" => "tri_state", "oc" => "open_collector", _ => "bidirectional",@@ -797,21 +797,47 @@ pub(crate) fn esc_xml(s: &str) -> String { .replace('\'', "'") } +/// KiCad's twelve electrical types, as KiCad 6+ writes them, onto EAGLE's directions.+/// `unconnected` is the pre-6 spelling of `no_connect`; `free` (not internally+/// connected, may be wired to anything) is closest to EAGLE's lenient `pas`. fn pin_direction(kicad_type: &str) -> &'static str { match kicad_type { "power_in" => "pwr", "power_out" => "out", "input" => "in", "output" => "out",- "bidirectional" => "io",- "passive" => "pas",- "unconnected" => "nc",+ "bidirectional" | "unspecified" => "io",+ "passive" | "free" => "pas",+ "no_connect" | "unconnected" => "nc", "tri_state" => "hiz", "open_collector" | "open_emitter" => "oc", _ => "io", } } +fn pin_type_is_known(kicad_type: &str) -> bool {+ matches!(kicad_type, "power_in" | "power_out" | "input" | "output" | "bidirectional" | "unspecified"+ | "passive" | "free" | "no_connect" | "unconnected" | "tri_state" | "open_collector" | "open_emitter")+}++/// True when every pin ends on the edge of the symbol's body rectangle: the rectangle+/// is the part's box, whatever artwork sits inside it. A crystal's can is a rectangle+/// too, but its pins stop at the plates, short of the can, so it stays a drawing.+fn pins_end_on_body(sym: &ParsedSymbol) -> bool {+ let Some(b) = &sym.body else { return false };+ if sym.pins.is_empty() { return false; }+ let (l, r) = (b.left.min(b.right), b.left.max(b.right));+ let (lo, hi) = (b.top.min(b.bottom), b.top.max(b.bottom));+ let tol = 0.02;+ sym.pins.iter().all(|p| {+ let (dx, dy) = match ((p.angle % 360) + 360) % 360 { 90 => (0.0, 1.0), 180 => (-1.0, 0.0), 270 => (0.0, -1.0), _ => (1.0, 0.0) };+ let (ex, ey) = (p.x + dx * p.length, p.y + dy * p.length);+ let within = |v: f64, a: f64, z: f64| v >= a - tol && v <= z + tol;+ ((ex - l).abs() < tol || (ex - r).abs() < tol) && within(ey, lo, hi)+ || ((ey - lo).abs() < tol || (ey - hi).abs() < tol) && within(ex, l, r)+ })+}+ fn pin_rotation(angle: u32) -> &'static str { match angle { 180 => " rot=\"R180\"",@@ -2283,7 +2309,14 @@ fn emit_symbol_block(xml: &mut String, sym: &ParsedSymbol, symbol_art: Option<&S // as a body while being part of the drawing, and the four pin names printed straight // through it. The test that holds for both is artwork plus a small pin count: an IC // with a body and no artwork of its own keeps its names.- let glyph_only = !sym.graphics.is_empty() && sym.pins.len() <= 4;+ // A boxed symbol keeps its names even with artwork inside the box (adom-symbol's+ // chip outline): every pin ending on the body rectangle's edge is what a box is.+ let glyph_only = !sym.graphics.is_empty() && sym.pins.len() <= 4 && !pins_end_on_body(sym);+ let unknown: Vec<String> = sym.pins.iter().filter(|p| !pin_type_is_known(&p.pin_type))+ .map(|p| format!("{} ({})", p.number, p.pin_type)).collect();+ if !unknown.is_empty() {+ eprintln!("WARN: [pin-type-unmapped] KiCad pin type not recognized, written as direction=\"io\": {}", unknown.join(", "));+ } if glyph_only { println!("HINT: glyph symbol ({} pins, no body box): pin NAMES hidden and pad numbers shown, so the names do not print on top of the drawing.", sym.pins.len()); }@@ -5189,3 +5222,72 @@ mod zero_pad_export_tests { assert!(placeholder.contains("placeholder footprint")); } }++#[cfg(test)]+mod pin_semantics_tests {+ use super::*;+ const OUTLINE: &str = include_str!("../tests/fixtures/pin-semantics/repro4-outline.kicad_sym");+ const PLAIN: &str = include_str!("../tests/fixtures/pin-semantics/repro4-no-outline.kicad_sym");+ const FP: &str = include_str!("../tests/fixtures/pin-semantics/repro4.kicad_mod");++ fn pins_of(xml: &str) -> Vec<String> {+ regex_lite::Regex::new(r#"<pin [^>]*/>"#).unwrap().find_iter(xml).map(|m| m.as_str().to_string()).collect()+ }+ fn lbr(sym_src: &str) -> String {+ let sym = parse_kicad_sym(sym_src, None).unwrap();+ generate_lbr(&sym, Some(FP), None, 0.38, &Default::default(), &[]).unwrap()+ }++ #[test]+ fn kicad_no_connect_is_eagle_nc_and_back() {+ let xml = lbr(PLAIN);+ let nc = pins_of(&xml).into_iter().find(|p| p.contains(r#"name="NC""#)).unwrap();+ assert!(nc.contains(r#"direction="nc""#), "{nc}");+ assert_eq!(pin_direction("no_connect"), "nc");+ assert_eq!(pin_direction("free"), "pas");+ assert_eq!(pin_direction("unspecified"), "io");+ // EAGLE nc imports as KiCad 6+'s no_connect, not the legacy spelling+ let back = parse_eagle_lbr(&xml).unwrap();+ assert_eq!(back.pins.iter().find(|p| p.name == "NC").unwrap().pin_type, "no_connect");+ }++ #[test]+ fn a_boxed_symbol_keeps_pin_names_with_artwork_inside_the_box() {+ for src in [OUTLINE, PLAIN] {+ let xml = lbr(src);+ assert!(!xml.contains(r#"visible="pad""#), "names must stay visible: {:?}", pins_of(&xml));+ }+ }++ #[test]+ fn glyphs_still_hide_pin_names() {+ // KiCad's Crystal_GND24 shape: the can is a rectangle, the pins stop at the plates+ // (x = +-2.54) short of it, so it is a drawing, not a box.+ let crystal = r#"(kicad_symbol_lib (version 20231120) (generator "t")+(symbol "XTAL" (property "Reference" "Y" (at 0 0 0))+(symbol "XTAL_0_1"+ (rectangle (start -1.143 2.54) (end 1.143 -2.54) (stroke (width 0.3048) (type default)) (fill (type none)))+ (polyline (pts (xy -2.54 0) (xy -2.032 0)) (stroke (width 0) (type default)) (fill (type none)))+ (polyline (pts (xy -2.032 -1.27) (xy -2.032 1.27)) (stroke (width 0.508) (type default)) (fill (type none)))+ (polyline (pts (xy 2.032 -1.27) (xy 2.032 1.27)) (stroke (width 0.508) (type default)) (fill (type none))))+(symbol "XTAL_1_1"+ (pin passive line (at -3.81 0 0) (length 1.27) (name "1" (effects (font (size 1.27 1.27)))) (number "1" (effects (font (size 1.27 1.27)))))+ (pin passive line (at 0 -5.08 90) (length 1.27) (name "2" (effects (font (size 1.27 1.27)))) (number "2" (effects (font (size 1.27 1.27)))))+ (pin passive line (at 3.81 0 180) (length 1.27) (name "3" (effects (font (size 1.27 1.27)))) (number "3" (effects (font (size 1.27 1.27)))))+ (pin passive line (at 0 5.08 270) (length 1.27) (name "4" (effects (font (size 1.27 1.27)))) (number "4" (effects (font (size 1.27 1.27))))))))"#;+ let led = r#"(kicad_symbol_lib (version 20231120) (generator "t")+(symbol "LED" (property "Reference" "D" (at 0 0 0))+(symbol "LED_0_1"+ (polyline (pts (xy -1.27 -1.27) (xy -1.27 1.27)) (stroke (width 0.254) (type default)) (fill (type none)))+ (polyline (pts (xy 1.27 -1.27) (xy 1.27 1.27) (xy -1.27 0) (xy 1.27 -1.27)) (stroke (width 0.254) (type default)) (fill (type none))))+(symbol "LED_1_1"+ (pin passive line (at -3.81 0 0) (length 2.54) (name "K" (effects (font (size 1.27 1.27)))) (number "1" (effects (font (size 1.27 1.27)))))+ (pin passive line (at 3.81 0 180) (length 2.54) (name "A" (effects (font (size 1.27 1.27)))) (number "2" (effects (font (size 1.27 1.27))))))))"#;+ for (name, src, n) in [("crystal", crystal, 4), ("LED", led, 2)] {+ let sym = parse_kicad_sym(src, None).unwrap();+ let xml = generate_lbr(&sym, None, None, 0.38, &Default::default(), &[]).unwrap();+ let hidden = pins_of(&xml).iter().filter(|p| p.contains(r#"visible="pad""#)).count();+ assert_eq!(hidden, n, "{name}: every pin name hidden: {:?}", pins_of(&xml));+ }+ }+}
tests/fixtures/pin-semantics/repro4-no-outline.kicad_symadded+59@@ -0,0 +1,59 @@+(kicad_symbol_lib+ (version 20231120)+ (generator "adom")+ (symbol "REPRO4"+ (pin_names (offset 1.016))+ (exclude_from_sim no)+ (in_bom yes)+ (on_board yes)+ (property "Reference" "U"+ (at 0.00 5.08 0)+ (effects (font (size 1.27 1.27)))+ )+ (property "Value" "REPRO4"+ (at 0.00 -15.43 0)+ (effects (font (size 1.27 1.27)))+ )+ (property "Footprint" ""+ (at 0 -20.51 0)+ (effects (font (size 1.27 1.27)) (hide yes))+ )+ (property "Datasheet" ""+ (at 0 -23.05 0)+ (effects (font (size 1.27 1.27)) (hide yes))+ )+ (property "Description" "2-column symbol, pins grouped by function."+ (at 0 -25.59 0)+ (effects (font (size 1.27 1.27)) (hide yes))+ )+ (property "Manufacturer" "Test"+ (at 0 -28.13 0)+ (effects (font (size 1.27 1.27)) (hide yes))+ )+ (property "MPN" "REPRO4"+ (at 0 -30.67 0)+ (effects (font (size 1.27 1.27)) (hide yes))+ )+ (symbol "REPRO4_0_1"+ (rectangle (start -12.70 2.54) (end 12.70 -12.89)+ (stroke (width 0.254) (type default))+ (fill (type background))+ )+ (text "In" (at -11.68 0.00 0)+ (effects (font (size 0.762 0.762) (color 132 0 0 1)) (justify left))+ )+ (text "Out" (at 11.68 0.00 0)+ (effects (font (size 0.762 0.762) (color 132 0 0 1)) (justify right))+ )+ (text "Other" (at 11.68 -8.35 0)+ (effects (font (size 0.762 0.762) (color 132 0 0 1)) (justify right))+ )+ )+ (symbol "REPRO4_1_1"+ (pin input line (at -15.24 -2.00 0) (length 2.54) (name "A") (number "1"))+ (pin input line (at -15.24 -4.54 0) (length 2.54) (name "B") (number "2"))+ (pin output line (at 15.24 -2.00 180) (length 2.54) (name "Y") (number "3"))+ (pin no_connect line (at 15.24 -10.35 180) (length 2.54) (name "NC") (number "4"))+ )+ )+)
tests/fixtures/pin-semantics/repro4-outline.kicad_symadded+81@@ -0,0 +1,81 @@+(kicad_symbol_lib+ (version 20231120)+ (generator "adom")+ (symbol "REPRO4"+ (pin_names (offset 1.016))+ (exclude_from_sim no)+ (in_bom yes)+ (on_board yes)+ (property "Reference" "U"+ (at 0.00 6.35 0)+ (effects (font (size 1.27 1.27)))+ )+ (property "Value" "REPRO4"+ (at 0.00 -16.70 0)+ (effects (font (size 1.27 1.27)))+ )+ (property "Footprint" ""+ (at 0 -21.78 0)+ (effects (font (size 1.27 1.27)) (hide yes))+ )+ (property "Datasheet" ""+ (at 0 -24.32 0)+ (effects (font (size 1.27 1.27)) (hide yes))+ )+ (property "Description" "2-column symbol, pins grouped by function."+ (at 0 -26.86 0)+ (effects (font (size 1.27 1.27)) (hide yes))+ )+ (property "Manufacturer" "Test"+ (at 0 -29.40 0)+ (effects (font (size 1.27 1.27)) (hide yes))+ )+ (property "MPN" "REPRO4"+ (at 0 -31.94 0)+ (effects (font (size 1.27 1.27)) (hide yes))+ )+ (property "Adom_Chip_Outline" "generic-iso@large"+ (at 0 -34.48 0)+ (effects (font (size 1.27 1.27)) (hide yes))+ )+ (symbol "REPRO4_0_1"+ (rectangle (start -12.70 3.81) (end 12.70 -14.16)+ (stroke (width 0.254) (type default))+ (fill (type background))+ )+ (text "In" (at -11.68 0.00 0)+ (effects (font (size 0.762 0.762) (color 132 0 0 1)) (justify left))+ )+ (text "Out" (at 11.68 0.00 0)+ (effects (font (size 0.762 0.762) (color 132 0 0 1)) (justify right))+ )+ (text "Other" (at 11.68 -8.35 0)+ (effects (font (size 0.762 0.762) (color 132 0 0 1)) (justify right))+ )+ (polyline (pts (xy -2.487 -1.533) (xy 3.989 -5.272) (xy 0.104 -7.515) (xy -6.369 -3.775) (xy -2.487 -1.533)) (stroke (width 0.025) (type default)) (fill (type none)))+ (polyline (pts (xy -6.369 -3.775) (xy -6.369 -5.046) (xy 0.104 -8.786) (xy 0.104 -7.515)) (stroke (width 0.025) (type default)) (fill (type none)))+ (polyline (pts (xy 0.104 -8.786) (xy 3.989 -6.543) (xy 3.989 -5.272)) (stroke (width 0.025) (type default)) (fill (type none)))+ (polyline (pts (xy -6.101 -5.203) (xy -6.425 -5.387) (xy -6.035 -5.614) (xy -5.711 -5.426) (xy -6.035 -5.614) (xy -6.035 -5.314) (xy -6.425 -5.088) (xy -6.425 -5.387)) (stroke (width 0.025) (type default)) (fill (type none)))+ (polyline (pts (xy -5.175 -5.736) (xy -5.498 -5.924) (xy -5.112 -6.146) (xy -4.788 -5.958) (xy -5.112 -6.146) (xy -5.112 -5.847) (xy -5.498 -5.624) (xy -5.498 -5.924)) (stroke (width 0.025) (type default)) (fill (type none)))+ (polyline (pts (xy -4.252 -6.268) (xy -4.576 -6.456) (xy -4.186 -6.679) (xy -3.862 -6.495) (xy -4.186 -6.679) (xy -4.186 -6.383) (xy -4.576 -6.157) (xy -4.576 -6.456)) (stroke (width 0.025) (type default)) (fill (type none)))+ (polyline (pts (xy -3.326 -6.804) (xy -3.650 -6.989) (xy -3.263 -7.215) (xy -2.939 -7.027) (xy -3.263 -7.215) (xy -3.263 -6.916) (xy -3.650 -6.693) (xy -3.650 -6.989)) (stroke (width 0.025) (type default)) (fill (type none)))+ (polyline (pts (xy -2.403 -7.337) (xy -2.727 -7.525) (xy -2.337 -7.748) (xy -2.013 -7.560) (xy -2.337 -7.748) (xy -2.337 -7.449) (xy -2.727 -7.226) (xy -2.727 -7.525)) (stroke (width 0.025) (type default)) (fill (type none)))+ (polyline (pts (xy -1.477 -7.870) (xy -1.801 -8.058) (xy -1.411 -8.281) (xy -1.087 -8.096) (xy -1.411 -8.281) (xy -1.411 -7.985) (xy -1.801 -7.758) (xy -1.801 -8.058)) (stroke (width 0.025) (type default)) (fill (type none)))+ (polyline (pts (xy -0.551 -8.406) (xy -0.875 -8.591) (xy -0.488 -8.817) (xy -0.164 -8.629) (xy -0.488 -8.817) (xy -0.488 -8.517) (xy -0.875 -8.295) (xy -0.875 -8.591)) (stroke (width 0.025) (type default)) (fill (type none)))+ (polyline (pts (xy 3.697 -6.710) (xy 4.021 -6.898) (xy 3.631 -7.121) (xy 3.307 -6.933) (xy 3.631 -7.121) (xy 3.631 -6.822) (xy 4.021 -6.599) (xy 4.021 -6.898)) (stroke (width 0.025) (type default)) (fill (type none)))+ (polyline (pts (xy 2.725 -7.271) (xy 3.049 -7.459) (xy 2.663 -7.682) (xy 2.339 -7.494) (xy 2.663 -7.682) (xy 2.663 -7.382) (xy 3.049 -7.160) (xy 3.049 -7.459)) (stroke (width 0.025) (type default)) (fill (type none)))+ (polyline (pts (xy 1.754 -7.832) (xy 2.078 -8.020) (xy 1.691 -8.242) (xy 1.367 -8.054) (xy 1.691 -8.242) (xy 1.691 -7.943) (xy 2.078 -7.720) (xy 2.078 -8.020)) (stroke (width 0.025) (type default)) (fill (type none)))+ (polyline (pts (xy 0.783 -8.392) (xy 1.106 -8.580) (xy 0.720 -8.803) (xy 0.396 -8.615) (xy 0.720 -8.803) (xy 0.720 -8.503) (xy 1.106 -8.281) (xy 1.106 -8.580)) (stroke (width 0.025) (type default)) (fill (type none)))+ (polyline (pts (xy -4.719 -3.908) (xy -4.945 -3.960) (xy -5.171 -3.908) (xy -5.265 -3.775) (xy -5.171 -3.647) (xy -4.945 -3.591) (xy -4.719 -3.647) (xy -4.624 -3.775) (xy -4.719 -3.908)) (stroke (width 0.025) (type default)) (fill (type none)))+ (text "REPRO4" (at -1.19 -4.52 0)+ (effects (font (size 1.27 1.27)))+ )+ )+ (symbol "REPRO4_1_1"+ (pin input line (at -15.24 -2.00 0) (length 2.54) (name "A") (number "1"))+ (pin input line (at -15.24 -4.54 0) (length 2.54) (name "B") (number "2"))+ (pin output line (at 15.24 -2.00 180) (length 2.54) (name "Y") (number "3"))+ (pin no_connect line (at 15.24 -10.35 180) (length 2.54) (name "NC") (number "4"))+ )+ )+)
tests/fixtures/pin-semantics/repro4.kicad_modadded+6@@ -0,0 +1,6 @@+(footprint "REPRO4" (version 20240108) (generator "repro") (layer "F.Cu")+ (pad "1" smd rect (at -1.27 -0.635) (size 0.8 0.5) (layers "F.Cu" "F.Paste" "F.Mask"))+ (pad "2" smd rect (at -1.27 0.635) (size 0.8 0.5) (layers "F.Cu" "F.Paste" "F.Mask"))+ (pad "3" smd rect (at 1.27 0.635) (size 0.8 0.5) (layers "F.Cu" "F.Paste" "F.Mask"))+ (pad "4" smd rect (at 1.27 -0.635) (size 0.8 0.5) (layers "F.Cu" "F.Paste" "F.Mask"))+)