This is a technique/workaround that i’ve often had to explain on IRC, so i’ll write it up here.
Intention: you wanna cut/paste (basically move) a bunch of things in the schematic from one place to another.
The problem: You have a project that already has complete or partial PCB Layout. If you use the cut/paste function in EEschema (at least in Kicad up to version 5.1.7) this action breaks your layout.
Why? Because when updating the changes to the board (F8), PCBNew uses one of two ways to figure out which Component in the schematic maps to which Footprint in the board:
- Associate by Reference - you know the annotated R1, R2, R3 on resistors, etc…
- Associate by Timestamp
Which one should you use? That depends on what you’re doing…
If you re-annotate the schematic, some components may turn out to get different Reference numbers compared to last time, and if you update (F8) the board with “Associate by Reference” it’s gonna get mixed up. In this case, use the Timestamp.
What’s the timestamp? Every symbol that you insert in the schematic gets a unique timestamp. It’s simply a fancy number that probably contains the current Date/time (down to seconds or maybe also miliseconds, that’s not important) … this timestamp then does not change if you re-annotate… that’s all good.
It also does not get copied… if you copy © an existing resistor and place it on the schematic, it will have the same properties as the one it was copied from, but it’ll get a fresh new timestamp (and no annotation).
Anyway… The problem: I’d think the problem is that Cut+Paste probably uses the Copy+Paste functionality…
- Cut copies a bunch of things you have selected into a clipboard/buffer, but then also get removed from the original place
- Paste lets you put the stuff from that buffer somewhere in the schematic.
It makes sense for Paste to insert the symbols as new ones when you’re copying, so the References get cleared, and the timestamps too… you get fresh new timestamps.
Basically Cut+Paste is not “Move” … there’s no way to “Move” things… Cut+Paste is the closest thing but it erases both kinds of information that can be used to keep the Schematic+Board synchronized.
The technique:
The timestamp can’t be editted, so we’ll have to use the References.
With this technique, you will loose your current Reference numbers (if you care for them).
With this technique, you cannot move many things between sheets in one go.
If you would need new hierarchical sheets - make them now before you start.
- Save your schematic and board, make a backup before you begin.
- Clear the annotation. (CHECKPOINT1)
- Annotate the whole schematic with a simple sorting rule, don’t use the “sheet number X 100” !!! Use the “first free number after 0”.
- Inspect the schematic, hopefully nothing has broken (watch out for those multi-unit symbols)
- F8 (update board) - Associate by timestamps
- Inspect the result - electrical connections shouldn’t have changed, there should be no new footprints, no deleted footprints…
- If everything so far is okay - Save schematic and board. (CHECKPOINT2)
- Box-select a circuit in the schematic and Cut it.
If it’s difficult because of surrounding circuits - move it off the sheet into an empty place, don’t re-arange the symbols in it!
Once you got it all there - box-select it and Cut it.
Now some components have vanished from your circuit and you probably have “holes” in the annotation (numbers that aren’t used). - Go to a different place - Paste.
Now you have your circuit back, but it’s “brainwashed” (different timestamps, no annotation) - Partially annotate the missing numbers - use the same rule, keep existing annotations.
The idea here is that you should “happen to get” the same numbers as those at CHECKPOINT2. This is why it’s important to not re-arrange the symbols during this manouver, nor to try and cut/paste one circuit from A to B, and another circuit from X to Y in one go. - Inspect the schematic…
- F8 (update board) - Associate by References!
- Inspect the result - there should be no broken connections… etc…
At this point, you can use Timestamps again, but the circuit that you just pasted will NOT get the same numbers if you re-annotate.
Thus, if you have more circuits to “move”, repeat the process from step1 or step2 all the way down to step13, for each circuit.
Once everything is in its new place, you can use Timestamps again and completely re-annotate the schematic the way you want (and F8 - associate by timestamps).
IMO Cut+Paste should have been made to keep the timestamps and reference numbers, and once you Paste - the buffer should get erased so that you can’t Paste the same thing again.