How do you align components by courtyard?

I’m taking a look at KiCad again to see if it would work for a high-performance high-density board. This requires using “least” density and packing components as tight as possible.

I’m having trouble figuring how to align components using their courtyard. For example, if I have two resistors in series, I want them together as close as possible so that their courtyards are touching.

So far the only solution I’ve been able to come up with is to place them as close as I can visually, make the grid really small, nudge the component closer, run DRC, nudge closer, run DRC, and so on. However, this seems like it would quickly get tedious.

Courtyard of all my footprints are in 0.1mm grid. I work with PCB with grid set to 0.1mm. I have no problem to place footprints with their courtyards just touching.
But it happened in the past that having not enough place I placed elements closer then their courtyard boxes (it was not with KiCad those time).

1 Like

I was messing around some more and had another idea. I made the line for the courtyard much narrower than the smallest grid (the default lines for courtyards are pretty fat). This way I can zoom in and much easier see if the courtyards are overlapping without having to use DRC to do so. This still seems like an imprecise way of arranging components, but I guess if you make the grid fine enough it won’t really matter at that point. I still think a feature where you could align left-edge-to-right-edge would be useful, even if it wasn’t dynamic.

This doesn’t help with the workflow, but by using the courtyard outlines you won’t get the best possible density and won’t pack components “as tight as possible”. Courtyards are a guess, most probably the assembly machine and/or a human assembler can do tighter. If you want tight design, pack the courtyard of one component to the nearest pad of the next one, sometimes even tighter. And use the 3D view if possible to visualize how they would be soldered manually if that’s what you do. I haven’t seen problems with machine assembly even with tighter placement.

About a year ago, there was an idea / feature request posted on gitlab for being able to add configurable snap points to footprints, for example for snappable connectors that need a specific pitch.

I did a bit of testing in Kicad because of this, and I would have expected that if F.Courtyard is selected as the active layer, that the courtyard lines could be used as snap points, but this does NOT work for me.

If you deselect Pcb Editor / Preferences / Preferences / Editing / Warp mouse to origin of moved object and also turn the grid off with Pcb Editor / Preferences / Preferences / PCB Editor / Display Options / Snap to Grid: When grid is shown (and then turn the grid itself off) it is quite easy to line up stuff visually to pixel size. (KiCad works with nanometer resolution internally, so “raw” resolution is not going to to be a problem)

KiCad does have some extra features that may be useful. First, if you select a bunch of resistors you can then right click and select Align/Distribute from the popup menu.

A function that works quite nicely is the “Position relative to” from the popup menu. To use it:

  1. Select a resistor you want to move.
  2. Right click, and from the popup menu select: Special Tools / Position Relative to
  3. Select [Select Item…] and click on another resistor.
  4. Enter the offsets you want for X and Y (KiCad remembers this for the next move).

While doing this, you have to be careful what you select. For example snap points can be the center of a resistor, or a pad, or any other item that can be snapped to. You can limit the false positives by turning off certain items in the Selection Filter in the lower right corner.

And as eelik already wrote, courtyards are usually an estimate based on some rules for when parts should be easily placeable by P&P machines. They are not reliable for high density boards, unless you design your own footprint libraries and adjust your courtyards for your minimum rules.

You can also hover over a footprint, press e to edit it’s properties and directly type in some coordinate. You can also use simple formulas in those edit boxes. for example if you add “+5” behind an X coordinate, then it moves it 5 “units” to the left If you type “+5mm” after a number, then that coordinate is made 5mm bigger regardless of what the current unit is set to (mm, inch, mil).

And there are probably more tricks you can use to work quicker and more comfortable.

For me it looks that you forgot that a program is for you and not you for program. I didn’t used V6 yet but I suppose there you can switch in DRC to not check Courtyards. That would be the best solution for you.
I set courtyards to have enough space (with some margin) between elements for precision tweezers. But you always can give up that margin and even that space. There are small vacuum keepers you can keep your elements just from top and you don’t need a space between elements body - so the pad clearance would be the only limitation.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.