Align Footprints by Anchor/Center, rather than Silkscreen

One thing that really annoys me about kicad is that when I try to align footprints, it completely ignores the pre-existing anchor point. As a result it takes everything into account, including the silkscreen components, which means things get ‘aligned’ semi-randomly and I have to manually align things. Is there a way to get it to align properly?

Is there a way to get it to align properly?

Select all interesting footprints, open properties panel, set x or y value to the desired location for all items.

Yeah that’s one of the manual alignment methods i mentioned. Is there really no way to get the in-built ‘align’ tool to utilize the anchors?

No. (20chars are needed)

You can start with setting the selection filter to Footprints only. Then you can select a bunch of footprints with the selection tools, then do a right click and select: Align/Distribute / … (This context menu has several options)

Correct. The problem I outlined in my OP is that, for whatever reason, the alignment tools don’t operate based off of the defined footprint anchors (or at least center of a defined courtyard). Instead, it seems to find a center of mass of all of the little bits and pieces of the footprint, silkscreen elements included. This poses a problem when I have components with little labels to one of the sides and need to align them. Since the silkscreen elements matter, all of the components are offset weirdly.

The alignment of these relays, for example, is a product of the ‘align’ functions. Note the red line demonstrating where the middle relay should be.

Are you sure these footprints are done right?
I’ve tried what you just did, but with KiCad’s default relay library and it aligns to center, perfectly.


Can you post the footprint file?
Now that I look at it more closely I can’t see the courtyard (the first thing that the align and distribute tool looks at).

I find the Align / distribute functions a bit cumbersome to use. Sure, they are quick, but I don’t know what they really do exactly. Do those functions save you any time if you have to do it over a few times because their result is not what you expected? Overall I’m more for simple and reliable methods myself. For example set a grid, and then place the parts one by one on the grid.

I would only consider more automated methods when a lot of parts are involved. for example an LED array of more then 50 LED’s, but I have not made a PCB for that yet. And even for such an array, I would probably use a hierarchical schematic and use the Replicate Layout plugin to place the majority of the LED’s.

The problem I outlined in my OP is that, for whatever reason, the alignment tools don’t operate based off of the defined footprint anchors.

The “whatever reason” is probably that the aligning tools are not designed to work on the anchor point. As said: for aligning footprints with their anchor points you should use different tools/workflows.

The Aligning tools are useful for aligning footprints according to their drawn shapes. If you want to align some footprints (especially different footprints with different shapes) on a board edge, then this is useful.
Obviously this works only if the footprints don’t have additional disturbing shapes drawn outside their normal courtyard. So this is a tool for some situations, but seemingly not for your usecase.

Note also: your picture is not very meaningful. At least you had to include the “additional shapes” which you think disturb the aligning tool. If you would additionally attach the archived project this would be even better - that allows to reproduce your problem and to really judge between bug/bad program behaviour/unreasonable user expectation and lastly (happens sometimes) user error.

Note II: to attach a example project you need basic user level on this forum. Read and follow this FAQ: New Member Information description:

One solution, if we think about how KiCad could be enhanced, could be to use only the visible layers for alignment. That would allow quite much control by the user: courtyard, fab, pads, mask, user defined layers. The user could even add a graphic marking in a dedicated layer for the footprint anchor, if using custom libraries.

In any case the alignment function requires some rigorous rules for footprints, like KLC conventions. And as was said, using the anchor points themselves doesn’t make much sense because you can easily use other features of KiCad for that, and using one coordinate point makes sense only for center alignment, not top/bottom/left/right.

We will see if the real scripting mechanism will be ready for v9 when it’s released next year. I also hope there will be a way to attach a hotkey for a specific script. Then it would be easy to create a script for “align according to anchor” function and call it with one keystroke.

1 Like