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?
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:
Make copy of source project
Reannotate the project to use some unique designators
Update the source PCB to reflect the reannotated designators
Reannotate the newly pasted components to have deisgnators to match the numbering schema used in the new project
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.
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.
You are right. I could make the reference designators unique. It kinda reminds me my early days of line numbering in 8-bit BASIC
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.
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…
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.
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?”…
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
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 …”.
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.
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.
In simplified way I do this:
Ensure schematic symbols/PCB footprint desginators are synchronised
Copy/Paste special… schematic block
Copy/Pate special… PCB block
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…”.
The more detailed steps to above would be:
Open two instances of KiCad, one with the source and another with the destination project.
Synchronise the schematic and PCB on both projects (Tools->Update PCB from Schematic)without re-linking designators
(Schematic editor - Source project) Select the block you wish to copy and Ctrl+C (don’t deselect!)
(Schematic editor - Destination project) Choose a sheet to paste into (see note 1). Right click, Paste Special... → Assign Unique Reference Designators to Pasted Symbols
(PCB editor - Source project) Select the corresponding block on the PCB (See note 2)
(PCB editor - Destination project) Right click, Paste Special... → Assign Unique Reference Designators to Pasted Symbols (see note 1)
(PCB editor - Destination project) Select Tools->Update PCB from Schematic, ensuring you select Re-link footprints to schematic symbols based on their reference designators.
Now you can reannotate as you wish, just remember to deselect “Re-link footprints…” next time you do your update.
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.
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.
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…
I’ve read into the algorithm and you are right. As long as the conditions are met, it will generate same ids.
this binding is not transferred into destination file
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.
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.
So for example one strict requirement is that the two selections (in schema and in pcb) contains the exact components.
Not sure how you can get around this in general - what do you want to happen with the orphaned components?
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…
But for sure - lots of things can be improved. The best will be to have the fine control to synchronise PCB/Schematic.
True. Everytime I do some mass action (update PCB, cleanup tracks, …) I hope that I do not mess something up I’ve had bad PCBs manufactured because my stupid mistake like this and I try to avoid that situation as much as possible…