Change the font size to multiple footprints at once?

Hi!

when the pcb is too populated with smd components it’s a bit annoying to change the size on every reference one by one, Is there a way to change all of them to a size and thickness?

Not directly via the graphical interface. (At least not that i am aware off.)
You could look if there is a script for that or write your own.
Another alternative is using a text editor. (The pcb file is human readable.)

For both workarounds: Make a backup beforehand in case something goes wrong.

maybe it’s the time to begin to use some python there then :slight_smile:

You could use a script like this :slight_smile:

import sys
from pcbnew import *

"""
execfile ("c:/python_progs/test_pcb/set_text.py")
"""

def SetText(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())))

        # set size in mm
        module.Reference().SetSize (wxSize (FromMM(2),FromMM(2)))
        
        # set thickness in mm
        module.Reference().SetThickness (FromMM(0.3))


# SetText("C:\\git_bobc\\bobc_hardware_live\\Smart_RGB_LED_AT85\\rgb_led.kicad_pcb")
SetText()

Great, I just need to learn how to use it! (never used a python script on kicad, until now)

The way I do it :

To run from kiCad script console in pcbnew

  1. Open the console, Tools->Scripting Console
  2. type the following command in the console window

execfile (“c:/python_progs/test_pcb/set_text.py”)

change “c:/python_progs/test_pcb/” to where you stored “set_text.py”.

When v5 is out, it will be much easier to run scripts.

In recent Nightly builds there IS a native tool for this. In PCBNew’s “Edit” drop-down, select “Set Footprint Field Sizes”. You can then set global values for the Reference Designators, the Values, and the User Defined fields. The new values persist if you re-import the netlist, too!

Dale

6 Likes

oh, yes, I saw that before (I have the heikkipu version with tears and curves, not the latest but close), however I believed it may be not working, because I fail to selected where to apply the new dimensions (this step was no self evident for me at the first time). Now I have it!
BTW bobc: how one run scripts in V5? (so easy, I can’t find it - I also compiled the last, just in case, but can’t find it anyway)

v5 is not even close to being released. (Currently it looks like it might take until next year.) Nightly is a development build! (Just a pre compiled version of the current git master branch.)
Fair warning: The nightly version is not meant for production. It is not guaranteed that files generated by a specific nightly build can be opened by either the stable build or older nightly build versions.

I think this is what @bobc was referring to.

my bad, since I not using the pre compiled (nightly) but V5 version (when I use the V5, not all the time) made by heikkipu (https://github.com/heikkipu/kicad-devel) just because I like the curves/tears.
I’m compiling this version and didn’t add the option of scripting when configure, I just need to read a bit further the install procedure to see how to turn KICAD_SCRIPTING=OFF to ON
This is why I didn’t have scripting console here!
I have the nightly in other partition to not mess with the V4.0.7 install, I went there and see the scripting console still exist.

Not only in nightlies. This tool hass been present from some years now.

1 Like