Comment 42 for bug 1251393

Revision history for this message
Alexandre (vallettea) wrote :

One way to do it without text editing (which is not perfect but less error prone) is to script it by changing the layer of the drawing associated with the fontprint (made on another layer):

import pcbnew

board = pcbnew.GetBoard()

io = pcbnew.PCB_IO()
for module in board.GetModules():

 # check somehow that the module is the footprint you are looking for
 # did not find a way to access the footprint name
 if 'J' in module.GetReference():
  print(module.GetReference())
  graphics = module.GraphicalItemsList()
  graphicsLayers = [x.GetLayerName() for x in graphics]
  if len(graphicsLayers) == 8 and len(set(graphicsLayers)) == 1:
   for x in graphics:
    x.SetLayer(board.GetLayerID('Edge.Cuts'))

pcbnew.Refresh()