Here is an ActionPlugin script to move values to the Silk layers and also make them visible.
import sys
import pcbnew
"""
execfile ("c:/.../pplugin_move_values.py")
"""
def pcbfunc(Filename = None):
if Filename:
my_board = pcbnew.LoadBoard (Filename)
else:
my_board = pcbnew.GetBoard()
for module in my_board.GetModules():
print ("module ref %s %s" % ( module.GetReference(), my_board.GetLayerName(module.Reference().GetLayer())))
print ("module val %s %s %s" % ( module.GetValue(), my_board.GetLayerName(module.Value().GetLayer()), "Visible" if module.Value().IsVisible() else "Hidden" ) )
if module.Value().GetLayer() == pcbnew.F_Fab:
module.Value().SetLayer (pcbnew.F_SilkS)
elif module.Value().GetLayer() == pcbnew.B_Fab:
module.Value().SetLayer (pcbnew.B_SilkS)
module.Value().SetVisible (True)
class RMCPcbPlugin(pcbnew.ActionPlugin):
def defaults(self):
self.name = "RMC_Move_Values"
self.category = "RMC"
self.description = "Move values to silkscreen"
def Run(self):
# The entry function of the plugin that is executed on user action
pcbfunc()
pcbnew.Refresh()
if __name__ == "__main__":
# pcbfunc("C:\\git_bobc\\bobc_hardware_live\\Smart_RGB_LED_AT85\\rgb_led.kicad_pcb")
pcbfunc()
else:
RMCPcbPlugin().register() # Instantiate and register to Pcbnew