Automatic export to SVG on save or commit?

Is there a way to automatically export a schematic (and layout) to SVG either on save or on a Git commit?

I need this in almost every project, to automatically generate up-to-date documentation readable straight from the browser, i.e. without going through KiCad.

1 Like

Don’t know about Kicad save but you can create hooks on git actions.

That’s why I wrote on git commit. The question is: How do I
automatically export a KiCad schematic to SVG?

AFAIK this will have to wait for Python scripting in eeschema.

Where can I find more details?

Better informed members of this forum can tell you or you can check the Gitlab tickets if in a hurry.but my impression was not until V6.

For V5 you can go with plotkicadsch. It can generate a svg of a schematics or a svg of a diff of schematics. I think that is your only option for your workflow (without KiCad).

There was also a user which had a headless Kicad setup, which would automatically run and perform a couple of actions (plot being one of them) when a new commit was detected on a repo. But this was server side thing. Can’t find a link though.

2 Likes

Yes python API for eeschema is planned for v6. So there is no “proper” way to do this right now but if you are brave enough you can do what this person did: https://www.youtube.com/watch?v=NZCyk3rmmGQ

1 Like

That looks quite nice, although I can’t install it due to some incompatibility between OCaml and gcc 10. So I have to wait a bit.

Looking forward to that! It would be extremely handy to always have an up-to-date schema and layout to share on the web. Currently I’m using KiCad to document the wiring at Dim Sum Labs hacker space in Hong Kong.

Not brave enough for that. :joy:

As fast as the layout is concerned, you might find this project helpful - it can be used to generate layout diffs. A CLI has very recently been added which might help you to automate the process.

1 Like

kicad-automation-scripts can do it:

You can try “eeschema_do export” command with “–file-format svg”. It uses KiCad to do it.

The tool can be integrated with KiPlot:

Docker with all the needed tools (including KiCad 5.1.6) can be found at docker hub:
https://hub.docker.com/repository/docker/setsoft/kicad_auto

Examples using these docker images on GitHub:

Also for GitLab:

and:

For the PCB:

  1. KiPlot supports the options found in the “Plot” menu (using Python bindings)
  2. The “Print” style is supported using “pcbnew_do”, but I’m currently supporting PDF format.
3 Likes

Thanks for the suggestion! It looks like a heavy weight solution, though, especially for my setup: I run KiCad on Windows, and I git commit from a Linux running in a virtual machine. For now I am just exporting manually to SVG from Eeschema. I hope that in the future I can hook a Python script to save.

Don’t forget you can use GiTHub/GitLab CI/CD actions to do the job.
It means you can use their servers to run the job, wait a few minutes and download the results. You don’t need to run it in locally.

This Github action specifically might be worth a try:

I’ll see. Thanks for the suggestions! So far I continue exporting manually, waiting for a light weight native solution in the future. But maybe I’m just old fashioned. :joy:

The layout SVG export on KiPlot is light weight. The problem is the schematic, because Python bindings aren’t implemented, yet

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