add_hierarchical_sheet
Add a hierarchical sheet to a parent schematic with matching labels in the child.
Instructions
Add a hierarchical sheet to a parent schematic with matching labels in the child.
Creates the sheet block in the parent, with its pins on the left edge, and the
corresponding hierarchical labels in the child schematic. The child schematic must
already exist (create it with create_schematic first).
Everything is checked before the first write, so a refusal changes neither file: a pin
direction that is not one of the five below, an empty pin name, a child that is no
schematic, and a child that is the parent or has the parent somewhere below it.
The sheet's page is the lowest number no sheet of the hierarchy uses. It is written at
the instance path of the parent (the sheet that holds the block), which is where KiCad
reads a sheet's page; give project_path when the parent is itself a sub-sheet, so that
path can be found. Symbols already in the child get an instance entry at the new
sheet's path.
Args:
parent_schematic_path: Path to parent .kicad_sch
sheet_name: Display name for the sheet
sheet_file: Path to child .kicad_sch (must exist)
pins: List of dicts with 'name' (str) and 'direction' (str) keys.
Direction: input, output, bidirectional, tri_state, passive.
x: X position of sheet block (default 25.4)
y: Y position of sheet block (default 25.4)
project_path: Path to .kicad_pro file (for sub-sheet instance tracking)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | No | ||
| y | No | ||
| pins | Yes | ||
| sheet_file | Yes | ||
| sheet_name | Yes | ||
| project_path | No | ||
| parent_schematic_path | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |