EEVblog Electronics Community Forum

Electronics => PCB/EDA/CAD => KiCad => Topic started by: RobK_NL on July 22, 2018, 07:35:31 pm

Title: Component autoplacing
Post by: RobK_NL on July 22, 2018, 07:35:31 pm
For my first attempt at using KiCad I thought I'd do something simple: a board with 18 LEDs on a single row, with a specific spacing.

In CadStar this is literally a matter of seconds, because I can just give the autoplacer all relevant data ("1 row with 18 components, centres stepped at xx.xx mm, starting at X,Y coordinates").

Is there some way of getting KiCad to do the same or am I stuck with positioning each part by hand?
Title: Re: Component autoplacing
Post by: Bratster on July 22, 2018, 08:05:25 pm
I'm not aware of any way to automatically place things a certain distance apart, doesn't mean there isn't one however.

But you can change the grid to be whatever you want and then just place the components by hand and they will be automatically snapped to that grid.

Sent from my Fi Moto x4 using Tapatalk

Title: Re: Component autoplacing
Post by: RobK_NL on July 22, 2018, 08:17:39 pm
Yes, that would be an option. X and Y grids can be set independently, it seems, so that should work for me.

I'd prefer automatic, though. Especially since I also have a 36 LED version to make ...
Title: Re: Component autoplacing
Post by: langwadt on July 23, 2018, 09:40:20 am
you can place an array of a component but they all get the same designator so you'll have to fix that by hand

unless there is some new feature, using something like this  as a starting point is probably the easiest

https://github.com/tlantela/KiCAD_layout_cloner/blob/master/layout_cloner.py
Title: Re: Component autoplacing
Post by: bson on July 24, 2018, 02:25:00 am
In v5:

The schematic should have reasonably sensible references for the parts you want to place, for example LED1-10 rather than random Dxxx.

In the PCB editor:
Position the first footprint and delete the others
Right click the one left and select Make Array.
Specify spacing etc.
Create the footprints.
Deselect any footprint.
Hover over the second footprint in the array and press E.
Change the reference from e.g. LED1 to LED2 and press enter
Repeat, changing the references to LED3, LED4, etc...  these need to match the schematic.
Save the PCB

I don't think it's necessary, but for good measure I'd back-import the PCB changes to the schematic.  (The rightmost toolbar button that has a left arrow and says "back".)

This has an advantage over a custom grid in that array itself will be automatically grid aligned.  If you use a custom grid you will need to place the footprints first according to your spacing using a coarse custom grid, then switch back to a finer grid and move the entire array to grid align it.  But either way will work.  It also a more general approach in that it can create arrays of vias, or random pads or mechanicals like holes (and possibly slots), which may not be components to begin with (and in the case of vias shouldn't be), so is a bit more general and less task specific.

Make Array can also be used on selections of multiple parts so you can select an entire subcircuit and replicate it, then change the references to for the other channel(s) or other context - or you can make an array of the entire board, which is handy for panelization.
Title: Re: Component autoplacing
Post by: langwadt on July 24, 2018, 10:40:17 pm
In v5:

The schematic should have reasonably sensible references for the parts you want to place, for example LED1-10 rather than random Dxxx.

In the PCB editor:
Position the first footprint and delete the others
Right click the one left and select Make Array.
Specify spacing etc.
Create the footprints.
Deselect any footprint.
Hover over the second footprint in the array and press E.
Change the reference from e.g. LED1 to LED2 and press enter
Repeat, changing the references to LED3, LED4, etc...  these need to match the schematic.
Save the PCB

I don't think it's necessary, but for good measure I'd back-import the PCB changes to the schematic.  (The rightmost toolbar button that has a left arrow and says "back".)

This has an advantage over a custom grid in that array itself will be automatically grid aligned.  If you use a custom grid you will need to place the footprints first according to your spacing using a coarse custom grid, then switch back to a finer grid and move the entire array to grid align it.  But either way will work.  It also a more general approach in that it can create arrays of vias, or random pads or mechanicals like holes (and possibly slots), which may not be components to begin with (and in the case of vias shouldn't be), so is a bit more general and less task specific.

Make Array can also be used on selections of multiple parts so you can select an entire subcircuit and replicate it, then change the references to for the other channel(s) or other context - or you can make an array of the entire board, which is handy for panelization.

creating an array and getting usable reference worked in 4.0.2  but it was "fixed"

https://www.eevblog.com/forum/kicad/kicad-4-0-3-pcbnew-making-a-footprint-array/ (https://www.eevblog.com/forum/kicad/kicad-4-0-3-pcbnew-making-a-footprint-array/)