Arrange parts in a circle

I am trying to write a script that will result in the following output. I thought I would get suggestions before going to far.


If I were to script this what would be the easiest way? I am thinking now that the parts would have to be sequential in reference value. I don’t see a way to GetModulesHighlighted() or similar. So I would have to:

for i = start to finish
get module by reference('reference letter' + i)

Is there a better way to go about that? Is there a way to get selected?
The rest of the code is pretty easy:

R = radius
N = number of objects
X = Center X Cord
Y = Center Y Cord
A = Start Angle
For i = 0 to N-1
module.setX = R*sin(I*2π/N)+X
module.setY = R*cos(I*2π/N)+Y
Module.setAngle = 360/N*I+A

Obviously this is all pseudo code

The Place footprints action plugin can place in circle:

  • Hierarchicaly linked footprints
  • sequentially numbered footprints

You might tale a look there. If it lacks features I am more than willing to accept a PR. But if you want to make your own I can give you a pointer here and there.

As for placing only selected footprints in circle you have to go through all footprints and test each if it is selected. Then there is a question how do you arrange (sort) them. Probably by increasing reference number makes most sense and the first one should be on top.

2 Likes

@MitjaN Great I will check out your script in the morning. If it works why reinvent the wheel!

HAHA, I just checked your github and I starred that repo back in AUG and must have forgotten about it.

@MitjaN Hey I just tried “place_footprints” and it is great for the first type of layout. I did not see a way to achieve a result like the 2nd screenshot I have listed.
I opened: https://github.com/MitjaNemec/Kicad_action_plugins/issues/72

1 Like

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