Delete GraphicalItems of footprint

Hello,
I basically would like to delete all the elements on the two silkscreen layers with a python script.
So far I can actually iterate throu the shapes and texts:
for fp in board.Footprints():
for gi in fp.GraphicalItems():
print(gi)
First question is how do I get the layer, each GraphicalIItem is on so I only delete the silkscreen. Second is how do I delete the Items or simply move them to a user layer? Moving the item would be best as it would be possible to remove selected items to appear on the silkscreen again.

Also lets say I accidentally deleted a silkscreen element (I think it is called ref). Is there a way to redo all the refs?

The reason I need this is because I would like to make a pcb that looks nice and presentable with only custom silkscreen elements.

Thanks

There is no need to script this. You can simply:

  1. PCB Editor / Edit / Edit Text and Graphic Properties.
  2. Set the scope to whatever objects you want to change.
  3. Filter them by your silkscreen layer. (This filter is part of the input).
  4. Set the action you want to perform. Change the layer, or uncheck the visible.
  5. [OK]

I was doing it for years (but before I start to use KiCad) by just sending to PCB manufacturer my graphic layer gerber instead of silkscreen gerber and informing him that the file I am sending is to be used as silkscreen.

Ah thanks a lot! That seems very helpfull.

Thanks for the tip. I will see if I need it. The selection filter seems to be all that it takes.