Scripting question

i want to create components along the function curve that I made. I want to do it by using python script in kicad.

@haha Having just dug through this process myself, check out the following post and link. I was doing a simple grid array, but it shows how to move a footprint to a location and set its rotation. You would have to write the python function to calculate the footprint center location and rotation to fit your curve.

1 Like

I followed the script exactly as it was, but in the assert(r1 and r2 and d1) part of the footprint placement script,
ā€œFile ā€œā€, line 1, in AssertionErrorā€ error occurs.
And r1.SetPosition(wxPointMM(20, 20)) also occurs error ā€œAttributeError: ā€˜NoneTypeā€™ object has no attribute ā€˜SetPositionā€™ā€
Iā€™m sorry, but can I know what I did wrong?
my kicad version is 6.0.10

@haha If you look at the code I posted, I also removed the assert line. I had to fix the r1.SetPosition(wxPointMM(20, 20)) line as well. Iā€™m not sure the origin of wxPointMM(), I changed it to pcbnew.wxPoint():

refDes.SetPosition(pcbnew.wxPoint(xOffset, yOffset))

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