Snap module / modules-block to grid (pcbnew)

Is there a way to snap a footprint module or a selection of footprint modules to the selected grid?
In old Legacy Canvas there were the option to snap at least a single footprint to grid just going over it with the mouse and pressing ‘G’, but it seems this option is not available anymore.

The normal move command snaps to the grid. It might however be hard if the distance between the starting position and nearest grid point is very small as the starting position is added as an additional snap point. This at least works when selecting a single footprint. (as the cursor reference point is then placed at the footprints origin)

Tested in 5.1.5 modern accelerated toolset under fedora.

I’ve tried on Win with 5.1.5 and GAL (F11) and setting a Grid to i.e. 2.54 then press M and move the object, but the footprint gets a delta move using the grid, but doesn’t snap to grid…
The function instead is working if Legacy (F9) is used.

1 Like

I can move it both such that i have a delta as well as it snapping to the grid. (delta works only if i move only in orthogonal direction. So if in doubt move it first by one grid spacing diagonal, temporarily place there and then move it back.)

Unfortunately this seems the only way to snap a footprint to grid…

Strange that it behaves this differently for you. Maybe it is just an unlucky combination of starting position, grid position and hard coded snap radius.

Is there any Action Plugins or python macro to snap a block of footprints to the grid?

KiCommand has a command grid that works with segments (tracks or lines). I’ll see if I can update it for modules (footprints).

Edit: latest KiCommand updates include grid command that works on all BOARD_ITEMs and not just segments/tracks.

Example: modules selected 10 mm grid

Be sure to setcurrentboard to make sure you’re operating on the board currently loaded into the pcbnew window.

thanks, I’ll have a look at it… I’m developing an action script and KiCommand may help in this :smiley:

Luckily KiCad has a python interface to cover some missing features…

1 Like

Agreed. I’m glad there’s a Python API. KiCommand is chock full of Python examples. If you need to do something in Python, and KiCommand isn’t enough, then at least you might be able to use KiCommand as examples for Python.

1 Like

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