This is a follow-on to my question here: KiCad IPC API script to move a footprint is not working. Is it me or is it a bug? - External Plugins - KiCad.info Forums I tried building the latest git source and now I am not getting crashes and “something is happening”. The issue is that now, when I issue the move for the fingerprint, the anchor moves, but the footprint itself does not - it’s as if you went into the footprint editor and moved the anchor point there.
Here is a screenshot showing exactly what’s happening:
Before:
After:
As you can see, the anchor point moves, but the actual footprint does not move with it.
The entire code is in my first post, but here’s the relevant section that updates the position:
# Find item J1 in the PCB.
items = get_footprints(pcb) # this is a function I wrote to find the footprint by reference
j1 = items.get('J1')
if j1 is None:
print('No footprint J1 found.')
return
# Print the position of J1
print("J1 is at: ",end='')
print(j1.position)
# Position J1
print("Moving J1 to 0,0")
comm = pcb.begin_commit()
j1.position = Vector2.from_xy(0, 0)
print("J1 is now at: ",end='')
print(j1.position)
print("Sending update to KiCad")
try:
pcb.update_items([j1])
pcb.push_commit(comm)
# Save the PCB
pcb.save()
except Exception as e:
# ... handler
The code does not show any errors, and the position is shown as updated when I print it again after changing it. The issue seems to be that the anchor moves but the relationship between the anchor and the other items in the footprint changes to match the new anchor point, rather than simply moving the footprint to the new point based on the anchor.
Is this a bug or am I doing something wrong?