Kicad board layout question

Hi all,
I’ve worked for 4 days on a schematic and now I’m ready to lay out the board. I now go from my orderly and tidy Schematic to this mess:

Does anyone know if there is a way to not just import all components as a “pile”, but rather to keep components in groups similar to how you drew them in the schematic? I’m quite sure that I could save an entire day of sorting resistors can capacitors here…


I was wondering about this just yesterday: I watched a video about Eagle, and there’s a feature there where you can select a group of items on a schematic and have them highlighted for moving as a group in the layout. It looks like KiCad doesn’t have this. You an select a single component on the schematic and it’s highlighted in the layout, but you can’t select multiple components for highlighting (as far as I can tell).

Yeah. Without the cross-highlighting this would be impossible, but you can only do this for one part at a time. I have many hundred parts… Maybe @ChrisGammell knows a trick?

I think there are a few add-ons that may help.

Have a look at:

Disclaimer: I haven’t yet tried these.

A good list of plugins can be found at:


So one “workaround” (and it truly is that) would be to put the different groups into different subsheets. Then you use the annotate function that labels parts with first free sheet after number x 100. This then groups all of your components by sheet, effectively, and I recall the last time I did that, it also grouped them by number when I imported into the schematic.


That’s a bit of a hassle, of course, and probably doesn’t make for a great looking schematic.

One thing that I normally am doing when I do layout with a lot of components is I’ll do a split screen and I’ll use the “T” key to search for parts and pull them in. Sometimes it helps to not use the actual schematic, and instead use a PDF, so that it doesn’t jump around as you are grabbing various components.

That HierPlace plugin looks interesting, Dave V makes some really great tools for KiCad.

Neither of those scripts helped me much since they require using subsheets, so I sat down and wrote a small Python script that can do this. It’s extremely simple, but does the job on all the files I’ve tested: GitHub - jenschr/KiCad-parts: Schematics, footprints and scripts I've made and tested for KiCad

It took me some time since Python is something I only do when the need arises, but it was a good reminder of how flexible that language is :wink:

So it will take this schematic:

And this typical PCB layout file:

And it will produce a brand new file called “new.kicad_pcb” that looks like this:

It won’t lay out your board, but it will make it MUCH easier to locate where your parts belong :smiley:

Posted it on also, so others can find it more easily.


That looks incredible, thank you for doing that. That really should just be a KiCAD feature.

Oh, that is a genius idea! I was trying to work out how you could use the structure of the schematic to help lay things out, but just using the positions from the schematic is brilliant!

I guess it has trouble with hierarchical sheets? I don’t know what would be the best way to deal with those.

For that, you’d likely need to know Python better than I do? Then again - this works on a very simple basis. It only looks up the Unique identifiers + positions in one text file, matches them with the PCB file, looks a few positions backward in the PCB file to find the position (may vary a little) and then overwrites the PCB position line. I really love that Kicad is all text. Makes stuff like this much easier!

But - I don’t have any good schematic files with multiple sheets available (I prefer just making my schematic bigger). Maybe some of you could test this on multi-sheet files?

I think that simple approach is close to perfect. I can think of a very quick and dirty way to make it work for hierarchical schematics. I’ll have a go at doing it this weekend.

1 Like

I wonder if the ideal KiCAD integration might be an option somewhere in the netlist importer (or just a menu option somewhere, since it’s rarely used) to take default positions from the schematic like that.

For subsheets - I suspect it doesn’t matter where exactly they get placed, once the subsheet components themselves are all grouped together-ish?

Really love this logical grouping - I spend so damn long reproducing something like this before I can really consider the physical layout, it’s a necessary, time wasting step, particularly for things like decoupling cap close to the correct pins etc. Nice work!

Right. I think for sub-sheets, all that’s needed is to make sure each sub-sheet (and the main sheet) have their components placed in non-overlapping regions. You’re going to move everything around right away anyway, so it doesn’t matter too much exactly where things are at that high-level, so long as there is some logical grouping (which you can control by how you lay components out in the schematic).

@jensa This looks great! So far I have tended to manually cross-highlight the schematic to group circuits for layout.

This is a great starting point which should speed things up. Out of curiosity, what happens if you use it on a hierarchical sheet?

It doesn’t work for hierarchical sheets yet, as far as I can tell. I’m going to try to do something for that tomorrow.


I made a few changes to Jens’s script to make it work as a KiCad plugin and to make it work with hierarchical sheets. If you take the script from and copy it into your ~/.kicad_plugins directory, you should be able to use it as an entry in the “Tools -> External Plugins…” menu item in pcbnew.

The plugin just rearranges all the components in the layout to match the way they’re arranged in the schematic without doing anything to the layout file. It happens as a normal editing action, so you can do it, take a look, and undo it if you don’t like what you see. If you do like what you see, you can save the layout and continue editing.

(The way that hierarchical sheets are handled is rough: each sheet is just laid out in order down the page, ensuring no overlaps. Given what this thing is intended to be used for – the very first organisation of components when you first import a new netlist – that seems like a reasonable way to go.)


@jensa I think it’s a fantastic idea, can’t believe the scornful response it got on the KiCad forum :frowning:

@ian thanks for taking it up a level, this is one plugin I will definitely install!

I don’t know why, but I went to have a look at the KiCad forum discussion about it. It made me sigh. Certainly doesn’t inspire me to join the forums there…

Unfortunately it does not show up for me in Tools->External Plugins. I copied the script text from the repo, saved it to a text file with ‘.py’ as its extension, and put it in my scripts folder. I know (I think) that I’ve put it in the right place because it’s in the same directory as HTMLBOMGenerator, which does appear in the External Plugins menu.

Does pressing “Refresh plugins” under the Tools menu make any difference? And what version of KiCad do you have? I’ve only tested it with 5.1.6, and I’ve only started using KiCad quite recently, so I’m not at all familiar with differences with earlier versions.

Refreshing doesn’t help, nor does quitting out and relaunching KiCad. I’m running 5.1.6 under MacOS right now; will give it a shot under Windows when I have a chance.