diff --git a/README.md b/README.md index 4ce7b9c..9a3d881 100644 --- a/README.md +++ b/README.md @@ -107,3 +107,5 @@ adom-schematic state --port See [authoring development guide](docs/AUTHORING-DEVELOPMENT.md) for operations, visible verification and limitations. This branch is a development slice, not a released general schematic editor or a claim of native CAD parity. + +The live authoring renderer now retains functional group text, pin names/numbers and background-filled chip bodies. Editable per-chip purpose comments persist through undo/reload and export as native schematic text. See the development guide for limitations and the transaction contract. diff --git a/docs/AUTHORING-DEVELOPMENT.md b/docs/AUTHORING-DEVELOPMENT.md index c11c633..79bd7be 100644 --- a/docs/AUTHORING-DEVELOPMENT.md +++ b/docs/AUTHORING-DEVELOPMENT.md @@ -110,3 +110,11 @@ Every live-state update clears native attribution. A native response only mounts This is not an ERC exclusion. The transaction rejects a marked endpoint with a label, any touching exported wire segment or a coincident second pin. Removing a marker and connecting its pin may be one atomic transaction. Native ERC and engineering review still decide whether leaving that particular pin unused is correct. No output pin is marked automatically. SSE responses carry `Cache-Control: no-cache, no-transform` as well as `X-Accel-Buffering: no`. The workspace proxy otherwise gzip-compresses the stream without flushing small events, so a saved revision can leave the browser stale. Verify an actual browser state event and paint acknowledgment through the deployed route, including compression negotiation; direct-loopback success alone does not validate a proxy route. + +## Explanatory notes and symbol-content fidelity + +Use `set_note {id,note:{text,x,y,size}}` and `remove_note {id}` for ordinary schematic comments. The Chip explanations UI uses the same revisioned transaction endpoint. Note IDs are stable; setting an existing ID replaces that note. Coordinates and font size are millimetres. Multiline text is supported, limited to2000 characters; font size is0.5–5mm. Blank/control-character input is rejected. Notes persist in the document and history, are exposed through `/state.author.notes`, and export as native KiCad `(text ...)`; they never rename a net or change a pin. + +For the Depth Lab workflow, explain every IC instance’s role, selection reason, signal direction/power domain and unresolved assumptions. Inspect text clearance in the actual live and native views. Empty chip bodies are not acceptable when a central outline was requested: embed vector art in the symbol source and verify the canonical export retains it. + +The local renderer retains group headings, pin names/numbers, body fill and active-low overbars. It remains an approximate SVG renderer, not a claim that every KiCad graphic/font/multi-unit feature is identical. The grouped-buffer regression checks identities and fill; the comment test checks persistence, native text, removal/undo and unchanged pin inventory. Native rendering is still a separate required check. diff --git a/src/author.rs b/src/author.rs index e4e0ca8..e44bd49 100644 --- a/src/author.rs +++ b/src/author.rs @@ -176,6 +176,13 @@ pub struct Label { pub angle: Option, } #[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Note { + pub text: String, + pub x: f64, + pub y: f64, + pub size: f64, +} +#[derive(Clone, Debug, Serialize, Deserialize)] pub struct Document { pub id: String, pub name: String, @@ -188,6 +195,8 @@ pub struct Document { /// Explicit intent at a pin, not an ERC exclusion. #[serde(default, skip_serializing_if = "BTreeSet::is_empty")] pub no_connects: BTreeSet, + #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] + pub notes: BTreeMap, } #[derive(Clone, Debug, Serialize, Deserialize)] pub struct Receipt { @@ -204,6 +213,8 @@ pub struct Project { #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(tag = "op", rename_all = "snake_case", deny_unknown_fields)] pub enum Operation { + SetNote { id: String, note: Note }, + RemoveNote { id: String }, SetNoConnect { endpoint: PinRef, enabled: bool, @@ -430,6 +441,7 @@ impl Project { connections: vec![], labels: vec![], no_connects: BTreeSet::new(), + notes: BTreeMap::new(), }, history: vec![], receipts: BTreeMap::new(), @@ -497,6 +509,13 @@ impl Project { impl Document { fn apply(&mut self, op: &Operation) -> Result<()> { match op { + Operation::SetNote { id, note } => { + asset_key(id)?; + self.notes.insert(id.clone(), note.clone()); + } + Operation::RemoveNote { id } => { + if self.notes.remove(id).is_none() { bail!("Unknown note") } + } Operation::SetNoConnect { endpoint, enabled } => { self.endpoint(endpoint)?; if *enabled { @@ -696,6 +715,15 @@ impl Document { footprint_root(&fp.source, &lib.symbol)?; } } + for (id, note) in &self.notes { + asset_key(id)?; + coords(note.x, note.y, 0)?; + if !note.size.is_finite() || !(0.5..=5.0).contains(¬e.size) + || note.text.trim().is_empty() || note.text.chars().count() > 2000 + || note.text.chars().any(|c| c.is_control() && c != '\n') { + bail!("Invalid schematic note: use readable text and a 0.5..5 mm font") + } + } for c in self.components.values() { coords(c.x, c.y, c.rotation)?; for (name, f) in &c.fields { @@ -1031,6 +1059,10 @@ impl Document { let justify = if angle < 180.0 { "left" } else { "right" }; out+=&format!("(label {} (at {} {} {angle}) (effects (font (size 1.27 1.27)) (justify {justify} bottom)) (uuid {}))\n",q(&l.net),a[0],a[1],id(&self.id,&format!("label:{}:{}",l.endpoint.reference,l.endpoint.pin))); } + for (key, note) in &self.notes { + out += &format!("(text {} (at {} {} 0) (effects (font (size {} {})) (justify left top)) (uuid {}))\n", + q(¬e.text), note.x, note.y, note.size, note.size, id(&self.id, &format!("note:{key}"))); + } for nc in &self.no_connects { let at = self.endpoint(nc)?; out += &format!( @@ -1082,6 +1114,39 @@ mod tests { )) .unwrap() } + #[test] + fn live_render_keeps_group_headings_pin_names_numbers_and_fill() { + let symbol = include_str!("../tests/fixtures/74lvc2g17-grouped.kicad_sym"); + let p=Project::new("render"); + let q=p.stage(&tx(&p,"setup",vec![Operation::AddLibrary { key:"BUF".into(),symbol:symbol.into() }, Operation::Place { component: Component { reference:"U1".into(), library:"BUF".into(),value:"BUF".into(),x:50.,y:50.,rotation:0,fields:BTreeMap::new() } }])).unwrap(); + let svg=crate::kicad_self::render_inner(&q.document.export_kicad().unwrap()); + for value in ["Channel 1","1A","1Y",">1",">6","#ffffc2"] { assert!(svg.contains(value),"missing {value}"); } + } + + #[test] + fn notes_preserve_connectivity_roundtrip_and_undo() { + let p = placed(); + let before = p.document.pin_inventory().unwrap(); + let q = p.stage(&tx(&p, "explain", vec![Operation::SetNote { + id: "C1-purpose".into(), note: Note { text: "Decouple rail\nKeep close to IC".into(), x: 50., y: 65., size: 1.27 } + }])).unwrap(); + assert_eq!(before, q.document.pin_inventory().unwrap()); + assert_eq!(p.document.labels.len(), q.document.labels.len()); + let restored: Project = serde_json::from_str(&serde_json::to_string(&q).unwrap()).unwrap(); + assert_eq!(restored.document.notes["C1-purpose"].text, "Decouple rail\nKeep close to IC"); + let sch = restored.document.export_kicad().unwrap(); + assert!(sch.contains("(text \"Decouple rail\\nKeep close to IC\"")); + let rendered = crate::kicad_self::render_inner(&sch); + assert!(rendered.contains("Decouple rail")); + assert!(rendered.contains("Keep close to IC")); + let bad = q.stage(&tx(&q, "bad", vec![Operation::SetNote { id: "bad".into(), note: Note { text: "".into(), x: 0., y: 0., size: 1.27 } }])); + assert!(bad.is_err()); + let undone = q.stage(&tx(&q, "undo-notes", vec![Operation::Undo])).unwrap(); + assert!(undone.document.notes.is_empty()); + let removed = q.stage(&tx(&q, "remove", vec![Operation::RemoveNote { id: "C1-purpose".into() }])).unwrap(); + assert!(removed.document.notes.is_empty()); + } + #[test] fn no_connect_persists_moves_exports_and_can_be_reconnected() { let p = placed(); diff --git a/src/author_server.rs b/src/author_server.rs index 11d6cd7..8c63777 100644 --- a/src/author_server.rs +++ b/src/author_server.rs @@ -37,7 +37,7 @@ fn snapshot(p: &Project, owner: &str) -> Result { inner ); Ok( - json!({"name":p.document.name,"svg":svg,"meta":serde_json::from_str::(&crate::kicad_sch::meta_json(&sch)?)?,"author":{"revision":p.revision,"paper":p.document.paper,"documentId":p.document.id,"aiThread":owner,"libraries":p.document.libraries.keys().collect::>(),"footprintBindings":p.document.libraries.iter().filter_map(|(k,l)|l.footprint.as_ref().map(|f|(k.clone(),f.source_sha256.clone()))).collect::>(),"components":p.document.components,"pins":p.document.pin_inventory()?,"contactIssues":p.document.contact_issues()?,"connections":p.document.connections,"labels":p.document.labels,"noConnects":p.document.no_connects,"status":"Development authoring slice; circuit/ERC and native parity pending","hints":["Use expectedRevision and operationId for every edit; read state on conflicts.","Endpoints are stable reference/pin identities; moving a component updates connected wire endpoints.","Local Rust preview is not a native KiCad render or ERC result.","Use set_no_connect {endpoint,enabled} for intentionally unused pins; wires, labels or coincident pins at marked endpoints are rejected. Native ERC remains required.","Inspect contactIssues for unintended pin or wire contacts. Body clearance and native netlist equivalence remain separate checks."]}}), + json!({"name":p.document.name,"svg":svg,"meta":serde_json::from_str::(&crate::kicad_sch::meta_json(&sch)?)?,"author":{"revision":p.revision,"paper":p.document.paper,"documentId":p.document.id,"aiThread":owner,"libraries":p.document.libraries.keys().collect::>(),"footprintBindings":p.document.libraries.iter().filter_map(|(k,l)|l.footprint.as_ref().map(|f|(k.clone(),f.source_sha256.clone()))).collect::>(),"components":p.document.components,"pins":p.document.pin_inventory()?,"contactIssues":p.document.contact_issues()?,"connections":p.document.connections,"labels":p.document.labels,"noConnects":p.document.no_connects,"notes":p.document.notes,"status":"Development authoring slice; circuit/ERC and native parity pending","hints":["Use expectedRevision and operationId for every edit; read state on conflicts.","Endpoints are stable reference/pin identities; moving a component updates connected wire endpoints.","Local Rust preview is not a native KiCad render or ERC result.","Use set_no_connect {endpoint,enabled} for intentionally unused pins; wires, labels or coincident pins at marked endpoints are rejected. Native ERC remains required.","Inspect contactIssues for unintended pin or wire contacts. Body clearance and native netlist equivalence remain separate checks."]}}), ) } fn error(e: impl std::fmt::Display) -> Value { diff --git a/src/author_ui.js b/src/author_ui.js index 66a3972..3acbc35 100644 --- a/src/author_ui.js +++ b/src/author_ui.js @@ -5,7 +5,7 @@ body.author #svgbox{top:var(--author-canvas-top,152px)!important}body.author #side{display:none!important}#authorBar{position:absolute;top:44px;left:0;right:0;min-height:92px;z-index:10;padding:6px 12px;background:var(--panel,#15202b);border-bottom:1px solid var(--edge,#39434d);font:12px sans-serif;color:var(--ink,#eee)} #authorBar .row{display:flex;gap:6px;align-items:center;flex-wrap:wrap;margin:4px 0}#authorBar input,#authorBar select,#authorBar button{font:inherit;background:var(--bg,#18232e);color:inherit;border:1px solid var(--edge,#40505d);border-radius:4px;padding:4px}#authorBar input[type=number]{width:48px}#authorBar .ref{width:44px}#authorStatus{color:var(--muted,#abb7c2)}#authorBar a{color:var(--accent,#73caca)} `;document.head.append(style);document.body.classList.add('author'); - const bar=document.createElement('section');bar.id='authorBar';bar.innerHTML=`
Development circuit • not releasedKiCad file
Unused pins
Sheet
Library links
Project files JSON
Fields and net labels
Change net edits electrical connectivity. Field placement and angles keep nets unchanged.
`;document.body.append(bar);new ResizeObserver(()=>document.body.style.setProperty('--author-canvas-top',`${44+bar.getBoundingClientRect().height}px`)).observe(bar); + const bar=document.createElement('section');bar.id='authorBar';bar.innerHTML=`
Development circuit • not releasedKiCad file
Unused pins
Sheet
Library links
Project files JSON
Fields and net labels
Change net edits electrical connectivity. Field placement and angles keep nets unchanged.
Chip explanations
`;document.body.append(bar);new ResizeObserver(()=>document.body.style.setProperty('--author-canvas-top',`${44+bar.getBoundingClientRect().height}px`)).observe(bar); const $=s=>document.getElementById(s);function options(el,rows){const old=el.value;el.replaceChildren(...rows.map(([v,t])=>{const o=document.createElement('option');o.value=v;o.textContent=t;return o}));if(rows.some(([v])=>v===old))el.value=old;} function update(s){if(!s.author)return;latest=s.author;renderEpoch++;$('authorPaper').value=latest.paper||'A4';$('authorStatus').textContent='Live Rust preview • native checks separate';window.AdomAuthorSnapshot=s;window.AdomAuthorState=latest;window.AdomSch.mount(s.svg,s.meta);$('authorRevision').textContent=`${s.name} · revision ${latest.revision}`;options($('authorLib'),latest.libraries.map(k=>[k,k]));options($('authorBindKey'),latest.libraries.map(k=>[k,k]));$('authorLinkStatus').textContent=`${Object.keys(latest.footprintBindings||{}).length}/${latest.libraries.length} footprints linked`;const pins=latest.pins.map(p=>[JSON.stringify(p.endpoint),`${p.endpoint.reference}.${p.endpoint.pin}`]);options($('authorFrom'),pins);options($('authorTo'),pins);options($('authorNcPin'),pins);$('authorNcStatus').textContent=(latest.noConnects||[]).map(p=>`${p.reference}.${p.pin}`).join(', ')||'No pins marked';options($('authorFieldRef'),Object.keys(latest.components).map(r=>[r,r]));options($('authorLabelPin'),latest.labels.map(l=>[JSON.stringify(l.endpoint),`${l.endpoint.reference}.${l.endpoint.pin}: ${l.net}`]));requestAnimationFrame(()=>requestAnimationFrame(()=>fetch('author/ack',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({revision:latest.revision,componentCount:latest.pins.length?Object.keys(latest.components).length:0,paintedAt:new Date().toISOString()})})));} async function transact(operations){const r=await fetch('author/transaction',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({aiThread:'Schematic UI',expectedRevision:latest.revision,operationId:crypto.randomUUID(),operations})});const s=await r.json();if(!s.ok){window.AdomSch.toast(s.error,'error');return}window.AdomSch.toast(`Saved revision ${s.revision}`,'success');} @@ -22,5 +22,7 @@ $('authorLabelPin').onchange=()=>{const l=latest.labels.find(l=>JSON.stringify(l.endpoint)===$('authorLabelPin').value);if(l){$('authorLabelNet').value=l.net;if(l.angle!==undefined)$('authorLabelAngle').value=l.angle;}}; $('authorNative').onclick=async()=>{const epoch=++renderEpoch;const revision=latest.revision;const r=await fetch('author/native');const v=await r.json();if(!v.ok){window.AdomSch.toast(v.error,'error');return}if(epoch!==renderEpoch||revision!==latest.revision||v.report.revision!==latest.revision){window.AdomSch.toast('Native response is stale; inspect the current revision','error');return}window.AdomSch.mount(v.svg,v.meta);$('authorStatus').textContent=`KiCad ${v.report.kicadVersion} service render • revision ${v.report.revision} • ${v.report.violationCount} ERC findings`;}; $('authorLocal').onclick=()=>{update({name:initial.name,author:latest,...window.AdomAuthorSnapshot});$('authorStatus').textContent='Live Rust preview • native checks separate';}; + $('authorNoteApply').onclick=()=>transact([{op:'set_note',id:$('authorNoteId').value,note:{text:$('authorNoteText').value,x:Number($('authorNoteX').value),y:Number($('authorNoteY').value),size:1.27}}]); + $('authorNoteRemove').onclick=()=>transact([{op:'remove_note',id:$('authorNoteId').value}]); $('authorUndo').onclick=()=>transact([{op:'undo'}]);update(initial);const events=new EventSource('events');events.addEventListener('state',e=>update(JSON.parse(e.data)));events.onerror=()=>{$('authorStatus').textContent='Reconnecting… saved document retained';};events.onopen=()=>{$('authorStatus').textContent='Live • development circuit • ERC pending';}; })().catch(e=>console.error('Authoring UI:',e)); diff --git a/src/kicad_self.rs b/src/kicad_self.rs index c7d11f0..fc28ecf 100644 --- a/src/kicad_self.rs +++ b/src/kicad_self.rs @@ -24,7 +24,7 @@ const C_LABEL: &str = "#840000"; // net / power labels #[derive(Clone)] struct Prim { kind: u8, pts: Vec<(f64, f64)>, r: f64 } // 0 poly/rect, 1 circle, 2 pin -struct LibSym { prims: Vec } +struct LibSym { prims: Vec, source: String } /// lib Y-up -> screen Y-down, ROTATE CCW by `rot` (screen matrix uses -rot), then /// MIRROR in the world/page frame, then translate to (px,py). KiCad applies the @@ -169,7 +169,7 @@ pub fn symbol_segments(content: &str) -> (HashMap, HashMap<(i32, prims.push(Prim { kind: 2, pts: vec![(lx, ly), (lx + dx, ly + dy)], r: 0.0 }); } } - libs.insert(name, LibSym { prims }); + libs.insert(name, LibSym { prims, source: def.to_string() }); } } @@ -342,6 +342,20 @@ fn placed_text(block: &str, text: &str, color: &str) -> String { format!(r##"{text}"##, rotation=-angle, text=esc(text)) } +// Transform text with the symbol while keeping glyphs readable after mirroring. +fn library_text(text: &str, x: f64, y: f64, a: f64, size: f64, anchor: &str, color: &str, px: f64, py: f64, rot: f64, mirror: u8) -> String { + let (sx,sy)=xf(x,y,px,py,rot,mirror); + let (ex,ey)=xf(x+a.to_radians().cos(),y+a.to_radians().sin(),px,py,rot,mirror); + let mut angle=(ey-sy).atan2(ex-sx).to_degrees(); + let mut anchor=anchor; + if angle>90. || angle<=-90. { + angle=if angle>90. { angle-180. } else { angle+180. }; + anchor=match anchor { "start"=>"end", "end"=>"start", _=>anchor }; + } + let markup=Regex::new(r"~\{([^}]+)\}").unwrap().replace_all(&esc(text), r#"$1"#).into_owned(); + format!(r#"{}"#,markup) +} + pub fn render_inner(content: &str) -> String { let at3 = Regex::new(r"\(at\s+(-?[\d.]+)\s+(-?[\d.]+)(?:\s+(-?[\d.]+))?\)").unwrap(); let se = Regex::new(r"\(start\s+(-?[\d.]+)\s+(-?[\d.]+)\)\s*\(end\s+(-?[\d.]+)\s+(-?[\d.]+)\)").unwrap(); @@ -362,7 +376,7 @@ pub fn render_inner(content: &str) -> String { for r in blocks(def, "rectangle") { if let Some(c) = se.captures(r) { let (x1, y1, x2, y2) = (f(c.get(1)), f(c.get(2)), f(c.get(3)), f(c.get(4))); - prims.push(Prim { kind: 0, pts: vec![(x1, y1), (x2, y1), (x2, y2), (x1, y2), (x1, y1)], r: 0.0 }); + prims.push(Prim { kind: if r.contains("(type background)") { 3 } else { 0 }, pts: vec![(x1, y1), (x2, y1), (x2, y2), (x1, y2), (x1, y1)], r: 0.0 }); } } for p in blocks(def, "polyline") { @@ -382,7 +396,7 @@ pub fn render_inner(content: &str) -> String { prims.push(Prim { kind: 2, pts: vec![(lx, ly), (lx + dx, ly + dy)], r: 0.0 }); } } - libs.insert(name, LibSym { prims }); + libs.insert(name, LibSym { prims, source: def.to_string() }); } } let bare = bare_index(&libs); @@ -418,6 +432,15 @@ pub fn render_inner(content: &str) -> String { out.push_str(&placed_text(l, "ed(l).unwrap_or_default(), C_LABEL)); } + // Sheet notes are presentation only; never net labels or component fields. + for block in blocks(&content_wo_lib, "text") { + let text = quoted(block).unwrap_or_default().replace("\\n", "\n"); + let size = capture1(block, r"\(size\s+([\d.]+)").and_then(|s| s.parse::().ok()).unwrap_or(1.27); + for (line, text) in text.lines().enumerate() { + out.push_str(&format!(r#"{}"#, line as f64 * size * 1.5, placed_text(block, text, "#465865"))); + } + } + // ── symbol instances ── for inst in top_symbols(&content_wo_lib) { let lib_id = match capture1(inst, r##"\(lib_id\s+"([^"]+)"\)"##) { Some(s) => s, None => continue }; @@ -436,11 +459,45 @@ pub fn render_inner(content: &str) -> String { for pr in &lib.prims { let tp: Vec<(f64, f64)> = pr.pts.iter().map(|&(x, y)| xf(x, y, px, py, rot, mirror)).collect(); match pr.kind { + 3 => { let _ = write!(body, r##""##, poly_d(&tp), C_SYM); } 1 => { let _ = write!(body, r##""##, tp[0].0, tp[0].1, pr.r, C_SYM); } 2 => { let _ = write!(body, r##""##, tp[0].0, tp[0].1, tp[1].0, tp[1].1, C_SYM); } _ => { let _ = write!(body, r##""##, poly_d(&tp), C_SYM); } } } + // Preserve library group headings and pin identity in the live view. + let def = &lib.source; + for text in blocks(def, "text") { + if text.contains("(hide yes)") || text.contains("(hide)") { continue; } + if let Some(at) = at3.captures(text) { + let size = capture1(text, r"\(size\s+([\d.]+)").and_then(|x| x.parse().ok()).unwrap_or(1.27); + let justify = capture1(text, r"\(justify\s+([^)]*)\)").unwrap_or_default(); + body.push_str(&library_text("ed(text).unwrap_or_default(), f(at.get(1)), f(at.get(2)), f(at.get(3)), size, + if justify.contains("left") { "start" } else if justify.contains("right") { "end" } else { "middle" }, C_SYM, px, py, rot, mirror)); + } + } + let names_hidden = blocks(def, "pin_names").iter().any(|b| b.contains("hide")); + let numbers_hidden = blocks(def, "pin_numbers").iter().any(|b| b.contains("hide")); + let offset = blocks(def, "pin_names").first().and_then(|b| capture1(b, r"\(offset\s+([\d.]+)")).and_then(|x| x.parse::().ok()).unwrap_or(0.508); + for pin in blocks(def, "pin") { + if pin.contains("(hide yes)") || pin.contains("(hide)") { continue; } + let Some(at) = at3.captures(pin) else { continue; }; + let (x,y,a)=(f(at.get(1)),f(at.get(2)),f(at.get(3))); + let len = length.captures(pin).map(|c| f(c.get(1))).unwrap_or(2.54); + let (dx,dy)=(a.to_radians().cos(),a.to_radians().sin()); + for (tag,hidden) in [("name",names_hidden),("number",numbers_hidden)] { + if hidden {continue;} + let Some(block) = blocks(pin, tag).first().copied() else {continue;}; + let text=quoted(block).unwrap_or_default(); if text=="~" {continue;} + let size = capture1(block, r"\(size\s+([\d.]+)").and_then(|x| x.parse().ok()).unwrap_or(1.27); + if tag=="name" { + body.push_str(&library_text(&text,x+(len+offset)*dx,y+(len+offset)*dy,a,size,"start",C_VALUE,px,py,rot,mirror)); + } else { + // Place numbers above horizontal stubs / beside vertical ones. + body.push_str(&library_text(&text,x+len*dx/2.-0.7*dy.abs(),y+len*dy/2.+0.7*dx.abs(),a,size,"middle",C_SYM,px,py,rot,mirror)); + } + } + } } // Native instance properties already carry absolute sheet positions. for pb in blocks(inst, "property") { diff --git a/tests/fixtures/74lvc2g17-grouped.kicad_sym b/tests/fixtures/74lvc2g17-grouped.kicad_sym new file mode 100644 index 0000000..f976de6 --- /dev/null +++ b/tests/fixtures/74lvc2g17-grouped.kicad_sym @@ -0,0 +1,91 @@ +(kicad_symbol_lib + (version 20231120) + (generator "adom-lbr") + (generator_version "8.0") + (symbol "74LVC2G17GV,125" + (pin_numbers) + (pin_names (offset 0.254)) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (property "Reference" "U" + (at 0 13.97 0) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "74LVC2G17GV,125" + (at 0 -14.89 0) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "74LVC2G17GV,125" + (at 0 -17.43 0) + (effects (font (size 1.27 1.27)) (hide yes)) + ) + (property "Datasheet" "https://assets.nexperia.com/documents/data-sheet/74LVC2G17.pdf" + (at 0 -19.97 0) + (effects (font (size 1.27 1.27)) (hide yes)) + ) + (property "Description" "Dual non-inverting Schmitt buffer. 2-column symbol, pins grouped by function." + (at 0 -22.51 0) + (effects (font (size 1.27 1.27)) (hide yes)) + ) + (property "Manufacturer" "Nexperia" + (at 0 -25.05 0) + (effects (font (size 1.27 1.27)) (hide yes)) + ) + (property "Manufacturer Part Number" "74LVC2G17GV,125" + (at 0 -27.59 0) + (effects (font (size 1.27 1.27)) (hide yes)) + ) + (symbol "74LVC2G17GV,125_0_1" + (rectangle + (start -15.24 12.7) + (end 15.24 -13.62) + (stroke (width 0.254) (type default)) + (fill (type background)) + ) + (text "Channel 1" (at -14.22 10.16 0) (effects (font (size 0.762 0.762)) (justify left))) + (text "Channel 2" (at -14.22 1.81 0) (effects (font (size 0.762 0.762)) (justify left))) + (text "Channel 1" (at 14.22 10.16 0) (effects (font (size 0.762 0.762)) (justify right))) + (text "Channel 2" (at 14.22 1.81 0) (effects (font (size 0.762 0.762)) (justify right))) + (text "Supply" (at 14.22 -6.54 0) (effects (font (size 0.762 0.762)) (justify right))) + ) + (symbol "74LVC2G17GV,125_1_1" + (pin input line + (at -17.78 7.62 0) + (length 2.54) + (name "1A" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + (pin input line + (at -17.78 0 0) + (length 2.54) + (name "2A" (effects (font (size 1.27 1.27)))) + (number "3" (effects (font (size 1.27 1.27)))) + ) + (pin output line + (at 17.78 7.62 180) + (length 2.54) + (name "1Y" (effects (font (size 1.27 1.27)))) + (number "6" (effects (font (size 1.27 1.27)))) + ) + (pin output line + (at 17.78 0 180) + (length 2.54) + (name "2Y" (effects (font (size 1.27 1.27)))) + (number "4" (effects (font (size 1.27 1.27)))) + ) + (pin power_in line + (at 17.78 -7.62 180) + (length 2.54) + (name "VCC" (effects (font (size 1.27 1.27)))) + (number "5" (effects (font (size 1.27 1.27)))) + ) + (pin power_in line + (at 17.78 -10.16 180) + (length 2.54) + (name "GND" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))) + ) + ) + ) +)