Upgrading projects to use KiCad 6?

I’ve just installed KiCad 6.0.9 on a fresh Windows 10 machine and I’m having a terrible time loading my projects created with KiCad 5. I must be doing something really dumb, because it can’t be this broken, plus I can’t find anyone talking about the same issues.

Schematic library names
All the standard library names seemed to have changed capitalisation. eg, “device” is now “Device” so all the standard library symbols aren’t found when I load a KiCad 5 project, and instead get put in a rescue library for manual fixing. Shouldn’t that be done automatically? Note I’m talking about the standard schematic libraries that come with KiCad, not importing ones I’ve created myself.

Many symbols have moved into new libraries or been renamed. eg, “conn:Conn_01x02” is now “Connector_Generic:Conn_01x02”. “device:R_POT_TRIM” is now “Device:R_Potentiometer_Trim”. Again, shouldn’t these be updated automatically? I can write a sed script to process the .sch file for all my projects, but… really?

Footprint changes
Some standard footprints have been renamed. I can see this would be harder to update automatically if sizes have changed, but at least there could be an option to do so, and then a DRC check to see if anything got broken? eg, “C_0805_2012Metric_Pad1.15x1.40mm_HandSolder” has changed size and is now “C_0805_2012Metric_Pad1.18x1.45mm_HandSolder”.

3D models path
The path to the 3D model files for each footprint is coded into the project .kicad_pcb file. Previously ${KISYS3DMOD} pointed to the standard models folder, but this is no longer set and instead KiCad 6 uses ${KICAD6_3DMODEL_DIR}. Shouldn’t the file be automatically rewritten? or ${KISYS3DMOD} also be set to support old projects? Yes, I could set it myself but really I shouldn’t have to. I also want my projects to appear correctly if I send them to another KiCad 6 user.

I really hope there is some script or menu option I can run that does all this in a single operation, and I just haven’t found it.

Many thanks!

It has been a while since I opened a V5 project in V6 but I don’t remember having the issues you describe. That doesn’t mean I was attempting to be as organised wrt using project paths etc as you are, so some of those issues may never have stood a chance of happening. Gut feel is that the KiCAD forum might catch a wider audience for this kind of issue. I have also had good engagement from the KiCAD devs on Gitlab issues, so it may be worth explaining why the way it is, is not a good way of working. Especially as they are releasing major releases annually now and bringing projects into new major versions is likely to become a more frequent experience.

1 Like

I had a few issues myself but did this a year ago so it’s not fresh. I think the new v6 global footprint library links should mean that all the latest libraries are referenced so a new design and v6 environment is correct, but if things have changed name from a v5 design you may have to update these manually per-project which is a pain. I can’t fully remember but it wasn’t tooo bad for me as I usually have a lot of parts in my own custom library.

Just make sure if you use Git repos for the KiCAD libraries, that you update them to use the latest tags.

Yes I’ve seen that 3D path issue, I think I just added a definition for ${KISYS3DMOD} so they would still work. Although I’ve just checked on my work laptop and I have no definition for ${KISYS3DMOD} in the paths, yet opening an old design which has this path on some parts, the 3D models still show. But my Home PC they don’t show. I can’t remember what I did on my work desktop.

Maybe another way is update all footprints in your design from the library and it should pull in the updated 3D path with latest variable name, although have to be careful as this step can change locally-set footprint properties/attributes. Maybe only tick “Update/reset 3D models”.

1 Like

I ended up writing some scripts to migrate all my old projects across. Details here in case anyone else finds it useful. Written in Windows PowerShell, as a chance to learn something new. I definitely prefer Linux grep+sed!

Schematic library names
The biggest problem with the schematic library/symbol names. It looks like my local copy of the standard symbols dates from KiCad v4 in 2017 (!) and when I upgraded to KiCad v5 I must have kept the same symbol library, probably to avoid all this hassle. Regardless, KiCad should build-in a better mechanism for automated migration when it loads old projects that use older symbol libraries.

To build a file of all the KiCad *.sch schematic filenames on my computer:

Get-ChildItem 'C:\projects' -recurse -include *.sch | select-object fullname | sort fullname | Out-File schematic_files.txt

To load each schematic file in turn, parse for symbol names, output to a single file, then strip out duplicate symbol names:

$files = Get-Content schematic_files.txt
ForEach ($item in $files){
  Select-String -Path "$item" -CaseSensitive -Pattern '^L (.+) ' | %{ $_.Matches.Groups[1].Value } | Out-File symbols.txt -Append
Get-Content symbols.txt | Sort-Object | Get-Unique | Out-File symbols_unique.txt

(note this doesn’t work for even older EESchema v2 file format, which would need to be dealt with separately)

I then manually stripped out symbols from private libraries in symbols_unique.txt, and turned it into a CSV file of search/replace pairs:

search, replace
power:\+3\.3V, power:+3V3
conn:Conn_01x02, Connector_Generic:Conn_01x02
conn:Conn_01x02_Female, Connector:Conn_01x02_Female
device:C, Device:C
device:CP1, Device:C_Polarized_US
device:R, Device:R
device:R_POT_TRIM, Device:R_Potentiometer_Trim
... more symbols here

(power:+3.3V is there because of a bug in KiCad when it loads an older version of the EESchema file format, probably the “.” character? Even though power:+3.3V exists as a symbol in the latest standard library, KiCad v6 can’t find it and puts it into a rescue library, so I’ve changed mine to +3V3 as a workaround)

Footprint changes
I decided against any sort of automated update to the latest footprints, given the chaos that could be caused on already-working PCBs. Better to deal with those manually as and when the PCB is revised.

3D models path
I wanted to rewrite ${KISYS3DMOD} in every project *.kicad_pcb file to use the new ${KICAD6_3DMODEL_DIR}, but the more projects I migrated, the more models I found with changed filenames too. So this would have been better as a 2nd CSV file of search/replace pairs instead of hard-coding them into the script.

To migrate a single project at a time (so it can be loaded into KiCad and checked for any problems), I wrote this script:

# Migrate project schematic+PCB files from using KiCad v4 libraries to v5/6 with Windows PowerShell
# Run as: 
#   migrate.ps1 myproject
# sheffield_nikki, 20/Dec/2022
$item = $args[0] + '.sch'
$c = Get-Content $item
$csv = Import-csv -path "symbols_unique.csv"
ForEach ($i in $csv){
  $s1 = '^L '+$i.search+' '
  $s2 = 'L '+$i.replace+' '
  $c = $c -replace $s1,$s2
Rename-Item -Path $item "kicad4-backup.sch"
Set-Content $item $c

# Migrate .kicad_pcb PCB file from KiCad v4/5 to KiCad v6
# only updates 3D models, doesn't rename any footprints
$item = $args[0] + '.kicad_pcb'
$c = Get-Content $item
$c = $c -replace 'model \${KISYS3DMOD}','model ${KICAD6_3DMODEL_DIR}'
$c = $c -replace 'Capacitors_THT\.3dshapes','Capacitor_THT.3dshapes'
$c = $c -replace 'Resistors_SMD\.3dshapes/R_0805\.wrl','Resistor_SMD.3dshapes/R_0805_2012Metric.wrl'
$c = $c -replace 'Capacitors_SMD\.3dshapes/C_0805\.wrl','Capacitor_SMD.3dshapes/C_0805_2012Metric.wrl'
# ... more models here
Rename-Item -Path $item "kicad4-backup.kicad_pcb"
Set-Content $item $c

The script only updates a single project *.sch file, so for projects with multiple schematic sheets I did those with a separate version of the script. An improvement would be to automatically migrate all the *.sch files in a project folder.