KiCad Move Block to Sheet and Retain Annotations
The Problem
Currently, I am working with one of my senior design capstone team members to develop and create the schematic. To get going faster and be sure to give everyone the opportunity to work on the design, we took alternating turns on design and layout. This created a problem for when we wanted to refactor the schematic to make it more clear.
In KiCad 5 and below, one is unable to move an existing schematic block into a sheet without losing all schematic annotations. The copy and paste operation automatically resets all annotations. This is a big problem if you have already done some layout. Because if the annotations do not match the existing layout, the existing layout will be automatically deleted upon netlist import.
To avoid redoing work I had to find a solution.
The Solution
My solution takes advantage of the fact that KiCad's data files are all plain text and a little trickery on my part. Essentially I did a direct schematic import through the Append Schematic Sheet Content...
tool, however, this is not straight forward as the hierarchical sheet forms a circular dependency in the parent sheet, and consequently KiCad blocks this operation. To get around that I found that if the path to the child hierarchical sheet was gone or corrupted, the standalone version of Eeschema will let me import the parent into the child. Once this is done, the original (now duplicate) block can be removed in the parent sheet and the child will prevail with the original annotations. See the video below for the process.
With the annotations intact, one is able to fully refactor the schematic without affecting the circuit board layout.
Step by Step
- Save a backup, close out of the KiCad project
- Open the parent
*.sch
file in a plain text editor - Find the child
*sch
file, and append a character to the end, save - Open the child in
Eeschema (Standalone)
- Move all items far off of the sheet (the parent imports in place)
- Append parent,
File
->Append Schematic Sheet Content...
- Delete all blocks that are not desired and recenter schematic
- Save and exit
- Restore original file path in text editor
- Open parent, remove original block
- Enjoy!
Going Forward
Interestingly enough, I am not the only one who has been in this situation. On the KiCad forum a question was asked and a bug was created to fix this issue and has been committed. This makes the above guide pointless for those on the nightly 5.99 releases and will be available for all starting with KiCad V6.