How to convert Kicad Nightly Build board files into stable release versions!

Hey all, I just went through this process and thought it might be helpful to share my notes for anyone else in my situation.

If you created a project in Kicad Nightly Build, here is how you can convert the board file (the *.kicad_pcb files) to open it in Kicad Stable Release. You can also then share it with others who use Altium, for example, because Altium has a kicad conversion wizard.

I got a bunch of great info from this source: Can't open boards designed with nightly in stable (5.1.4)

Instead of writing code (like a python script) I am just using my favorite text editor, Sublime Text.

STEPS TO SUCCESS:

  1. make a backup copy of your [PCB_name].kicad_pcb file. This is what you’ll be editing.
  2. Open [PCB_name].kicad_pcb in a text editor
  3. Change first line to this: (kicad_pcb (version 20171130) (host pcbnew “(5.1.9-0-10_14)”)
  4. Open kicad 5.1.9 (stable release) and navigate to the project. Try to open the .pro file. You should see [PCB_name].kicad_pcb in the project file browser.
    In text editor:
  5. Delete the entire “defaults” section just below it
  6. Delete the entire “stackup” section if you have it
  7. Delete the “max_error” line (might be around line 90)
  8. Delete all these lines, if you have them:
    “paper”
    clearance_min
    via_min_annulus
    through_hole_min
    hole_to_hole_min
    all the “user_diff_pair” lines
  9. Delte all “keepout” lines. Yes, all keepout areas will be lost.
  10. Delete all “(tstamp ----)” parentheses - NOT the entire line, just everything inside the pairs of parentheses. Yes, all timestamps will be lost.
  11. Delete all “(pinfunction ___)” parentheses - NOT the entire line, just everything inside the pairs of parentheses.

Save [PCB_name].kicad_pcb in the text editor.

Now for the hard part:
Go back to Kicad and try to open [PCB_name].kicad_pcb in the project viewer. It should give you an error message. Expand the error message. Most likely it will say “Expecting 'at, drill, layers, net, …” etc. with a list of all the arguments it’s expecting. It will tell you what line and what character on that line (offset) the problem is. Go to that line and delete or edit the problem argument. For example you might have to delete “(tstamp de325971-7887-4770-b178-58c7e0dd27cf)”.
Save in text editor. Try to open it again in kicad.
If you fixed it, it’ll give you an error on a different line. Great! Then fix that line, save and repeat, etc. etc., until you can get all the way to the end of the file with no errors. Then the file will open in kicad.

There are some errors you’ll have to figure out for yourself. Luckily kicad gives you a line and an offset (most of the time) that tells you exactly where the problem is. The new versions of kicad give a lot of extra info that you’ll have to delete.
Be extremely careful not to accidentally delete any extra parentheses or quotation marks!!!

If you ever get an error without a line number, that’s tricky. What you can do to narrow down the location of the error in the text is this:
put a ‘)’ after one of the “module” members. That will tell kicad that the file is over, and it will attempt to open everything above the ‘)’. If the file opens, that tells you that your error is below the ‘)’. Keep moving the ‘)’ down the file until the error comes back. That will tell you that the error is between where the ‘)’ is now and where it was last. It will probably be due to an unclosed pair of parentheses, or unclosed pair of quotes.

Once all errors in the file are handled, the file will open.

Good luck to all! I was really relieved the first time I was able to open my kicad nightly build board file in stable release.

Now I just have to re-make all the schematics manually and re-link all the symbols…

2 Likes

Modifying the board file is a lot easier than the schematic

I see a great opportunity for improving KiCad here.
With these S-expressions everything is is divided into sections.
It would be great if KiCad just interprets everything it can, generates an error message when it can not interpret everything, and then also generates a report with everything it can not interpret.

Doing something like this should not be much programming work and would probably be useful to a lot of people.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.