Rename parts in an entire project

Hi,
I’ve got a project that is almost completed but contains inconsistently named parts. Some ICs are labeled with IC and some with U. Is there a way to rename components in schematic, netlist, CMP and board at the same time?
I tried to change the names in the schematic and exported a netlist. CVPCB wanted me to choose new footprints. After I did that and opened PCBNEW, I saw duplicates of the renamed components. All this reluctance of kicad made me assume that I had choosen the wrong approach :wink:
Thx in advance!

Due to the number of replies I assume, that there is no proper procedure to do this. Anyway, I could fix it with search/replace using sed:

sed -i ‘s/U1/IC1/g’ *

This is why I love Kicad: Plain text formats that allow “drawing” with vim and undoing with git :smiley:

[closed]

1 Like

ok what about a more user friendly option ?

there many ways to have a list of components, yet none of them allow for bulk renaming

that would be so much easier

I wonder the new file format could also have some marker text so we can do regex little better to not change the wrong field

Yes, the new file format for the schematic will be s-expression like the PCB file format has been since 5.0(?). For example, here is a resistor in one of my sample projects from the PCB file: (last saved in 5.1.x)

  (module Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal (layer F.Cu) (tedit 5AE5139B) (tstamp 5BF5DE9B)
    (at 83.185 52.07 90)
    (descr "Resistor, Axial_DIN0207 series, Axial, Horizontal, pin pitch=10.16mm, 0.25W = 1/4W, length*diameter=6.3*2.5mm^2, http://cdn-reichelt.de/documents/datenblatt/B400/1_4W%23YAG.pdf")
    (tags "Resistor Axial_DIN0207 series Axial Horizontal pin pitch 10.16mm 0.25W = 1/4W length 6.3mm diameter 2.5mm")
    (path /5AD03AA2/5AD03DB9)
    (fp_text reference R2 (at -1.905 0 180) (layer F.SilkS)
      (effects (font (size 1 1) (thickness 0.15)))
    )
    (fp_text value 1k0 (at 6.35 0 90) (layer F.Fab)
      (effects (font (size 1 1) (thickness 0.15)))
    )
    (fp_text user %R (at 3.175 0 90) (layer F.Fab)
      (effects (font (size 1 1) (thickness 0.15)))
    )
    (fp_line (start 11.21 -1.5) (end -1.05 -1.5) (layer F.CrtYd) (width 0.05))
    (fp_line (start 11.21 1.5) (end 11.21 -1.5) (layer F.CrtYd) (width 0.05))
    (fp_line (start -1.05 1.5) (end 11.21 1.5) (layer F.CrtYd) (width 0.05))
    (fp_line (start -1.05 -1.5) (end -1.05 1.5) (layer F.CrtYd) (width 0.05))
    (fp_line (start 9.12 0) (end 8.35 0) (layer F.SilkS) (width 0.12))
    (fp_line (start 1.04 0) (end 1.81 0) (layer F.SilkS) (width 0.12))
    (fp_line (start 8.35 -1.37) (end 1.81 -1.37) (layer F.SilkS) (width 0.12))
    (fp_line (start 8.35 1.37) (end 8.35 -1.37) (layer F.SilkS) (width 0.12))
    (fp_line (start 1.81 1.37) (end 8.35 1.37) (layer F.SilkS) (width 0.12))
    (fp_line (start 1.81 -1.37) (end 1.81 1.37) (layer F.SilkS) (width 0.12))
    (fp_line (start 10.16 0) (end 8.23 0) (layer F.Fab) (width 0.1))
    (fp_line (start 0 0) (end 1.93 0) (layer F.Fab) (width 0.1))
    (fp_line (start 8.23 -1.25) (end 1.93 -1.25) (layer F.Fab) (width 0.1))
    (fp_line (start 8.23 1.25) (end 8.23 -1.25) (layer F.Fab) (width 0.1))
    (fp_line (start 1.93 1.25) (end 8.23 1.25) (layer F.Fab) (width 0.1))
    (fp_line (start 1.93 -1.25) (end 1.93 1.25) (layer F.Fab) (width 0.1))
    (pad 2 thru_hole oval (at 10.16 0 90) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask)
      (net 3 "Net-(C3-Pad1)"))
    (pad 1 thru_hole circle (at 0 0 90) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask)
      (net 9 "Net-(R1-Pad2)"))
    (model ${KISYS3DMOD}/Resistor_THT.3dshapes/R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal.wrl
      (at (xyz 0 0 0))
      (scale (xyz 1 1 1))
      (rotate (xyz 0 0 0))
    )
  )

Here the line (fp_text reference R2 (at -1.905 0 180) (layer F.SilkS) is the reference designator (well it is two lines, but the extra is extraneous to this example). You can search for the fp_text reference and then modify the following text. The reference designator on the fabrication layer, (fp_text user %R (at 3.175 0 90) (layer F.Fab), should automagically pick up the reference value change because of the %R variable substitution.

I would imagine that the schematic file format would be similar, but since I haven’t installed 5.99 yet I don’t know what the keywords are.

Also, because the file format is a standard markup style, lots of programming languages have libraries that will parse the files so you can manipulate the data in programs as a data structure instead of lots of text strings.

1 Like

I’ll also tag along on this 7 year old thread…

I just did a bit of an experiment with Eeschema / Edit / Find and Replace…

With it I was able to replace parts of multiple RefDes strings from Uxx to IC_xx with these settings:
image

It does appear to be a bit of a dangerous thing. You can search through and replace in the RefDes, but the replace won’t limit itself to the Refdes. It changed 38 strings throughout a hierarchical design…