How to hide multiple designators on Silkscreen?

Hi guys,

I’m nearly done with my first layout with KiCad. Many thanks to all contibutors for this valuable piece of software!

However, currently I am setting up the manufacturer data. All components have a designator on the silkscreen layer. Now I would like to hide/delete/… all designators (nearly all, I would like to keep the J* and TP* designators for example).
I figured out that I can do this for every component individually (‘E’ over the designator, disable visibility) - this is quite time consuming due to 200+ components on my board. Another approach seems to be to manipulate the footprints in the library in order to replace all of the footprints in the board - but I would like to avoid this.
My second attempt was to search for appropriate Python script but can’t find any for silkscreen manipulations. After studying the Python API I’m even not sure if it is possible to have access to the silkcreen items (I must be wrong)…

Is there a simple solution for my problem?


1 Like

This quick and dirty perl script should do the trick:

#!/usr/bin/perl -w -i.bak

while (<>) {
    if (/^\s*\(fp_text reference ([^\s]+)/) {
        my $ref = $1;
        unless (/ hide$/) {
            unless ($ref =~ /^J/ or $ref =~ /^TP/) {
                $_ .= " hide";
    print $_, "\n";

Run it like this: your-board.kicad_pcb
1 Like

Being a Vim text editor guy, I would open the PCB file in Vim and run:

g/^\s*(fp_text reference [^J^T][^P]\w*/s/$/ hide/

Broken out:
g/ if line contains this pattern /s/ substitute this / with this /

Match every line in file

Find this pattern: Start of line, followed by Whitespace, followed by (fp_text reference, followed by NOT J or NOT T, followed by NOT P as 2nd Character
^\s*(fp_text reference [^J^T][^P]\w*

For every line that matches the pattern, substitute the end of the line with "hide"
/s/$/ hide/

I have NOT tested this.

Do not “plot” the gerber layer for the silkscreen you want to hide.

Do place on another layer( like the ECO layer), the silkscreen text you do want on the board. Use Protel extensions and rename the plotted ECO layer as the standard Silkscreen layer Protel extension.

You can move the existing Silkscreen information over to another layer, or you can duplicate the Silkscreen items and move the duplicate to a new layer.

If you only have a couple of items to move to a layer, this would be the way to do it in my opinion. If you have 400 items and 200 need to be here, and 200 need to be there, then scripting a solution would probably take less manual time.

1 Like

It is much easier to deselect the reference tick in the gerber export and add separate user text labels to the few footprints where he wants the reference shown.


Thank you guys! I like the idea of manipulating the board file by scripting - stupid me, its all text based of cause! :^D
Copying the designators or adding them to another layer manually is some kind of ‘dangerous’ in the long term because changing designators in the schematics will not affect the layout, right (haven’t tested it)?


The answers given seem like they would work well if you know how to script. KiCommand is intended to give a slightly simpler access to KiCad.

I’m inspired by this post to add regular expression filtering to KiCommand, and I also had to add the ability to create boolean arguments. In the development version of KiCommand, the following command sets the visibility flag on matching reference designators.

Please let me know if this would be of use to you, and I can accelerate the release of this version.

modules copy GetReference call .*EF.* regex isnotnone filter Reference call false SetVisible callargs

Walking through the commands:

  • modules copy
    – gets all modules on the board, and duplicates on the stack (the copy is for later use in this command string).
    – STACK: ModuleList, ModuleList
  • GetReference call
    – gets the reference text of each module
    – STACK: ModuleList, ListOfReferenceStrings
  • .*RE.* regex isnotnone
    – creates a list of True/False values corresponding to matching list elements
    – STACK: ModuleList, TrueFalseList
  • filter
    – filters the module list based on the True values in the TrueFalseList (uses the extra copy of ModuleList created in the copy command above.
    – STACK: ModuleListMatchingRegex
  • Reference call
    – get the reference graphic objects of the modules
    – STACK: MatchingReferenceObjects
  • false SetVisible callargs -
    – set the visible parameter of the reference objects to false (invisible)

Based on how often the utility of getting modules matching a specific regular expression, I’ll probably create convenience commands to reduce this to something like:

modules .*EF.* regexref refobj clearvisible

KiCommand is updated to include these commands. This should now work:

modules .*EF.* regexref refobj clearvisible

@HiGreg I’ll have to check this out next chance I get.

Per @Sprig and @Rene_Poschl, I have tweaked plotted the output Gerber layers in the past. However, recently I have been using a couple of board houses that have fully automated quoting systems for turnkey PCB fab and assembly that read the Kicad files directly. Because of this, the old tweak the output plots does not work, and I have to make sure the Kicad PCB file reflects the as-built board.

What happens if they use a different kicad version then you?

Gerbers are a lot safer than giving them the pcb file for exactly this reason.

The extracted Gerbers are available to review as part of the process. I have been running nighties, only upgrading when I need and key feature and having tested the build. I am quoting full assemblies, so the key thing is importing the BOM, part location and pin-1 rotations all at once. This provides an instant assembly quote with no NRE.