It seems that somebody was already working on eeschema and pcbnew command line interface, but their work has not been included in the release versions.
I experimented with UI automation and eeSchema (Scott Bezek’s blog post), and hit a major problem (for me anyway). UI automation will work in headless mode when a monitor is not installed, but not in a purely console-only environment. I suspected that when looking at the readme for Scott Bezek’s project, but I went ahead and tried it anyway.
I’m still working through the other links that have been posted, and will check out eeshow next.
I’ve got a script working on Ubuntu Server 16.04 (headless, text-only) which will convert a .sch file to a .svg file.
However, the eeschema file that I create on my Ubuntu 16.04 desktop throws an error about the motors library not being present. I’ve included the version info for each eeschema installation below. My question is how should I set the Ubuntu server KiCAD installation up to minimize the problems that users would have doing a conversion? Are there standard libraries that I need to install? Do I need to force the server to run the latest version of KiCAD? Once this script is working well the next step will be to wrap it in a sample Node.js app so that it can be used as a web service. I’d like to have instructions on how to install KiCAD available so that as many users as possible will be covered.
The -cache.lib file should come along the .sch file. All you need to do is parse .sch files and place the -cache.lib as the topmost library. You should also add -cache.lib to .pro file at the top of the list. This way the eeschema will find all of the symbols. It might still complain about not finding the rest of the libraries.
@MitjaN I’m showing my inexperience with KiCAD here. How do I place the *-cache.lib file as the “topmost library”? I tried creating a lib_sch directory and set the library search path as described in this Hack-a-day post.
When you talk about adding *-cache.lib to the .pro file, do mean adding it as the value for LibDir here in the text of the .pro file?
Note that the path in LibName1 can also be full filesystem path, or relative to any of the library search paths, but always excludes “.lib” extension. KiCad automatically adds the path of the current project and standard KiCad installation libraries to the library search path. (I use Windows but the same principle applies, use forward slash “/” for Unix or Windows)
@bobc That worked great, thanks. I’ll have to figure out how to edit those library entries in the .pro file when it’s uploaded with the rest of the project files. I’ll probably use sed for that task.
We have a standard practice for a guy who starts a design the first thing he does is open a schematic place a symbol and save, so the -cache.lib is created. Then he adds the -cache.lib to the list of used libraries and places it at the top of the list with eeschema. Then the project can be added to the VCS and shared with others.
Once the cache file is listed at the top, are any of the other library entries below it needed anymore? I’m asking because I’m trying to figure out if I can reduce the complexity of having to shift every LibName entry down in the script. If I could just edit the first one and then remove the rest that would make things a little easier, but only makes sense if the other libraries aren’t needed once the cache library has been added at the top.