Howdy. I am making PCBs with a similar layout/consistent spacing between some of the items. I am new to trying to interface with the scripting console and do not quite understand the best way to achieve my goal of having the parts matching a certain reference ID being placed into a specific pattern on the pcbnew window.
I managed to identify all the footprints with the relevant ID, and assign the footprint object reference to module. From there I try and use set position. That’s where I am having issues.
If I use
module.SetPosition = pcbnew.wxPoint(0,-180)
I’d expect that to change the position of the part once the window is refreshed with pcbnew.refresh
It is not, however. I am able to grab the position with module.GetPosition and view them accordingly. If I print(module.SetPosition) it shows the new coordinates I set.
How do I actually apply the position change itself, or am I using this wrong? Finding information for the new changes is pretty difficult right now.
Coordinates in pcbnew api are in nm (nanometers). 0, -180 will be pretty hard to tell apart from 0,0.
You can directly multiply as needed or use pcbnew.FromMM(), pcbnew.wxPointMM() helpers.
FindModuleByReference doesn’t exist in 5.99, I thought. I thought there was a swap to FindFootprintByReference and then a rework from there. None of the older syntax (like you just showed) has been working for me.
I put it in the title, but wouldn’t have hurt to have it in the post too I suppose. I’ll check this again in about an hour when I am able to check my design computer again, but I’m nearly positive it wasn’t working with that identical syntax last night. I appreciate the help though.