flatten_hierarchy
Flatten a hierarchical schematic into a single sheet whose netlist is the hierarchy's.
Instructions
Flatten a hierarchical schematic into a single sheet whose netlist is the hierarchy's.
The flat file is the root schematic with each sub-sheet's content copied below it, one
cell per use of a sheet file (a file used twice is copied twice). Each part keeps the
reference and unit KiCad reads for it at its sheet's path. A sheet pin becomes a
local label at its place when its sheet has a hierarchical label of its name, and nothing
otherwise. A local or hierarchical label of a sub-sheet becomes a local label named after
the sheet's path, so nets keep their joins and no others; net names change to those
labels. A label whose own sheet has a global label, a power symbol or a hidden power input
pin of its text keeps that text, so it keeps joining it. Text variables that name the
sheet are not rewritten.
The tool refuses, writing nothing, where the flat file could not keep the netlist: a
sheet pin or sub-sheet label that may be a bus, a file older than format 20221002, a
local power symbol, a bus_alias in a sub-sheet, a root label named like a global net
that only another sheet has, a library symbol whose pins differ between two files, a
sheet marked DNP, out of the BOM, off the board or out of simulation,
two sheets of one name, more than 4096 sheet instances, or a sheet file that cannot be
read. A sheet file that is missing is flattened as an empty sheet, as KiCad loads it.
Creates a new file and does not modify the hierarchy.
Args:
schematic_path: Path to root .kicad_sch file. Optional; omit to use the configured default.
output_path: Path for flattened output (defaults to *_flat.kicad_sch)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| output_path | No | ||
| schematic_path | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |