Hi guys, I am trying to make an experiment with Kicad code, to have a tool to export the old
format the schematic for using with old plugins/scripts while we don’t have such a thing implemented
with the python API. The branch I am using is 6.0.2
What I want to do is to pass the schematic through the command line, save the old format, and exit without interaction.
This thing already works. Once the schematic is open I can Ctrl+S to save the project with the legacy
format and extension.
Now, I want to make this automatic, to launch, save and close Eeschema. The save function I am using is
the same is found in the Ctrl+S shortcut.
So, I would like to ask you guys if you know where in the code I can call Save and Exit functions.
They could be executed as soon as all schematic pages are loaded.
So, does anybody have any hint where is this place/class/method?
Meh it’s just an exporter. Conversion to other formats is always lossy. We have import from other formats too and accept some level of lossiness there, I’ve never really understood the opposition to treating old KICad formats in the same way.
It’s not just an exporter. It’s a hack that works in some cases by happenstance and not intention. Unlike exporters no dev made sure it produces anything sensible or sane.
I’m not sure how much data will be lost as I don’t keep track closely on what features were introduced when. It may be good enough for majority of simple schematics, I don’t know. But It will likely break with buses, hierarchical sheets etc.
I am already exporting in the legacy format however it requires human interaction to save the design.
So, if I find where the schematic is loaded I can try to save it and exit right after that without interaction.
The code is a bit hard to understand. But this is fine.
From inside the build folder, I am trying to find any occurrence of this "[.:]Save("
Do you guys know if it is possible to generate a missing -cache.lib file automatically from the .kicad_sch loaded, somehow? I also need this file for my application to work.
I guess it would probably require a similar hack to extract the symbols from *.kicad_sch. But if you still have the symbol libraries that were used in KiCad 5 format, then KiCad 5 (maybe 6 also?) could recreate (“rescue”) the cache file from them.
In KiCad 5, the cache file is actually not needed if all symbols (with the matching versions) can be found in the configured libraries. In KiCad 6 as well, but it displays a different warning dialog, if I remember correctly…
Yeh, I was looking for a way to export this from .kicad_sch. But there is not a method that does that recreating the whole file assuming no-cache library file was found. At least I could not find any related method yet. But maybe I can find something in Kicad 5 or 5.99.
Now, if there is no method like this, I am wondering what should I do to manually create this file, instead.
The generated .sch, for my board, looks good, and nothing is missing. But the external program that uses my .sch file relies on this file to generate the schematic symbols.