Skip to content

swig interface idea

Thomas Pointhuber edited this page Aug 13, 2019 · 17 revisions

Idea

Instead of having a separate repo, it will be included into KiCad upstream. This allows us to directly interface to _pcbnew.so for example. I need to look into the details, but it should be possible to define a class structure in swig which is independent on the C++ class structure (including renaming and properties instead of getter/setter). This causes a lot of work, because we cannot use the include directive of swig, but on the other hand makes us extremely independent on the original code-base regarding interface design. Furthermore, this means we will not expose any features which we actually not want to have exposed.

I think an important step before getting pcbnew+eeschema working in a nice way would be to unify the coordinate system so we can link both together without symbol duplicates. Furthermore, _pcbnew.so,... should dynamically linked to the kiface libraries (probably be renamed to pcbnew.so or so?) To reduce redundant compilation and storage usage.

Development Resources

https://github.com/swig/swig/issues/805

Basic structure

kicad          # main package
|- common.py      # common stuff (geometry, colors, project handling?)
|- eeschema.py    # schematic and symbols
|- pcbnew.py      # board and footprints
|- util.py        # scripting, wizard,... (merge with common?, only non C++ dependent?)

Common

geometric.Point1D?   # geometric -> primitives?
geometric.Point2D
geometric.Point3D
geometric.Distance
geometric.Rect
geometric.Line
geometric.Polygon

gal.Color
gal.??                # draw on the canvas
gal.Window            # modify current window settings (zoom, highlight,...)?

??.Net

plugin.Manager       # register plugins
plugin.gui.Button
plugin.gui.Dialog    # create wx dialog
plugin.gui.Menu

tool.??     # run tools, register tools?

settings.?? # read/write settings, change settings
??.??       # read/write library table

io.Import   # whole projects
io.Export   # whole projects
io.Utils    # read/write KiCad config files

Eeschema

Schematic
Sheet
Symbol

item.Arc
item.Bus
item.Circle
item.Graphic
item.Line
item.Pin
item.Polygon
item.Text
item.Track

??.Layer

io.Import
io.Export
io.Plot    # merge with export?

rules.Erc  # create new erc rule, run erc?

utils.??   # helpers for schematic/symbol generation

Pcbnew

Board
Footprint

item.Arc
item.Circle
item.Dimensions
item.Line
item.Pad
item.Polygon
item.Text
item.Track
item.Via
item.Zone

??.Layer

io.Import
io.Export
io.Plot    # merge with export?

rules.Drc  # create new drc rule, run drc?

utils.??   # helpers for footprint/board generation (like in KicadModTree)

Util

scripting.Bom     # create a BOM
scripting.IO      # create importer and exporter for file formats
scripting.Wizard  # create footprints/symbols/3d-models
scripting.Tool    # create Action Plugin (to some extend also scriptable)
scripting.util.Argparse  # import data from .yml files, footprint wizard,...
scripting.util.Parameter # defines a specified data-value (measurement,... imported from file or wizard)

??.??  # create new supplier for library entries (like from a parts database)

Clone this wiki locally