How to uniformly place footprints?

I am trying to design the PCB for a keyboard. I have already made the model for it in FreeCAD, and I can make a DXF file as well. I see I can import a DXF into the PCB editor. My question is how to align the footprints of the keyboard switches to the DXF, so the layout is not the mess I usually make :slight_smile:

I am interested in any good solution, even if it does not involve DXF.

If you import the DXF to one of the drawing layers, you can use the alignment tools to line parts up to the drawing.

For example, here, I placed a pushbutton (switch) and a graphic box. Using the align-to-horizontal center…

… and then align-to-vertical center…

image

the switch is aligned to my graphic reference:

image

Alignment tools are not unique to KiCad. Vector drawing programs use them as well. Assuming things are distributed evenly, you could use the “distribute horiz/vert” tool to speed things up. You only need to place the left/right and top/bottom parts to align entire rows and columns quickly.

However, the one thing to know in KiCad is how the Anchor object is selected. You highlight both objects. The object you right-click on (to select the align commands) becomes the anchor. So, in both of my examples above, I selected the button, then the box, then right-clicked on the box.

5 Likes

Not exactly knowing your keyboard can’t be sure if it is good solution, but I would probably be placing footprints directly at PCB (without DXF) using user grid to have grid points where I plan to have keys.
You can use different grid settings for example for each row of keys.

1 Like

Thank you all the answers. I ended up making a dxf where some line intersections marked the placement for some special places in the footprint. For the switch this was the hole in the center of the switch, for the diode it was one of the pads. When I dragged the footprints, the reference point of the drag became the first of those “special places” which I went over with the mouse. And the mouse snapped to the line intersection, placing the special place exactly there. I do not know what made those places special. I guess they can be defined when creating the footprint. There are multiple such places in a footprint, the trick was to start a drag through the specific special place I want to use.

For LEDs it is an error in my opinion. Reference point for LEDs should be their center.

In past (KiCad V5, I think, but I’m not sure) you could drag footprint only by its anchor point (0,0 set in footprint editor). Now you can drag footprint also for pad centers and may be more. You probably can modify this behavior by checkboxes in Selection Filter.

1 Like

What sort of Keyboard?
If it’s a PC keyboard, there are scripts / plugins for KiCad that can help with key placement. But this is not really my thing, so I never looked deeper into it myself.

1 Like

These weren’t leds, and I could use their center as well.

Well, this leads to another topic, but not kicad related. I want backlight, but found no good info on where to place the backlight leds.

I suppose (never seen it and never thought about it) PC keyboard backlight is probably done with some kind of optical fiber solution with scattering along the way.

1 Like

Often a mechanical process to steer the light from around the edges. Similar to backlighting for TVs & monitors. See Wikipedia.
Way outside the realms of Kicad and also hobby keyboads.

1 Like

I noticed that this tool is available as a Kicad plugin (via the Plugin and content manager). It may be worth exploring as an alternative option. It says it places footprints according to a keyboard-layout-editor.com specification which seems to allow you to generate your own specific layout with a choice of key switches and customisation.

I use imported DXF heavily. I try to make sure there are a circle at the place for the components and then use “set grid” which will snap at circle centers and then I just use grid snaps to place the component exactly where intended.