Aligning components using array or some other way

I’m trying to wrap my head around the array function and how it’s supposed to be used. I have a simple use case but can’t get it to work for my purpose.

I often have various footprints that need to be aligned in a certain pattern (not on the regular grid). Let’s take three resistors, for instance, that need to be spaced 3.3mm apart. Here’s how it looks like:


When I use the array feature, it actually creates additional components that are not in the schematic rather than using the selected components:

This is not what I want. Is there a way to use the array feature (or any other feature for that matter) to align existing components so it looks like this?:

What I’ve tried:

Array: I couldn’t get this to work. It always creates components not present in the schematic. I have no idea how to use this function. Are you supposed to delete the original components are re-assign the reference designators manually?

Creating a user grid: Cumbersome to use for only a few components.

What I mostly do:

  • Click on 1st component
  • Press < space > (set user CS)
  • Select last component
  • Position Relative To…
  • Do the math and enter e.g. x=0, y=-6.6mm to position the last component
  • Select all components
  • Align To Horizontal Centre
  • Distribute Vertically
  • Reset user CS to where it was before

This works for a single row, but quickly gets complex for a 2D grid, which is
when I use the user grid option.

Is there a better/quicker way to achieve this?

KiCAD 6.0.1

Select the components you want to align, right mouse button->Align/Distribute and there you are with a choice of alignment options.

There’s no function in that menu to align components e.g. 3.3mm apart.

In my bullet list I use that menu in combination with a user coordinate system. It’s nine steps and I wonder if that’s the quickest workflow to align components. Especially if there’s a function called align which seems like it could do the job in two steps.

1 Like

Distribute puts the items in equal distances between the furthermost items.

Align takes the item under the cursor and uses that as a reference, it just aligns to the same line, not distributes.

For more exotic placements look into Place Footprints plugin in PCM

1 Like

Below example was done by Array. No magic…

Array panel input, below…

This won’t work. Now you have five copies of R4, only one of which is found in the schematic. That’s what I mean by re-assigning the reference designators manually. Do you have to edit each reference designator manually afterwards?

I guess it’s not clear to me exactly what you want… You can do the Array in the Schematic, Pin-label and Net-name as desired and the PCB will replicate the schematic/Netlist

Sorry, maybe I didn’t communicate that sufficiently. To take a (very simple) example: I want three resistors R1, R2 and R3, to be arranged a fixed distance apart from one another (see screenshot 3 in the OP). The resistors are already placed on the PCB (see screenshot 1 in the OP).

Currently I need nine steps and I wondered if there’s an easier way.

The schematic is drawn and I have no problem creating the schematic. This is only about arranging the componnets on the PCB.

The simple answer (solution) is to Double-Click each and change the Number.

Five resistors, thus 4 double-clicks (unless wanting to change the original, too, thus 5-double-clicks.

In the morning, sometimes I want to take 5-gulps of blackcoffee, all in One-Fell-Swoop but, never works out. I need to take 5 individual clicks, oops, I mean 5 individual gulps…

Perhaps others have the iphone (one-click) solution hoped for…

1 Like

I was cleaning out old Java Codes and it occurred to me to see ‘How Long’ it takes to Manually change 4 pin numbers so, I made a GIF video…

If I had to change 50 of them (especially if it was going to be a recurring activity) I’d make a Plugin to do it… I’ll leave it at that…

HowLong

You can shorten (optimize) the workflow a little:

  • move/place 1st component on desired location
  • move/place last component directly on top of first component (snapping feature helps), this last footprint remains selected
  • use special tools–>Move exactly
  • Don’t do the math, you can directly write “(number_of_components-1) * distance” into the x/y-coordinate field, kicad calculates themself
  • Select all components
  • Align To Horizontal Centre
  • Distribute Vertically

This saves two steps and the manual calculation.

Personally I use the workflow “put footprint FP2 on top of FP1 and then use Move exactly” very often. With “CTRL-M” assigned as hotkey to the “move exactly”-tool this works good enough for me (medium sized boards, mostly <=300 footprints ).

edit: formula corrected thanks to @wxE5

The blue shaded Ref. number in the Footprint Editor will change immediately a key is pressed. There is no need to select the number with the cursor.
The workflow would then be: Select resistor, press number key, click OK.
I’d guesstimate the time taken to change the four resistor Refs. to be about 10 seconds, which will leave plenty of time for another sip of @BlackCoffee :grinning: :grinning: :grinning:

Thanks for the suggestion. Small improvements like this is why I asked the question in the first place. Such workflows aren’t really covered in the manual.

One small correction: It’s “(number_of_components - 1) * distance”.

I wasn’t sure if that’s how the align function is supposed to work (the manual doesn’t explain it). But now I know that you’re supposed to remap the reference designators and delete the original components afterwards.

Using the four resistors was just an example. I wouldn’t need an automatic function to place four components.

Taking the time to reply and share your thoughts and workflows.

I’ve found same need to array align LED modules. And instead of wasting an hour to align them by hand I’ve spend about 8 hours learning wxPython and pcbnew python API.
And the result is plugin that do exactly that.
usage

Here is the link to the repo

1 Like

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