Implement gen_schematic for KiCad 8 and 9#281
Implement gen_schematic for KiCad 8 and 9#281lachlanfysh wants to merge 1 commit intodevbisme:masterfrom
Conversation
Replaces the stub gen_schematic.py (which returned "not implemented") with a working implementation that generates hierarchical KiCad schematics from SKiDL circuits. Features: - Generates one .kicad_sch per @Subcircuit, plus a root sheet with hierarchical sheet symbols linking them - Extracts library symbol definitions from SKiDL Part draw_cmds data - Produces correct symbol instances with lib_id, properties, UUIDs - Handles arbitrary nesting depth via recursive hierarchy traversal - Generates stable UUIDs using uuid5 for reproducible output - Auto-exports custom Part fields (manufacturer, MPN, etc.) - Supports A3 page size with grid-based component placement Tested with a 363-part circuit across 8 subcircuit sheets, producing correct netlists verified by KiCad ERC (0 errors). Applies to both kicad8 and kicad9 tools (same schematic format). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Thanks for doing this! I'll test it out and then do a merge and a new release. Would this also work for KiCad 6 and 7? |
|
Not sure - tested fully only on 9
…On Thu, Feb 12, 2026, 9:40 PM Dave Vandenbout ***@***.***> wrote:
*devbisme* left a comment (devbisme/skidl#281)
<#281 (comment)>
Thanks for doing this! I'll test it out and then do a merge and a new
release.
Would this also work for KiCad 6 and 7?
—
Reply to this email directly, view it on GitHub
<#281 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/BWXPY2FVDIKQFV66LHECSUD4LRKDPAVCNFSM6AAAAACUZXJY3CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQOJQGA4DSNBTG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
Hi! Thank you for your work! |
|
Hello, Doctor!We've conducted a preliminary verification of your submitted fix and confirmed that the generated KICAD9 schematic can be opened normally. However, it appears the connection lines and network labels for cross-level schematics were not processed. Is this an issue to be addressed in future enhancements? |
|
Currently, does KICAD5's automatic layout and routing logic not yet support KICAD9? |
|
Hey, it is possible this is because I broke up the code changes I made into multiple PRs and that could have produced some functional gaps when only this single PR is committed... I will aim to get back to this in the next ~48hr and do more testing but essentially I have sought to do three things:
|
|
In my opinion, the algorithms for placement and routing belong in the code files stored in |
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>
|
@cyberhuman Your work on #270 is credited in the new unified PR #282 — both in the source code header of |

Summary
gen_schematic.pyfor kicad8 and kicad9 (currently prints "not implemented") with a working hierarchical schematic generator.kicad_schper@subcircuitplus a root sheet with hierarchical sheet symbolsWhat it does
Given a SKiDL circuit with
@subcircuitblocks, produces:Each subcircuit sheet contains:
draw_cmdsKey design decisions
simp_sexp.Sexpfor S-expression output (already a SKiDL dependency)uuid5— regenerating the same circuit produces the same UUIDs.kicad_schformat is identical between versionsTest plan
@subcircuitblocks)kicad-cli sch export svgContext
Addresses #68 (Export to Eeschema Schematic) and #188 (Generate schematics for newer versions of KiCad).
🤖 Generated with Claude Code