Add net label injection for generated schematics#280
Closed
lachlanfysh wants to merge 1 commit intodevbisme:masterfrom
Closed
Add net label injection for generated schematics#280lachlanfysh wants to merge 1 commit intodevbisme:masterfrom
lachlanfysh wants to merge 1 commit intodevbisme:masterfrom
Conversation
SKiDL's generate_schematic() produces hierarchical schematics with correct symbols and netlists, but without visible net labels on pins. This makes generated schematics hard to read — you can see the components but can't tell what connects to what. inject_labels.py solves this by reading the companion .net netlist, resolving pin-to-net mappings, and injecting global_label S-expressions at the world coordinates of every connected pin. Features: - Zero external dependencies (self-contained S-expression parser) - Handles rotation, mirror, and multi-unit sub-symbols - Deduplicates labels at identical positions (e.g. stacked USB-C GND) - Auto-orients labels to point away from symbol body - Converts auto-generated net names to readable form - Works with both KiCad 8 and 9 schematic format Tested with a 363-part hierarchical design across 8 subcircuit sheets, injecting 1,320 labels total. Usage: python -m skidl.tools.inject_labels input.kicad_sch circuit.net output.kicad_sch Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5 tasks
lachlanfysh
pushed a commit
to lachlanfysh/skidl
that referenced
this pull request
Feb 17, 2026
Merges work from three separate branches into a single unified implementation using SKiDL's existing placement/routing infrastructure: - New shared module: schematics/sexp_schematic.py Recursive hierarchy walker (following kicad5 node_to_eeschema pattern), coordinate system correction (Y-flip), deterministic UUIDs, lib_symbol extraction from draw_cmds, wire/junction/net-label generation, custom field export, and hierarchical sheet references. - kicad6/kicad8 gen_schematic.py: thin wrappers (~227 lines each) preprocess_circuit (with deg_to_orient pin normalization) -> SchNode -> place -> route -> write_top_schematic. Only difference is version number. - kicad9 gen_schematic.py: re-exports from kicad8 (identical format). - bboxes.py (kicad6/8/9): replaced broken 249-line versions with working pin-based bbox calculation (~101 lines each). - inject_labels.py: retained as standalone CLI post-processor utility. Sources: upstream/sexp_schematics (devbisme), feature/kicad8-gen-schematic (PR devbisme#281), feature/inject-net-labels (PR devbisme#280). Credit: cyberhuman (PR devbisme#270). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6 tasks
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
inject_labels.py— a post-processor that adds global net labels to schematics generated bygenerate_schematic().netfile, resolves every pin-to-net mapping, and injects(global_label ...)S-expressions at pin world coordinatesFeatures
N$1,Net-(R1-1)) to readable formUsage
Or from Python:
Test plan
Context
Relates to #68 (Export to Eeschema Schematic) — this makes the generated output actually readable.
🤖 Generated with Claude Code