Create kicad_sch files with a python script for an import from pdf/png to schematic plugin

I am working on a script to grab a circuit from a pdf or image file. I’m getting close to having the part recognition working consistently, but I need a way to output the circuit to a schematic file. Is there a plugin that handles the following inputs and outputs, or at least a good starting place for me to make one?
If I did end up making my own, I was thinking of using graphviz, because it can already solve some of the coord handling problems. Is there other solutions that are a better fit?

Inputs:

  1. Part name (ex: “Device:R”)
  2. Part coordinates
    - From reading what limited info I could find about the topic on this forum, this is something people
    seem to be concerned about, because part cords tend to be hard to generate, while keeping a readable schematic. In my application, the coordinates are just pulled from a appropriately scaled version of the target import image, so
  3. Net connections
    - I do not have this implemented in the schematic recognition script yet, so the format is flexible.
    Presumably, it would be something similar to the kicad netlist that is generated from kicad.
  4. Reference (ex: “R7”)

Outputs:

  1. .Kicad_sch (version 6) of the completed circuit

Is a plugin that can import images of circuits something that seems interesting to this community?
I’ve been wanting one for a while because I got tired of re-designing demoboards, typical application circuits from datasheets and random crap I found on stack overflow.

I think it would be very interesting for any electronics community if it works.

A python API has been promised for KiCad v6. Actually it’s the last new feature which is not there yet. I think the most productive way would be to use that API when it becomes available. What programming language are you using?

Python. OpenCV for the recognition of parts.

The python API sounds cool, As far as I know though, it is not planned to allow scripts to be able to synthesize circuits from code? Either way, waiting for this library seems like a good idea.

What do you mean by that? Currently in the pcbnew API it’s possible to create layout from scratch. There’s no reason to expect anything less from the upcoming schematic API. The API is of course agnostic about how you get the data. If you already handle the data in python, you can create a KiCad circuit diagram with it.

1 Like

Are you aware of projects like uConfig?

I was looking for another tool to extract schematic symbol data for KiCad from a pdf datasheet. It uses a spreadsheet as an intermediate format to organize and modify the extracted data, but I can’t find it right now.

As a popular open source project, KiCad attracts attention from others who have their own ideas for additions and extensions. At the link below for example there is a quite long list of “side projects” that work with KiCad.

1 Like

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