Align Items To Grid

In the schematics we have the “Align Items To Grid” when right clicking selected areas. Where is that in the PCB editor?

Available as plugin (pcb action tools) from the "Plugin and Content manager.

Additionally there are two gitlab feature request tagged as wishlist issue:

If you look (and search) in the old forum threads you will find some discussions regarding this topic. You will see that there are multiple opinions on this topic and the importance of such a command depends on the user and the used workflow.

Ok thanks, mf_ibfeew, I searched for similar topics but could not find. Amazing this is only available as a plugin in one side (PCB) and as an app-included tool in the other part (SCH)—one more example of non-consistency, even if KiCad is good on other things…

I have never used ‘Align Items to Grid’ but can imagine that aligning to grid in schematic is important - small off grid makes symbol pins being not connected with wires drawn in grid. So if it happens that symbols are off grid it is usable to make them back being in grid just to be connected.

But I don’t know what for at PCB function aligning footprints just to grid would be useful. Being off grid is not important I think.

Unfortunately the action plugin is marked as not compatible with kicad 8.0.6. I havn’t tested if it works or not.

When doing a front panel with plenty of connectors, aligning on the grid would actually be quite useful. Basically to easily align a set of footprint is a kind of table manualy

“Basically to easily align a set of footprint is a kind of table manualy”

Yes, well explained and it’s also about making a PCB not too much wild-hippie, things floating around all random, as well as function it’s also about the visual style.

For me the only elements that have to follow any such rule are the user interface. But it is hardly to imagine for me that any automat will arrange for example the keyboard correctly. I want K0 be here, K1 here and so on. So I have to place them according to my order manually, I think. And having correct grid during it I just have them positioned as needed.
Placing all other elements I have EMC in my head and not PCB visual style.

To put it short, it’s available in the schematics so why not make it consistent and also make it availabe in the PCB. If you want a video example in a case where it could be needed let me know :slight_smile:

When I start to use KiCad its parts (schematic + symbol editor, PCB + footprint editor) were much less consistent than they are now. The problem with making consistent are that people are used to something and they have to change their habit. I think that ‘Align Items to Grid’ is relatively new function in schematic.

It’s available in the schematic because if the end of a wire and a pin are off by even a nanometer (the internal unit of measurement in KiCad) then they aren’t connected; there is no “close enough”.

In the PCB layout, DRC will tell you if you have unconnected nets. Tracks have an actual width and are “magnetic”, which makes them easier to connect together.

I’m not saying there shouldn’t be such a feature in the layout too; I’m just explaining the reasons it isn’t there already.

2 Likes

I sat on my hands for a few days thinking about this idea. I honestly cannot see a purpose for “Align Items to Grid” in the PCB.
What part of an Item ( I assume item = footprint) do you align?
If aligning centroids, there will be an unnecessary spread of footprints with a lot of track repairing.
If aligning footprints, it is quite conceivable that ten different grids are required to align ten different footprints.

Footprints are not designed around a uniform distance between pads the way symbols are designed with pin location.

I just do not understand the purpose of a PCB wide “Align Items to Grid”.

It’s good to know that you think the same way:

In the schematic, ALL pins of EVERY symbol are aligned to a common grid (1,27mm). At least that’s the rule. Only this rule allows you to have such a function in the first place. Which btw. also only works if you are in a 1.27mm (or multiple) grid in the schematic editor. And that’s why you can’t select other grids easily in the schematic editor.

And then:

This. Footprints on the other hand do NOT follow a common grid. Yes, most DIP part have pins aligned to 2.54mm with the origin sitting in pin1. But even a simple capacitor with 2,5mm or 5 mm contact spacing doesn’t align to a 2.54mm grid any more. So like @jmk said: what do you want to align the “align” function to your grid? Pin1? Pin 3? The center of the part? Always the top left pin? Or Edge? Bounding box? On a grid that could be anything as the board editor can (and should, and will) be used with a multitude of different grids, depending of the thing you are designing.

Shortly: its is just not possible, because the parts don’t follow a grid. Also that’s why symbols do.

1 Like

Aligning footprints to grid is useful to place components in an ordered layout.
Moreover, this is a common task in most ECAD sw, so it could be nice to have it natively on kicad.

I would think that the Footprint Anchor would be the point to align to the grid.

The PCB editor does have alignment and distribution functionality from the right mouse button context menu, albeit not an ‘align to grid’ function.

KiCad seems to have mutiple snaps when moving a footprint. After some moving I often notice that same components places in a row (usually 0402, …) don’t line up anymore.
Selecting each of them shows that some have anchor coordinates that match the grid (usually 0,1mm) while others are close, but off:

grafik

Trimming them manually to whatever grid desired will make the row of 0402 appears nicely again.

Maybe I can avoid this by unchecking “Pads” in the Selection Filter. Then PCBnew will always snap to the footprints anchor and move it based on the current grid. This will also get off grid parts back on grid. But parts have to be moved in x and y direction to get both coordinates in line again.

In Eagle there used to be a function (was it holding Ctrl- while moving …???) that would snap the part’s anchor to the nearest grid point. So aligning those 0402s was a matter of setting the desired grid and Ctrl-clicking each of them.

Here’s 2 examples. Both pretty old now. But it was so easy and good.

@TheSwede : your videos show not “Alignment to grid” as requested by your starting topic, but alignment/distribution of components in respect of themself.

As @JamesJ wrote: these commands are already implemented: select footprints, RMB-click–>context menu–>Align/Distribute

edit: the usage is not really intuitive at first:

  • first select the group of footprints
  • then decide, which of these footprints should be the reference for horicontal/vertical alignment.
  • move mouse-pointer over that footprint, activate the RMB-click at that position. This determines the reference-point for the next used alignment command

Correct mf_ibfeew, didn’t see that one before. Thanks.