Copy/paste multiple components in schematic and PCB

tl;dr
I love using KiCad but there are few things that drives me crazy. One of them is the ability to copy from one project to another - both schematic and PCB. Is there an easy and safe way how to do it?

Longer version
I have two projects - both are functional and works. Then I need to copy a piece of one of them (i.e. power supply) to the other one (i.e. it used to have external power supply and now I need to include my own). This is a thing that in this day and age should not take more than few minutes. However I was not able to find a consistent and safe way how to do itā€¦
If I am not mistaken in version 5.x it was not possible to copy/paste from different projects at all. Now it is possible and there is even the Paste special option.
However when I paste in the schema the components get reassigned reference designators. Then in PCB editor the designators does not get reassigned (or maybe I did something wrong). I can use the ā€œpaste specialā€ and force all the copied in objects to reassign designators. But all this get me little unease as I do not feel safe that the components does not get mixed up between schematic and PCB. It may also happen that I did not select all all the same components in two separate copy/paste operations.
And all that because the reference designators are not globally unique - that is a really frustrating for me as I am more software developer than electronics person and I know the importance of the principle of having globally unique identifiers. And it drives me crazy that I know that internally KiCad uses such identifiers but somehow they are not used while copy/pasteā€¦

So for now I have this workflow:

  1. Make copy of source project

  2. Reannotate the project to use some unique designators

  3. Update the source PCB to reflect the reannotated designators

  4. Copy/paste

  5. Reannotate the newly pasted components to have deisgnators to match the numbering schema used in the new project

  6. Update destination PCB to match its schematic

I find this cumbersome and error prone but it is the simplest workflow that I have found.

Am I missing some sort of elephant in the room?

I tried a lot of workflows, using append board, hierarchical sheets, editng the files in text editor but I was not able to find a better solution.

One thing that could help me is the ability to manually relink footprints and symbols. I know I can relink the whole PCB (in both directions) but I do not want to relink the whole board. I get very frustrated that I can select symbol in one window, footprint in second and now I would like to say: ā€œHey KiCad, these two are the same, link themā€¦ā€

I even had the idea to have unique designators for all my projects by using some sort of prefix but that got confused really quick.

1 Like

I think you have already developed a secure workflow to copy-paste schematic and layout portions to a different project, so no better idea from me.

For the manually relinking of single symbols<ā€“>footprints there is already a open gitlab issue, but there has not much happened: Add a system for fine control over SCH->PCB and PCB->SCH update actions (#7272) Ā· Issues Ā· KiCad / KiCad Source Code / kicad Ā· GitLab
aabb

Yeah, thanks for the link. It is bitter-sweet reading though:

Another thing that falls into this category is matching up links between symbols and footprints. Altium allows manual reconciliation if these links are broken (for example, because of a copy/paste)

Jon Evans removed milestone %7.0 10 months ago.

At least I voted for the issue.

The thing is that my workflow is really cumbersome and still error prone.

Manually annoting a few components if oversee-able and not a poor solution for your problem. However if we talk about 20+ componentsā€¦ I feel your pain.

You can still special past symbols n such to your existing schematic or import a schematic sheets. But if you have overlapping references you need to redo annonations.

The schematic sheets are really good in this. You can automatically reanonate 1 sheet without affecting the rest.

This leaves you however with manually doing annonation on the PCB part.

What you can do is ā€˜reserveā€™ certain refence numbers and use higher numbers. If your power circuit has itā€™s own sheet. You can just let all 4 digit numbers start at idk, lets take 12xx. From this moment and onward, all your components which start with 12xx belong to that specific power circuit.

So you can special paste this schematic, use the same reference numbers like they had. Afteral all 12xx numbers are already unique. Than you can copy paste the PCB part and use the same numbers as well.

I know it is all but ideal. I also would like to see something easiers.

Regards,

Bas

1 Like

You are right. I could make the reference designators unique. It kinda reminds me my early days of line numbering in 8-bit BASIC :slight_smile:

However this solution work best if I have the schematic prepared for copy/pasting that particular block. For example if power supply is 15xx in every project than it could work however if I need just copy a piece of the power supply and there also is another power supply in the destination schematics.

Kicad keeps us busy allright. Managing your own libaries and make symbols for unique values and footprint sizes, making templates, manully annonating footprints, making re-usable schematic sheets, replacing global labels by hierarchial ones, refactoring schematics to make them up-2-date with your new standards, continously think about how to improve your workflow, finding the least crappy method to get some job done like reusing PCB partsā€¦ And than we also have our software to maintain and our git repositories n all. :wink: :+1:t2:

Bas

I completely agree. KiCad is great opensource project that enables us to design PCBs in a very comfortable way. We would not be able to fit Altium or something commercial into our budget. And a lot of things are done great in KiCad and what a lot of things not done directly in KiCad can be done with many plugins or external tools.
But this issue is one of the most annoying details that drive me crazy as I feel that it should be very easy to just copy/paste piece of board into anotherā€¦ :slight_smile:

My solution is to treat each project as unique. If portions of one project are copied to another because they are suitable, well, Iā€™ve saved a little time and effort in drawing and circuit proving. Well done me!

Maybe Iā€™ll leave a text reference to the previous use of a design, but that is usually all.:slightly_smiling_face:

You are right. However the way we use electronics in our projects is that we create a lot of prototypes while we develop software/firmware for it. So we have a lot of different designs and the ā€œcopy/paste situationā€ happens a lot - ā€œthis thing is working nicely on this prototype, lets use it on that oneā€¦ā€ or ā€œWould it be possible to replace the FPGA with different version?ā€ or ā€œWould it be better to combine these two prototypes together?ā€ā€¦

1 Like

Hi,

Slightly of topic, and take what Iā€™m saying under advisement (because I canā€™t remember where I saw it to confirm the details before posting here). But I think this can be done with hierachical sheets and I templates or something similar.

Basically if you change your workflow to be as modular as possible you can import preconfigured / premade schematics into any project.

Yeah, hierarchical sheets are a great way how to make schematic modular. I use them a lot, however that is what I meant by " if I have the schematic prepared for copy/pasting that particular block". SO basically if you created the blocks somehow and then realize that you would need them differently, then it is not useful.
For example I have and Flash for FPGA configuration. So it goes to FPGA sheet. Then I realize that the memory can be used also for storing some calibration data for the MCU. So now it would be great to have Flash on its own sheetā€¦ I either end up with every component on its own sheet or I need to restructure the sheets all the timeā€¦
And of course it is only for schematics not for the board. So it will not help me with the issue at all :frowning:

Regarding re-use for board: there is a long running issue for board design block re-use here: Support design blocks (reuse library) for PCBs (lp:#1846332) (#2508) Ā· Issues Ā· KiCad / KiCad Source Code / kicad Ā· GitLab

worth giving a thumbs up if you havenā€™t already. (No timeline for it, but showing support doesnā€™t hurt)

Upvoted. However what would make me happy would be much simpler. Just be able to copy/paste of part schematic and board without reshuffling designator. I.e. paste special option: ā€œPrefix all designators with ā€¦ā€.

1 Like

Thatā€™s an actionable feature request for both editors that Iā€™d happily upvote if you are willing to write it up!

In the short term, it may already be possible with a PCB editor action plug-in for the layout side, where youā€™d paste into the plug-in and it would do the designator changes and finish pasting into the layout.

There is always this to fall back on:

It only works with numbers though. Canā€™t prefix with letters.

You could also add an extra field to identify the copied Refs.

You can do so in the schematic. You are ofcourse free to give one group of resistors a different pre-fix than an other group. I donā€™t think I would ever do that, but who knows?

This exactly is the purpose of the Paste Specialā€¦ ā†’ Unique Designators tool. Iā€™ll be honest that it is a little cumbersome/clunky but it works for my needs for now.

TL;DR

In simplified way I do this:

  1. Ensure schematic symbols/PCB footprint desginators are synchronised
  2. Copy/Paste specialā€¦ schematic block
  3. Copy/Pate specialā€¦ PCB block
  4. Synchronise PCB and schematic in destination project (Update PCB from Schematic) using Re-link footprints to schematic symbols based on their reference designators

After this, everything will be in sync. You can now use the re-annotation tools to reannotate as desired. When synchronising schematic/PCB the second time you should not select to ā€œRe-link footprintsā€¦ā€.

Detailed steps

The more detailed steps to above would be:

  1. Open two instances of KiCad, one with the source and another with the destination project.
  2. Synchronise the schematic and PCB on both projects (Tools->Update PCB from Schematic) without re-linking designators
  3. (Schematic editor - Source project) Select the block you wish to copy and Ctrl+C (donā€™t deselect!)
  4. (Schematic editor - Destination project) Choose a sheet to paste into (see note 1). Right click, Paste Special... ā†’ Assign Unique Reference Designators to Pasted Symbols
  5. (PCB editor - Source project) Select the corresponding block on the PCB (See note 2)
  6. (PCB editor - Destination project) Right click, Paste Special... ā†’ Assign Unique Reference Designators to Pasted Symbols (see note 1)
  7. (PCB editor - Destination project) Select Tools->Update PCB from Schematic, ensuring you select Re-link footprints to schematic symbols based on their reference designators.
  8. Now you can reannotate as you wish, just remember to deselect ā€œRe-link footprintsā€¦ā€ next time you do your update.

Notes:

  1. If (in the destination project) the sheet that you paste into happens to be instantiated multiple times, Paste Special in the schematic will still work as expected and create unique designators for each instance. However, when pasting in the PCB Editor, you will need to repeat step 6 as many times as there are instances for the sheet you pasted into.
  2. You can either select the block on the PCB manually or keep the selection in the schematic editor and right click ā†’ Select on PCB. Then in the PCB editor, you can use the ā€œExpand selectionā€ tool (U) to select adjacent tracks.

References:

Announcement post of the Paste Special feature: Post-v5 new features and development news - #379 by Qbort
Implementation detail of Paste Special with unique annotations (in case of interest): Paste in KiCad v6 - Google Docs

7 Likes

Thanks! This looks really neat and so far is the most clean solution. I will look deeper into the referenced links but there is still one problem that bugs meā€¦ But as I understand it is not possible to overcome with the current state of KiCad.

The issue is that while there is a perfectly fine binding in the source file (via uniqueID) this binding is not transferred into destination file. And it is recreated by two separate steps ( Paste Special... ā†’ Assign Unique Reference Designators to Pasted Symbols ) and I have to check that the binding is recreated fineā€¦
So for example one strict requirement is that the two selections (in schema and in pcb) contains the exact components. Which is cleverly avoided by using Select on PCB. However it seems to me like a workaround. Or like inventing a machine to swap buckets under leaking roof instead of fixing the roof.
And also the need to have the schematic and PCB synchronized before the operation may be issue some timesā€¦
But as I said even though I see minor details and requirements that need to be met, I will try to use this as my new workflow for thisā€¦

It should always work correctly as long as your PCB and Schematic are synchronised before you start. It would be a bug that Iā€™d need to fix if that wasnā€™t the case.

It canā€™t be transferred - otherwise we are defeating the whole point of a universally unique ID. When you paste a new ID must be generated always.

Not sure how you can get around this in general - what do you want to happen with the orphaned components?

But for sure - lots of things can be improved. The best will be to have the fine control to synchronise PCB/Schematic.

1 Like

Iā€™ve read into the algorithm and you are right. As long as the conditions are met, it will generate same ids.

But I am saying something a little different. I do not care about the UniqueIDs, I care about the bindings they provide. So for example having a map of ā€œknown IDsā€ and assigned new IDs could make it that if you paste in the component with same UniqueID twice, it will have the same new ID. Or you could hash the original UniqueID with some sort of project seedā€¦ To be frank, I think that this is too much detail for normal user to care about. All I would like is that if I copy symbols and footprints that they keep linked.

The same as happens when you add new footprint or symbol. But as I mentioned few lines above, the best thing would be to just copy/paste and it would stay linked if it was linked.
One way that could be accomplished - although simple in concept yet difficult to code - would be to copy symbols and footprints at once. Then you can regenerate the IDs all you want but still you can keep the new IDs linked as they were in the source fileā€¦

True. Everytime I do some mass action (update PCB, cleanup tracks, ā€¦) I hope that I do not mess something up :slight_smile: Iā€™ve had bad PCBs manufactured because my stupid mistake like this and I try to avoid that situation as much as possibleā€¦