Move / modify board (python KiCad base libraries)

There some library in python to KiCad (maybe using import pcbnew) that I can:

  1. Move the complete board (shift the all board in1cm, for example)?
  2. Move a specific component like before?
  3. Change some net / components properties?
  4. Do this in a file without open the file in PcbNew?

I now that appear a lot, but this will be needed in my python tool. I cold do this creating function in my on script, but I think this will do my tool not versatile.

There is also a eschem library as pcbnew?

Yes, totally doable in python with pcbnew. There is not yet an equivalent for eeschema.

Does anyone have an example of moving the whole board using a python script. Thanks.

I can’t see a direct way. An inxerect on would be to:

  1. Iterate through all modules and move each one
  2. Iterate through all tracks and move each one
  3. Iterate through all drawings and move each one
  4. Iterate through all zones and move each one (this one is trickier as you have to move each corner)

You might want to look into https://github.com/MitjaNemec/Kicad_action_plugins/blob/master/save_restore_layout/save_restore_layout.py for inspiration.

1 Like