Editing one property of multiple footprints

I’m looking for a way to edit one property of a number of footprints.

For example, I have a number of components on my board which will not be populated but are there as a backup (things like a simple PI-filter, a 3 resistor attenuator,…)

When you add components to a schematic or footprint Kicad always displays both the reference designator and the value as part of the silkscreen.

Is there a way to select a range of components and set the property of the silkscreen to ‘Invisible’? Right now I have to edit each footprint, edit the value, put ‘Display’ to ‘Invisible’ and click OK two times.

There must be an easier way to do this?

What version of Kicad you’re using?

The fastest way I see is to edit the pcb as a text file and add “hide” modifier after the object you’d like to make invisible. As an example, here is a snippet of a .kicad_pcb file from my recent project, you’ll see the “hide” modifiers on reference and value fields there:

<...>
(module Pin_Headers:Pin_Header_Straight_1x02 (layer F.Cu) (tedit 543AD1B5) (tstamp 54396419)
(at 144.145 104.775 90)
(descr "1 pin")
(tags "CONN DEV")
(path /53E52E0F)
(fp_text reference P1 (at 0 -2.286 90) (layer F.SilkS) hide
    (effects (font (size 1.27 1.27) (thickness 0.2032)))
)
(fp_text value IN (at 0 0 90) (layer F.SilkS) hide
  (effects (font (size 1.27 1.27) (thickness 0.2032)))
)
(fp_line (start 0 -1.27) (end 0 1.27) (layer F.SilkS) (width 0.254))
<...>

Currently I’m using version BZR 5161 from 2nd of October 2014.
Quite recent…

Indeed, editing these properties in the text file mode is a possible way
forward.
But more interestingly I would like to see if I could manage this from the
scripting console.

Perhaps there is een API available to work on components?

Is there already a feature request for such a property editor? Otherwise
I’d add it to the Launchpad in the hopes it receives some more attention.

Hi tipofthesword,
Realise this is an old post, but a script to do what you want appears reasonably straightforward. The script below tests fine, presuming you know the references of the parts you’re wanting to change.

#!/usr/bin/env python

from pcbnew import *
pcb = GetBoard()
while True:
    thing = raw_input('Reference to hide: ')
    aModule = pcb.FindModuleByReference(thing)
    if aModule:
        aModule.Reference().SetVisible(0)
        aModule.Value().SetVisible(0)
        print('Module '+aModule.Reference().GetText()+': '+aModule.Value().GetText()+' is now hidden.')
    else:
        print('Module '+thing+' not found.')    
    again = raw_input('More? Y/N: ')
    if (again != 'y') & (again != 'Y'):
        break;
print('Done.')

References are case sensitive, so c1 is not the same as C1. This hides the reference and value in the currently open board in pcbnew.

Cheers! Geoff

1 Like

This is an old thread, but thought I would throw this out there. I updated a bunch of footprints and needed to hide all the “value” fields as mentioned above. I opened the pcb file in Vim and ran a one-liner:

%s/^.* value .*)$/& hide

This could be done with Sed also, and changing “value” to “value 10uF” lets you be more selective. The power of KiCAD’s human readable file formats.

2 Likes

And then there is this here:

Currently going over @devbisme’s KiField code to see how this is done more properly than I do in my ugly code.
Should have an option to export the settings from CSV back into the kicad_mod repos in a couple of days/weeks.

A post was split to a new topic