How to snap a footprint to reference geometry?

How to snap a footprint to reference geometry?

Hi. I’m new here and new to KiCAD.

I’ve tried searching the history but all related posts I’ve found are quite old. Perhaps KiCAD 6.0 has a new way of doing this.

I have to precisely position a bunch of components (LEDs) on my board to line up with corresponding features on my case. They’re at irregular locations, so a rectangular grid or array won’t help.

I’ve designed the case in CAD (Fusion 360), created a reference sketch keyed to the case geometry, exported to DXF, and imported to a user layer in the PCB editor. So far so good.

I did so because I expected to find some kind of ‘gravity snap to nearest vertex’ command in the PCB editor. Is it hiding somewhere?

At the moment, I’m reduced to using a super-high-resolution grid and eyeballing it. There’s gotta be a better way.

-Matt

in v6 footprints (assumed they are on top-layer) can snap to:

  • other footprints (anchorpoint to anchorpint)
  • endpoint of lines on the top-copper-layer.
  • corner-points and mid-side-points of graphical rectangles (on top copper)
  • all corner-points of a drawn polygon at top copper.
  • center-point of circles

precondition: look at preferences–>pcb-editor–>editing-options–>Magnetic Points and set “snap to graphics” to “always”

If you have only a small number of footprints which you need to position: doubleclick each footprint and enter the x/y-coordinates in the “footprint-properties” dialog

If you want to go the “snap footprint” way you have to:

  • draw a polygon in MCAD (Fusion). The polygon should connect all LED-points, every corner point of the polygon == one LED-position
  • alternative draw a circle (diameter >= 2mm) onto every desired footprint-point
  • import the saved dxf-file into pcbnew, onto the F.Cu (top copper) layer.
  • change the grid to some very coarse setting → this simplifies the snapping functionality
  • drag the desired LED-footprints onto the circle/polygon-corner-points. A snapping-circle should appear if the footprint approaches the circle/polygon
2 Likes

There is a FAQ (top of this forum page) that has been written for 6.0.0.
It may help:
https://forum.kicad.info/t/coordinate-system-grid-and-origins-in-the-pcb-editor/24535

Thanks a million, mf_ibfeew, that’s exactly what I was after. It works great.

The only thing I was missing was to import to the copper layer. That seems counter-intuitive, since I don’t want this geometry to define any copper.

Should I remove the alignment geometry once my footprints are placed? …or will KiCAD ignore my imported geometry when creating the Gerber for that layer?

Thanks, jmk. I saw that FAQ, but it doesn’t say anything about this ‘magnetic point’ feature.

Is it documented anywhere else?

If not, I think it would be a good candidate for a FAQ or something. I couldn’t find it in 6.0 release notes, or FAQ or anywhere.

1 Like

Thankyou, that will go on my list :slightly_smiling_face:

The only thing I was missing was to import to the copper layer. That seems counter-intuitive, since I don’t want this geometry to define any copper.

Yeah, actual snapping works only at the actual layer. Snapping to elements on different layers is on the developers-feature-list. Time will show…

Should I remove the alignment geometry once my footprints are placed? …

Yes, remove it. Or if you want to keep it (as geometric reference) change its layer to user.drawing (or similar):

  • select the snapping-geometry
  • main-menubar → Edit → Edit Text&graphics-properties → change layer

or will KiCAD ignore my imported geometry when creating the Gerber for that layer?

No. But Kicad would probably report a massive amount of DRC-errors (as your imported copper-graphics interfere with the copper-pads of your LED-footprints) so it would remind you to delete the graphics if you forget it.
With this deleting-action in mind: during import of the dxf-snapping-graphics: choose checkbox “import as group” → so you can later delete the whole snapping-graphics with one delete-action.

Not really so.

While moving footprints, I can not manage to snap to circles on a graphical layer, but I can snap to circles drawn on any copper layer.

The best workaround therefore probably is to temporarily increase the layer count of your PCB with Pcb Editor / File / Board Setup / Board Stackup / Physical Stackup, and then import your graphic on an extra copper layer to have your snap points.

Another trick that can work in some situations is to change the grid location for each move. The grid origin Pcb Editor / Place / Grid Origin S does snap to graphical items, so if you align the grid with a circle, you can place a LED on the grid and align with that circle. You do have to move the grid for each of the LED’s.

1 Like

actual snapping works only at the actual layer

Not really so.
While moving footprints, I can not manage to snap to circles on a graphical layer, but I can snap to circles drawn on any copper layer.

ok, my first statement was not exact. It should be:
snapping works only at elements on the layer which the moved/dragged/drawed element is on:

  • moving SMD/THT-footprints on top (F.Cu) snap to elements on top copper (not bottom)
  • moving SMD/THT-footprints on bottom snap to elements bot copper
  • additionally for THT-footprints: if moving the THT-footprint with a selected pad it really snaps to items on all copper layers. for this:
    • checkbox “allow free pads” has to be of in preferences
    • select only a pad of the THT-footprint (not the whole footprint)
    • now hit hotkey “m” for “move” → this moves the whole footprint and snapping occurs to all copper layers (as paul said)
  • moving/drawing graphics on silkscreen (or any other non-copperlayer): snaps only to other items on silkscreen

For me the actual feeling is that the snapping is not 100% consistent througout the whole design-process and has too many exceptions.

  • adding footprints: no snapping
  • copying/pasting footprints: snapping
  • moving footprints: snapping
  • dragging footprints: no snapping
  • moving vias: seems to depend if the via was placed during track-routing or as free-standing via
  • the above mentioned difference if a THT-footprint is moved as footprint or moved after selecting a pad (ok, this could be tagged as feature for experienced users)

Due to this constrictions I try to use only the 2 basic snapping features:

  • graphics elements to other graphic elements on same layer
  • footprints on items on same copper layer
1 Like

Nope.
I did a test during writing of my previous post, and I could snap an LED footprint to a circle on an internal layer of the PCB.

Unless… It was a THT footprint, so maybe those exist on all copper layers?

I agree with that. I can’t (bother to) remember all action and snapping combinations that (do not) work. The best way is probably to experiment a bit.

Thanks to all who provided feedback to this topic. Great tips.

I’ve chosen to move the geometry to a user layer after layout, as suggested by mf_ibfeew.

I figured out a trick of my own too.

The LEDs I’m placing are the addressable sort (SK6812), which each have a companion capacitor. I’d like to place the center of the LED using the aforesaid techniques, but keep the capacitor at a uniform location relative to the LED. The method I came up with is:

  • Move the LED to a grid point.
  • Move the capacitor to its companion point, also using the grid.
  • Shift-select both the LED and the capacitor
  • Initiate the ‘move’ command with the cursor at the LED footprint’s origin point (which, thankfully, is at the center of the light source).
  • Now, I can snap both components to the reference geometry, keeping the capacitor in its proper relative position.

-Matt

2 Likes