Skip to content
项目

关于

Scripts for performing image diffs between pcbnew layout revisions

设计与媒体

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

KiCad-Diff

This is a Python program that compares revisions of KiCad PCBs.

The layers of a KiCad board are exported to SVG, and the output is presented as a gallery of images on a web page. Each layer pair can be compared, and the combined view clearly highlights where the layers differ from one another.

The diff output can be scrolled and zoomed in and out for closer inspection. The pair of "before and after" views will also pan and zoom together.

Instructions

Dependencies

  • KiCad 5 or later (which provides most of the dependencies)
  • Python 3
    • wxPython (for the revision picker ui)
    • pexpect (macOS only)
  • A version control tool like Git, Fossil or Subversion.

wxWidgets

On macOS using Apple silicon, you should export these flags first

export CFLAGS=-I/$(brew --prefix)/include
export CXXFLAGS=-I/$(brew --prefix)/include

On Ubuntu, wxWidgets can be installed with:

sudo apt install python3-wxgtk4.0

Installing dependencies

cd KiCad-Diff
pip3 install -r requirements.txt

Usage

Make sure you have SCMs (Git, Fossil and/or SVN) available through the PATH variable. Add the script path to your PATH too so the kidiff and plot_kicad_pcb will be available. This can be done easily with:

cd KiCad-Diff
source env.sh

The terminal should give you some useful information on progress. Please include a copy of the terminal output if you have any issues.

Command line help

usage: kidiff [-h] [-a COMMIT1_HASH] [-b COMMIT2_HASH] [-g] [-s SCM] [-d DISPLAY] [-p PORT] [-w] [--no-browser] [-v] [-o OUTPUT_DIR] [-l] [-f] [PCB_PATH]

Kicad PCB visual diffs.

positional arguments:
  PCB_PATH              Kicad PCB path

optional arguments:
  -h, --help            Show this help message and exit
  -a COMMIT1_HASH, --commit1-hash COMMIT1_HASH
                        Commit 1 hash
  -b COMMIT2_HASH, --commit2-hash COMMIT2_HASH
                        Commit 2 hash
  -g, --gui             Use gui
  -s SCM, --scm SCM     Select SCM (git, svn, fossil)
  -p PORT, --port PORT  Set webserver port
  -w, --webserver-disable
                        Do not execute webserver (just generate images)
  --no-browser          Do not automatically open a browser window (webserver still runs)
  -v, --verbose         Increase verbosity (-vvv)
  -o OUTPUT_DIR, --output-dir OUTPUT_DIR
                        Set output directory. Default is '.kidiff'.
  -l, --list-commits    List commits and exit
  -f, --frame           Plot whole page frame

optional arguments for development use:
  --dev, --live-assets  Link webserver to source files, so changes can be seen live.

Usage examples

# With a Git repo
kidiff led_test.kicad_pcb

# Forcing an specific SCM when more than one is available (Precedence: Git > Fossil > SVN)
kidiff led_test.kicad_pcb --scm fossil

# With a SVN repo, passing commit 1 and 2 on the command line
kidiff led_test.kicad_pcb -a r1 -b r3

Debugging

There should be some output in the launch terminal. Please copy this and include it in any issues posted. If the program is not working, please check that you can run the plot_kicad_pcb routine directly by invoking it from the command line and passing the name of the *.kicad_pcb file.

plot_kicad_pcb board.kicad_pcb

User Interface

By default kidiff automatically starts a webserver and opens a browser window to visualise the results. The main page shows:

  • A table of side-by-side meta data and project statistics. The commit 1 is on the left and commit 2 on the right.
  • A clickable gallery of individual schematic sheets and board layers. A preview of commit 1 is shown in the gallery tile.
    • If commit 1 and commit 2 are identical for that sheet/layer, (=) is shown in the caption to indicate they are equal.

Clicking any of the tiles opens that sheet/layer in a triptych view. It shows:

  • Commit 1 and commit 2 overlaid and blended, so that equivalent sections are drawn in grey, sections unique to commit 1 are drawn in cyan, and sections unique to commit 2 are drawn in red.
  • Commit 1 (the "before" view) in its own frame, drawn in the colour of that layer as defined in KiCad.
  • Commit 2 (the "after view) in its own frame, drawn in the colour of that layer as defined in KiCad.
  • A table of differences, grouped by category.
    • If there are no differences for that category, (=) is shown in the tab name to indicate they are equal.

Screenshots

Commits Selection GUI
Commits Selection

Gallery view
Gallery View

Triptych view
Triptych view

Attributes Diff
Attributes Diff

Development

Testing

pytest # (~4 s, no KiCad/Playwright required)
pytest --slow # (~11 s, end to end tests, skipped if KiCad/Playwright can't be found)

探索相关项目

加载中…