Redraw screen after moving modules via script?

I have a script that relocates some parts in pcbnew. It works, except the screen doesn’t update after I run the script in the scripting console. View => Redraw doesn’t help. The following works, but is rather tedious:

  1. Make a benign change so the file is marked as edited (else you can’t do step 3 below)
  2. Run the script.
  3. Save the file.
  4. Close the pcbnew window.
  5. Re-open the file.

I’m hoping someone can show me a better way!

try:
pcbnew.Refresh()

1 Like

@maui That worked – thank you.

Then there’s one more detail: how do I save the modified board from the script? (The GUI doesn’t know the file has been modified, so it doesn’t enable the save button…)

Update:

I just discovered
https://docs.kicad.org/5.0/en/pcbnew/pcbnew.html#kicad_scripting_reference
That looks like it will help! I don’t know why it took me so long to find it!

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