GithubHelp home page GithubHelp logo

leoheck / kiri Goto Github PK

View Code? Open in Web Editor NEW
478.0 15.0 32.0 4.75 MB

Kiri is a visual tool designed for reviewing schematics and layouts of KiCad projects that are version-controlled with Git.

License: MIT License

Shell 58.30% HTML 7.45% CSS 2.87% JavaScript 23.59% Python 7.31% Makefile 0.48%
kicad diff schematic layout plotkicadsh plotgitsch kicad-diff kidiff visual-diff kiri

kiri's Introduction

KiCad Revision Inspector (KiRI)

KiRI started as a script to experiment having a visual diff tool for KiCad projects including schematics and layouts. After some time, it became an interesting and it is still being updated.

Currently, KiRi supports KiCad >= 5.

Internally it uses existing tools to generate svg images of schematics and layouts to be compared.

In this way, when exporting schematics, if:

  • KiCad 7/8 is installed, the kicad-cli is used.
  • KiCad 6 is installed (which does not have kicad-cli available), schematics are exported using xdotool on Linux/Windows and cliclick on macOS, using the GUI. This method is far from the ideal and it is not recommended.
  • KiCad 5 is installed or if the projects is based on KiCad 5, plotkicadsch/plotgitsch are used to export the schematics.

However, when exporting the layout layers:

  • Kicad-Diff is used for all supported KiCad versions using pcbnew library available in python. It is also possible to use kicad-cli to export the layout layers however this process is slower than using Kicad-Diff.

KiRI Installation

Check the Installation instructions, here.

Using KiRI

KiRI can be launched with the following command, anywhere, inside or outside of the repository of the project.

kiri [OPTIONS] [KICAD_PROJECT_FILE]

KICAD_PROJECT_FILE can be passed, but it can also be omitted. If running from inside the project's repository, it will use the .pro or .kicad_pro available. If both are present (which is not good), it will ask your choice. The same happens is running outside of the repository without passing the KICAD_PROJECT_FILE.

Command line options (aka Help)

Command line flags can be seen using the -h flag

kiri -h

Archiving generated files

There is a possibility to archive generated files (check the help above).

To visualize generated files it is not necessary to have KiRI installed. You just have to unpack the generated package and then execute the web-server script (./kiri-server) inside of the folder, as shown below:

tar -xvzf kiri-2021.11.18-16h39.tgz
cd kiri
./kiri-server .

KiCad Integration

It is possible to integrate KiRI with PCBNew by adding a button to its toolbar with the following command:

# Create folder if it does not exist
mkdir -p "~/.kicad/scripting/plugins"

# Copy the plugin there
cd ./kiri
cp -r "./kicad/plugin/kiri_v6/" "~/.kicad/scripting/plugins/kiri"

KiRI Screenshots

Browsing the schematic view walking through and comparing each page of the schematics, individually.

Schematic View

Browsing the layout view walking through and comparing each layer of the layout, individually.

Layout View

Here is the comparison of the schematics when the project is updated from using KiCad 5 (.sch) to KiCad 6 (.kicad_sch).

Layout View

Shortcuts are a really good way of walking through the commits, pages and layers quickly. Check the available shortcuts by hitting the shortcut i.

Layout View

A quick and old demo on the Youtube.

KiCad Revision Inspector Demo


Are you enjoying using this tool, feel free to pay me a beer :). Cheers!

kiri's People

Contributors

bobatsar avatar ckuhtz avatar edahlseng avatar iamphytan avatar leoheck avatar luzpaz avatar marcelrobitaille avatar marcovannoord avatar notpushkin avatar onlya avatar pedro-rendeiro avatar stevaedrum avatar topherbuckley avatar usa-reddragon avatar vfelsner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kiri's Issues

kicad 7?

The README lists support for kicad 5 and kicad 6. Is there support for kicad 7? If not, is it planned? As far as I know, the file format changed again in 6 -> 7.

View types

It seems that toggling view types with hotkey 'd' doesn't actually do anything?

WSL Web server address not reachable

I run kiri on a simple KiCad project on WSL Debian. It successfully runs but 127.0.0.1:8080 is not the right address for Windows OS.
As it is bridged to the local network, it is ideal to get 0.0.0.0 as the server address and using cut -d' ' -f1 <<< $(hostname -I) as the actual address.
With the modification above (in the kiri main script), I am able to get the page loading. However, the image and server checks are still 127.0.0.1, which makes it grays out, unable to load the image and JavaScript substitutes the class as "server_down".

All in all, I think it's a good idea to make the server address to be "0.0.0.0" instead of "127.0.0.1" so that everyone including WSL can access the generated pages.

I will have a look and submit a PR later. It sounds some more modifications to do.
Or do you have the other good idea to solve this problem for WSL?

empty `title`, `revision`, `date` html fields

First off, I've been loving this tool! Thank you for streamlining kidiff and plotgitsch, it's a pleasure to use.

Minor error I have is a few html fields aren't populating. See pic below:
image

I tried fiddling with the bash, like here, but all I can determine is $title == "" is returning true, but not sure why. Looks like you're just extracting it from the filename, right?

  • using WSL2

Any tips would be appreciated. πŸ˜„

Broken branch for KiDiff submodule

In commit 0dfbbd1, The KiDiff submodule was updated, but that branch no longer exists. Can’t make a pull request this second to find a suitable branch at the moment hence making this issue, but it should be a simple fix

Handling submodule changes between commits

The team I work on uses Git submodules for our component libraries. Sometimes a single commit does nothing but change a submodule commit reference. It would be great if those changes could also be viewable in this tool (note that we don't store the -cache files in Git).

How could this be supported? Would a shallow checkout of the repository need to be made for each commit, include submodules, in order to generate images against a full working copy of the repository?

This is related to #14, but distinct. While it appears that plotgitsch doesn't currently support libraries, it looks like KiCad-Diff does, and so solving this would at least allow submodule changes to propagate through for board layouts.

plot_kicad_sch distribution based locale error

I am running kiri on WSL2 Ubuntu 20.04.5 LTS (GNU/Linux 5.15.79.1-microsoft-standard-WSL2 x86_64)

When I run plot_kicad_sch I get the following error:

~/.local/share/kiri/bin/plot_kicad_sch: line 144: warning: setlocale: LC_ALL: cannot change locale (C.utf8): No such file or directory
   |
   | Display server = x11
   | Schematic path = PWM6FPC.kicad_sch
   |    Output path = .
   |  Kicad project = PWM6FPC.kicad_pro
   |
   | Launching Eeschema...
   | - Window 6291474 title = " (failure in conversion from UTF8_STRING to ANSI_X3.4-1968)]"
   |   Dismissing window
   Status: 124

This seems to be a similar issue to #63, but is a slightly different root cause. I followed some of the same troubleshooting steps and seemed to find a temporary solution.

Output of locale -a:

C
C.UTF-8
POSIX
en_US
en_US.iso88591
en_US.utf8

The locale C.utf8 does not seem to exist on my system.

I fixed it by modifying the executable in ~/.local/share/kiri/bin/plot_kicad_sch changing line 144 from export LC_ALL=C.utf8 to export LC_ALL=C.UTF-8.

You may want to add a handle for the different variations as it does not seem to be standardized between distributions (at least according to a post I saw on StackExchange).

THT holes with corresponding pads in upper left corner

I am using your tool and am mostly satisfied with the result. Only one issue occured to me.
As visible in attached picture, all through holes with their corresponding pads are collected in the upper left corner instead of being in their designated places.
I have tried the same pcb file in kidiff alone, their the holes with pads stay in the correct place.
If any more information is required, I will gladly attach it.
KiRI_issue_pads

Schematic diffs not output

When I run kiri there is no schematic diffs. During the setup I notice that now there is no ./install.sh on cd kiri/submodules/plotkicadsch

When running kiri I got:

Output folder: /home/pc/development/kiri/kiri
/home/pc/development/kiri/bin/kiri: line 1002: receiver.sch: command not found
/home/pc/development/kiri/bin/kiri: line 1003: remote-hw.sch: command not found

If I use a kdiff from last July everything works fine.

gsed: -e expression #1, char 33: unterminated `s' command

I just installed the tip of main and am getting the following error when running Kiri:

gsed: -e expression #1, char 33: unterminated `s' command

I haven't dug in at all, yet. Any chance this looks like an easy workaround or fix?

Installation fails on Ubuntu 22.04.

Hi,

I wanted to try Kiri again with the newly tools for KiCad6 but I can't get past the installation procedure. It always fails while installing the dependencies, specifically plotkicadsh and kicadsch. During the main install it then obviously can't find plotkicadsh and stops the installation there. Do I have to modify the commands etc. to get it working with KiCad6 on Ubuntu 22.04?

log:

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] no changes from https://opam.ocaml.org

<><> Synchronising development packages <><><><><><><><><><><><><><><><><><><><>
[ERROR] Could not synchronize ~/.opam/4.09.1/.opam-switch/sources/plotkicadsch from
        "git+file:///~/.local/share/kiri/submodules/plotkicadsch#HEAD":
        "/usr/bin/git fetch -q" exited with code 128
[plotkicadsch.0.9.0] fetching sources failed: git+file:///~/.local/share/kiri/submodules/plotkicadsch#HEAD
[ERROR] Could not synchronize ~/.opam/4.09.1/.opam-switch/sources/kicadsch from
        "git+file:///~/.local/share/kiri/submodules/plotkicadsch#HEAD":
        "/usr/bin/git fetch -q" exited with code 128
[kicadsch.0.9.0] fetching sources failed: git+file://~/.local/share/kiri/submodules/plotkicadsch#HEAD
[NOTE] Package digestif is already installed (current version is 1.1.2).
[NOTE] Package lwt is already installed (current version is 5.5.0).
[NOTE] Package lwt_ppx is already installed (current version is 2.0.3).
[NOTE] Package cmdliner is already installed (current version is 1.1.1).
[NOTE] Package base64 is already installed (current version is 3.5.0).
[NOTE] Package sha is already installed (current version is 1.15.2).
[NOTE] Package tyxml is already installed (current version is 4.5.0).
[NOTE] Package git-unix is already installed (current version is 3.9.1).
[email protected]:~$ bash -c "$(curl -fsSL https://raw.githubusercontent.com/leoheck/kiri/main/install_kiri.sh)"

Installing KiRI

Installation path ~/.local/share
Change it using KIRI_INSTALL_PATH environment variable

Hit ENTER to continue or Ctrl+C to leave.


cp: cannot stat '../kiri': No such file or directory
environment: line 44: cd: ~/.local/share/kiri/submodules/plotkicadsch: No such file or directory

kiri crashes with a segmentation fault (Linux:Ubuntu)

Hi,
first of all, thank you for your work, which is much appreciated.
I like to inform you, that in your last changes to the kiri bash script a command loop was introduced.

I am talking about commit 91fe2be which was made in response to #51.

You missed to add the command prefix, so your rename function calls itself, which results in a segmentation fail, at least under Ubuntu 22.04 (fresh install).

Zooming/Pan on PCB layout

I can't seem to zoom in or Pan when looking at PCB's and it seems that the view buttons don't work either when looking at the PCB layout.

Workaround for Plotting Schematics on Kicad 6 with Plotgitsch

Plotgitsch just plots Kicad 5 schematics known by the extension .sch.
Version 6 of Kicad uses a new format and extension .kicad_sch.

Kicad 6, has code that can open .kicad_sch files and save .sch files. This was used during the early days of Kicad 6 when Kicad 5 was the latest released version.

So, the idea is to modify the Kicad 6 code, more specifically EEschema, to launch .kicad_sch files as it already does from the command line, save/create an alternative version of the files using .sch format, and exit.

With that, plotgitsch can be used to create a diff in the project.

I can already save files manually. Now I still have to make this process automatic, without interaction.

I would appreciate any help to understand Kicad's code since it is pretty complex.

Changing schematic sheet fails

When attempting to open another sheet on a hierarchical design the firefox dev tools claims:

Uncaught ReferenceError: change_page_onclick is not defined
    onclick http://127.0.0.1:8080/web/index.html:1

It appears all the svg files needed for the diffs exist in the sub directories of .kiri (i.e. they plotted just fine), but the html or js is missing something.

cp: directory /path/to/project/kiri/web does not exist

When running kiri --remove ./project.pro, I'm getting the following error message:

Assembling the HTML
cp: directory /path/to/project/kiri/web does not exist
< many more error messages much like this >

Any ideas on what might be causing this? (I moved into a path that doesn't have spaces, just to be sure! πŸ˜„ )

'PCB_PLOT_PARAMS' object has no attribute 'SetSvgPrecision' - Debian 11 Bullseye

This error happens during the image generation stage on Debian 11 Bullseye (latest version of Debian).

AttributeError: 'PCB_PLOT_PARAMS' object has no attribute 'SetSvgPrecision'

It will make the PCB image not shown and only the schematic changes are displayed.

It is because Debian 11 only has KiCad 5.0.9 as the stable release and the pcbnew python port of KiCad 5.0.9 does not have SetSvgPrecision method as I have checked by calling import _pcbnew;_pcbnew.PCB_PLOT_PARAMS_SetSvgPrecision. In order to make it work, KiCad 6+ should be installed. On Debian 11, this is done by adding "bullseye-backports" apt repo and install KiCad from it.

It is noted that the other platforms like Ubuntu 20.04 may also encounter this problem.

Check for kicad-cli does not work

In generate_schematic_artifacts and generate_layout_artifacts there is a test for whether kicad-cli exists:

if [[ -f $(which kicad-cli 2>&1 > /dev/null) ]]

Since all output is piped into /dev/null, nothing is returned from which, so the test for the file's existence fails.

Instead of checking for the existence of /usr/bin/kicad-cli, I would recommend if type kicad-cli or if command -v kicad-cli.

Stack-Overflow: How can I check if a command exists in a shell script?

realpath errors

I recently downloaded the latest version of kiri and tried running it for the first time in a while. I'm getting multiple of the following errors when running on macOS:

realpath: illegal option -- -
usage: realpath [-q] [path ...]

kiri version:

kiri df1308b 
kicad 6.0.9-0
plotgitsch v0.9.0-8-ge5f94e4
kidiff f0143ce 

Creation of SVG problem

Hi,

I have reinstalled "kiri" tools, previously i use "kdiff" (Great tools). Now i have a problem with the "kiri".
When i launch the tool, I have an errror because the svg file aren't not generated.
Note: It's ok for the PCB, I think that the problem is with plotkicadsch

Image Magick is opening in my desk with the comparaison image !!!

When I launch with several parameters I have this returns.


[a.stephan1@frtn01s ~]$ kiri -r -l -D -dp -dk

  kicad_pro_path = /mnt/Data-Raid1/data/VirtualMachines/ASCIE/Design/Personal_Projects/Test-Tools-Kiri/TopBoard/TopBoard.pro
       repo_path = /mnt/Data-Raid1/data/VirtualMachines/ASCIE/Design/Personal_Projects/Test-Tools-Kiri/TopBoard

kicad_pro_subpath = .
kicad_pro = TopBoard.pro
kicad_sch = TopBoard.sch
kicad_pcb = TopBoard.kicad_pcb
KICAD_VERSION = 5
KICAD_PCB_VERSION = 20171130
kicad_pro_filename = TopBoard
kicad_pro_extension = pro
kicad_sch_extension = sch
kicad_pcb_extension = kicad_pcb
output_dir = /home/a.stephan1/kiri

Output folder: /home/a.stephan1/kiri
Removing leftovers from the previous run

Generating artifacts
25 commits, totaling 600 comparisons

  1. 4315759 - aac2582
    plotgitsch -l ./TopBoard-cache.lib -k -m -c FF0000:008FFF:FFFFFF:222222 4315759 aac2582
    use compare (ImageMagick) between bitmaps between Git rev 4315759 and Git rev aac2582
    Recreating missing sch1-TopBoard.svg
    Recreating missing sch2-TopBoard.svg
    kidiff TopBoard.kicad_pcb --webserver-disable -b 4315759 -a aac2582 -o "/home/a.stephan1/kiri"

    SCM Selected: git
    Kicad Board Path: /mnt/Data-Raid1/data/VirtualMachines/ASCIE/Design/Personal_Projects/Test-Tools-Kiri/TopBoard/TopBoard.kicad_pcb
    Kicad Project Path: /mnt/Data-Raid1/data/VirtualMachines/ASCIE/Design/Personal_Projects/Test-Tools-Kiri/TopBoard
    REPO Path: /mnt/Data-Raid1/data/VirtualMachines/ASCIE/Design/Personal_Projects/Test-Tools-Kiri/TopBoard
    Kicad Project Dir: .
    Board File Name: TopBoard.kicad_pcb
    Output Dir: /home/a.stephan1/kiri

Commit 1 (a): aac2582
Commit 2 (b): 4315759
sed: pas de fichier d'entrΓ©e
sed: pas de fichier d'entrΓ©e
Recreating missing file: /home/a.stephan1/kiri/4315759/TopBoard-00-F_Cu.svg
Recreating missing file: /home/a.stephan1/kiri/aac2582/TopBoard-00-F_Cu.svg
Recreating missing file: /home/a.stephan1/kiri/4315759/TopBoard-31-B_Cu.svg
Recreating missing file: /home/a.stephan1/kiri/aac2582/TopBoard-31-B_Cu.svg
2. - 30dbd9c

Thanks in advance for your help.

Best regards.

Stephan

Blind vias not shown correctly

Hi,

i have a project where i use blind vias to different layers and want to track how they change. Problem is that vias are shown in all copper layers independet whether they are present there or not. This might be a problem of either kidiff or the pcbnew interface, but i worked around this in the kiri script for now.

What i did for my project at hand, i removed all vias from the layers and then modified all the circles with are also still in the svg to have white center and correct sized black rim. This works to some degree, the color coding of the delta is the wrong way round. So not sure how a proper solution would look like, even if kidiff / pcbnew would provide a proper via displaying svg.
For reference what i did to get blind vias working "correctly" in my project (note i hardcoded the via sizes):

for f in "${OUTPUT_DIR_PATH}/${commit_hash_1}/"*.svg
do
    cat $f | sed -e ':a;N;$!ba;s/\n/\t/g' | sed -e "s/<\/g>/<\/g>\n/g" | grep -v 'style="fill:\#FFFFFF;' | sed -e "s/\(g style=\"fill:\#\)000000\(.*stroke-width:\)0.001000\(.*circle.*r=\"\)175.000000\(.*\)/\1FFFFFF\298.8\3125.6\4/" > $f.1
    head -n -1 $f.1 | grep -v circle > $f
    head -n -1 $f.1 | grep  circle >> $f
    tail -1 $f.1 >> $f
    rm $f.1
done
for f in "${OUTPUT_DIR_PATH}/${commit_hash_2}/"*.svg
do
    cat $f | sed -e ':a;N;$!ba;s/\n/\t/g' | sed -e "s/<\/g>/<\/g>\n/g" | grep -v 'style="fill:\#FFFFFF;' | sed -e "s/\(g style=\"fill:\#\)000000\(.*stroke-width:\)0.001000\(.*circle.*r=\"\)175.000000\(.*\)/\1FFFFFF\298.8\3125.6\4/" > $f.1
    head -n -1 $f.1 | grep -v circle > $f
    head -n -1 $f.1 | grep  circle >> $f
    tail -1 $f.1 >> $f
    rm $f.1
done

Cheers
Dennis

SVGs not being output for schematics?

I'm trying to get this up and running on my local machine (macOS), but I just can't seem to get this working. I'm starting with a focus on the schematic diffs... it looks like no SVG files are actually being generated, and so kdiff is just using the blank SVG. I notice a text diff output in the console when I run kdiff --debug --verbose, but still no SVGs are generated. Do you have any pointers on how to debug this?

Empty output

When running kiri on a project I'm getting an empty output in the webpage. I notice that no artifacts are being generated (I see the following output):

Artiffacts Summary
0 commits, totaling 0 possible comparisons

This directory does have several commits however. The KiCad project file is in a subdirectory; does that have anything to do with this issue?

Images don't draw?

Hi,
after getting the install to finish, I am seeing that the webserver starts up and I can see the webpage. It seems operational but I do not see the generated diff images. I did see a flicker of what may have been the images once but the image is missing.

image

I am on Mac OS X 10.14.6 with brew installed.

Here is my -D output of the kiri call:

kiri -D Dimmerer.kicad_pro

INFO: kidiff is missing, skiping its use

KIRI_HOME_PATH = /Applications/KiCad/Plugins/Kiri/kiri
KICAD_VERSION = 6.0.0-0
CURRENT_PATH = /Users/nose/git/Dimmerer/KiCAD
KICAD_PRO_ABSOLUTE_PATH = /Users/nose/git/Dimmerer/KiCAD/Dimmerer.kicad_pro
REPO_ABSOLUTE_PATH = /Users/nose/git/Dimmerer
KICAD_PROJ_NESTED_PATH = KiCAD
KICAD_PROJ_ABSOLUTE_PATH = /Users/nose/git/Dimmerer/KiCAD
OUTPUT_DIR_PATH = /Users/nose/git/Dimmerer/KiCAD/.kiri
WEB_DIR_PATH = /Users/nose/git/Dimmerer/KiCAD/.kiri/web/

project_path: /Users/nose/git/Dimmerer/KiCAD
project: Dimmerer.kicad_pro
schematic: Dimmerer.kicad_sch
layout: Dimmerer.kicad_pcb

Get commits command
git log --date=format:'%Y-%m-%d %H:%M:%S' --pretty='format:%h | %ad | %an | %s' master --
Dimmerer.kicad_sch Dimmerer.kicad_pcb

Info: KiCAD/Dimmerer.kicad_sch does not have changes
Info: KiCAD/Dimmerer.kicad_pcb does not have changes
At least one file has changes: false

Commits list
1 2625e09 2022-06-25 23:10:47 Valle Working tree mods...
2 c893547 2022-02-16 21:36:28 Valle Vishay PowerPAK Footprint korrigiert
3 d77dcd4 2022-01-18 06:46:32 Valle Initial Restore nach GIT reinstall

Generating artifacts
3 commits, totaling 6 comparisons

 project_path: /Users/nose/git/Dimmerer/KiCAD
      project: Dimmerer.kicad_pro
    schematic: Dimmerer.kicad_sch
       layout: Dimmerer.kicad_pcb

Assembling the HTML

  • Adding commits list in index.html
  • Adding schematic pages list in index.html

    INFO: Pages lists differ on both commits. What should we do?

  • Adding layers list in index.html
  • Project's title: Dimmerer
  • Project's name: Dimmerer
  • Sch Title: Dimmerer
  • PCB Title: [missing]
  • Sch Revision: V1.1
  • PCB Revision: [missing]
  • Sch Date: 2022-01-03
  • PCB Date: [missing]
  • Initial selected commits: 2625e09, c893547
  • Initial schematic images:
    Sch 1: /Users/nose/git/Dimmerer/KiCAD/.kiri/2625e09/sch-Dimmerer.svg
    Sch 2: /Users/nose/git/Dimmerer/KiCAD/.kiri/c893547/sch-Dimmerer.svg
  • Inicial layer: id=00, name=F_Cu
  • Initial layer images:
    PCB 1: /Users/nose/git/Dimmerer/KiCAD/.kiri/2625e09/Dimmerer-00.svg
    PCB 2: /Users/nose/git/Dimmerer/KiCAD/.kiri/c893547/Dimmerer-00.svg

Output folder: /Users/nose/git/Dimmerer/KiCAD/.kiri

Starting webserver at http://127.0.0.1:8080/web/index.html
(Hit Ctrl+C to exit)

--> It seems that the mentioned .svg files in the output don't even exist. Could this be the problem? Why wouldn't they be created?

Not working again on windows

Hey @leoheck

I had a colleague install kdiff and it wasn't working for him. So I tried wit ha fresh install for myself and it is no longer working for me. Have you changed any of the installation repos by chance? The schematics work just fine but as soon as I look at a PCB it is blank and this is the error I got.

   plotpcb -o "/home/jordan/lcd-conn-expansion/kidiff/src/2d62ea3/" -q "/home/jordan/lcd-conn-expansion/kidiff/src/2d62ea3/expansion.kicad_pcb"
/mnt/c/Users/Stanley/Desktop/ELEC/KiCad-Diff/plotpcb: line 2: $'\r': command not found
/mnt/c/Users/Stanley/Desktop/ELEC/KiCad-Diff/plotpcb: line 5: $'\r': command not found
/mnt/c/Users/Stanley/Desktop/ELEC/KiCad-Diff/plotpcb: line 6: syntax error near unexpected token `$'\r''
'mnt/c/Users/Stanley/Desktop/ELEC/KiCad-Diff/plotpcb: line 6: `readlink_osx()
   plotpcb -o "/home/jordan/lcd-conn-expansion/kidiff/src/d9d214e/" -q "/home/jordan/lcd-conn-expansion/kidiff/src/d9d214e/expansion.kicad_pcb"
/mnt/c/Users/Stanley/Desktop/ELEC/KiCad-Diff/plotpcb: line 2: $'\r': command not found
/mnt/c/Users/Stanley/Desktop/ELEC/KiCad-Diff/plotpcb: line 5: $'\r': command not found
/mnt/c/Users/Stanley/Desktop/ELEC/KiCad-Diff/plotpcb: line 6: syntax error near unexpected token `$'\r''
'mnt/c/Users/Stanley/Desktop/ELEC/KiCad-Diff/plotpcb: line 6: `readlink_osx()

Github Action

Hi,
this project looks very promising. I know it's early stage, but a github action would be great and very beginner friendly.
Unfortunately i don't have the time to work on it.

Docker

Hey @TadeasPilar, I saw you were making good progress to run Kiri with Docker.

I was also doing the same some days ago.

Did you make progress on that?

I manage to make something today, and I put my work here https://github.com/leoheck/kiri-docker
It is a different repo since it does not need anything from the main Kiri repo since everything will be inside the Docker.

I invite you to check if it works for you.

I just tested it on my Ubuntu Linux, so for me, it is working already. I want to test on other systems and improve it a bit when I have more time.

Also, it generates .kiri files in place (inside the repo of the project on the host)

To run it, you just need to do

make build # to build the docker image
./kiri PROJECT_PATH

404 on every schematic / PCB SVG

Sorry to bother you again. I'm getting 404 on every schematic SVG. The webpage loads fine otherwise and I'm able to see all my commits. However, I'm not able to see any schematics or PCB.

image

It looks like kiri is looking for these files in .kiri/_local_/kiri/sch and .kiri/_local_/kiri/pcb. The former does not exist and the latter is an empty folder. However, I do have .kiri/_local_/tmp.iQjngeGOvB that has many .plt files inside.

`plot_kicad_sch` not working because of non englisch language setting

Hello,

If the KiCad language is not English, the keyboard shortcut alt+f will not open the file menu but maybe another menu.
Therefore, ploting the schematic fails without any error message or info.

Maybe you can have a section about the KiCad language requirements in the Readme.md?

Possibility of dragging / moving the graphic files?

I don't know if the diffs are displayed after being generated or if they are calculated on the fly, but it would be a great feature if the different versions can be moved around. This is because sometimes, you don't really any changes on a file, you just dragged everything to a new place, and the whole project is shows as different.

For PCBs, maybe the solution is not as much as plotting the diff, as plotting the appropriate gerbers in XOR mode, so the difference can be displayed on the fly? Same thing for schematics, if they are exported to a graphic format, maybe?

Maybe a lot to ask but something you could consider for the future

Windows (issue/install log)

First problem I ran into was the Ubuntu installer, at time of my attempts it seems to fetch me an 80kb corrupted zip-file that neither be expanded within PowerShell nor opened by WinRAR.
So since the URL points to a Microsoft site anyways I decided to continue with the Ubuntu 20.04 TLS installer from the Windows Store and after that, the installation of dependencies and submodules using the single line commands seemed to work without too much hassle albeit it took several hours to complete on my HP EliteBook 8570w with SSD. While waiting for this I downloaded an installed Xming on the Windows side...

It should be noted that when attempting to start KiRi from the current directory it is important to include ./ before kiri == ./kiri otherwise KiRi can not be started (it is a Linux security issue). I'd suggest this be included in the README.md

After successfully starting KiRi, then Xming gracefully took over and I found that my Windows drives were already mounted at /mnt ... so far so good.
I went to my favorite project folder and loaded the KiCAD project file... and Bump! lots of errors..

A browser tab was opened at 127.0.0.1:8080 with the following text:

Error response
Error code: 404

Message: File not found.

Error code explanation: HTTPStatus.NOT_FOUND - Nothing matches the given URI.

And here's the output of the Ubuntu terminal:

mkdir: cannot create directory β€˜/home/kharar/.local/share/kiri/bin/kiri’: File exists
./kiri: line 1404: kicad_version.py: command not found

      kicad_pro_path = /mnt/c/Users/Martin/Documents/KiCad/2S_serial_charging_board/2S_serial_charging_board.pro
           repo_path = /mnt/c/Users/Martin/Documents/KiCad/2S_serial_charging_board
   kicad_pro_subpath = .
           kicad_pro = 2S_serial_charging_board.pro
           kicad_sch = 2S_serial_charging_board.sch
           kicad_pcb = 2S_serial_charging_board.kicad_pcb
       KICAD_VERSION =
   KICAD_PCB_VERSION = 20171130
  kicad_pro_filename = 2S_serial_charging_board
 kicad_pro_extension = pro
 kicad_sch_extension = sch
 kicad_pcb_extension = kicad_pcb
          output_dir = /home/kharar/.local/share/kiri/bin/kiri

Output folder: /home/kharar/.local/share/kiri/bin/kiri
mkdir: cannot create directory β€˜/home/kharar/.local/share/kiri/bin/kiri’: Not a directory
./kiri: line 1001: kiri-git-log: command not found

Generating artifacts
1 commits, totaling 0 comparisons


Assembling the HTML
cp: cannot stat '/home/kharar/.local/share/kiri/bin/kiri/web//': Not a directory
cp: cannot stat '/home/kharar/.local/share/kiri/bin/kiri/web//': Not a directory
cp: cannot stat '/home/kharar/.local/share/kiri/bin/kiri/web//': Not a directory
cp: cannot stat '/home/kharar/.local/share/kiri/bin/kiri/web//': Not a directory
cp: cannot stat '/home/kharar/.local/share/kiri/bin/kiri/web//': Not a directory
cp: cannot stat '/home/kharar/.local/share/kiri/bin/kiri/web//../index.html': Not a directory
cp: cannot stat '/home/kharar/.local/share/kiri/bin/kiri/': Not a directory
- Adding commits list to the page
sed: can't read /home/kharar/.local/share/kiri/bin/kiri/web//index.html: Not a directory
- Adding schematic pages list to the page
sed: can't read /home/kharar/.local/share/kiri/bin/kiri/web//index.html: Not a directory
sed: can't read /home/kharar/.local/share/kiri/bin/kiri/web//index.html: Not a directory
- Setting sch/pcb titles
sed: can't read /home/kharar/.local/share/kiri/bin/kiri/web//index.html: Not a directory
sed: can't read /home/kharar/.local/share/kiri/bin/kiri/web//index.html: Not a directory
- Setting sch/pcb revision
sed: can't read /home/kharar/.local/share/kiri/bin/kiri/web//index.html: Not a directory
sed: can't read /home/kharar/.local/share/kiri/bin/kiri/web//index.html: Not a directory
- Setting sch/pcb date
sed: can't read /home/kharar/.local/share/kiri/bin/kiri/web//index.html: Not a directory
sed: can't read /home/kharar/.local/share/kiri/bin/kiri/web//index.html: Not a directory
- Setting board name
sed: can't read /home/kharar/.local/share/kiri/bin/kiri/web//kiri.js: Not a directory
- Setting initial commits
sed: can't read /home/kharar/.local/share/kiri/bin/kiri/web//index.html: Not a directory
sed: can't read /home/kharar/.local/share/kiri/bin/kiri/web//index.html: Not a directory
- Setting initial schematics
sed: can't read /home/kharar/.local/share/kiri/bin/kiri/web//index.html: Not a directory
sed: can't read /home/kharar/.local/share/kiri/bin/kiri/web//index.html: Not a directory
- Setting initial layouts
sed: can't read /home/kharar/.local/share/kiri/bin/kiri/web//index.html: Not a directory
sed: can't read /home/kharar/.local/share/kiri/bin/kiri/web//index.html: Not a directory
- Adding layers list to the page
sed: can't read /home/kharar/.local/share/kiri/bin/kiri/web//index.html: Not a directory

Output folder: /mnt/c/Users/Martin/Documents/KiCad/2S_serial_charging_board/kiri
Starting web-server at http://127.0.0.1:8080
Hit Ctrl+C to end session

Now I wonder what went wrong?

Diffs not rendering on mac

Just installed per the readme, didn't run into any problems. Ran kiri on a kicad project
and this is what I ended up with:

image

Kiri didn't complain about any errors, so not sure how to debug.

When I look at the artifacts it produced, the svg's are all just blank (granted we haven't done any layout yet, just schematics):

image

Any advice for how to fix this?

Produced output not easy hostable in e.g. nginx

Hi,

i want to host the produced output (multiple projects) on a normal webserver (nginx in my case). But the offline detection essentially blocks the simple, just copy the folder over and point to the index.html method. I also don't see a benifit in running the python server in the first place as it seems just to serve the plain files as they are in the folder. So why not just point the browser to the file:////.kiri/web/index.html in the first place? Do i miss some functionality the python http server provides?
I just disabled the offline check in the kiri.js and it seems to still work fine either with the nginx solution or pointing my browser directly to the files.

Cheers
Dennis

Apple M1 Support

I'm not positive that this is an ARM64 issue related to the Apple M1, however I'm having some issues installing the dependencies for Kiri on a 14" M1 MBP. Any known workaround for this following console output? Thanks.

Switch invariant: ["ocaml-base-compiler" {= "4.09.1"} | "ocaml-system" {= "4.09.1"}]
[ERROR] Could not determine which packages to install for this switch:
  * Missing dependency:
    - ocaml-base-compiler = 4.09.1 | ocaml-system = 4.09.1
    unmet availability conditions: '!(os = "macos" & arch = "arm64")'
    unmet availability conditions: 'sys-ocaml-version = "4.09.1"'

rename has different syntax on my system

Hi,

the layer renaming does not work on my system (gentoo using normal util-linux version of rename).
Man page state:
rename [options] expression replacement file...

So i need to change the rename call to get it working:

diff --git a/bin/kiri b/bin/kiri
index 2603563..ef4f76d 100755
--- a/bin/kiri
+++ b/bin/kiri
@@ -1519,9 +1519,25 @@ generate_layout_artifacts()
                fi
 
                # Rename files folowing format: layer-xx.svg
-               rename "s/${kicad_project_name_1}-/layer-/" "${OUTPUT_DIR_PATH}/${commit_hash_1}/"*.svg &> /dev/null
-               rename "s/${kicad_project_name_2}-/layer-/" "${OUTPUT_DIR_PATH}/${commit_hash_2}/"*.svg &> /dev/null
-
+               rename ${kicad_project_name_1}- layer-  "${OUTPUT_DIR_PATH}/${commit_hash_1}/"*.svg &> /dev/null
+               rename ${kicad_project_name_2}- layer-  "${OUTPUT_DIR_PATH}/${commit_hash_2}/"*.svg &> /dev/null
+

Cheers
Dennis

Kicad on Windows + Git

Hi,

I permit to create an issue. Because I use Kicad in Windows and managing version with git.
When use kdiff, I have see you change dos2unix, but after git detect that the file have change.
The file is not backup correctly, see the correction below:

# Workaround for windows line endings.

'- if [[ -f "${kicad_pcb}.bkp" ]]; then
'+ if [[ ! -f "${kicad_pcb}.bkp" ]]; then
cp "${kicad_pcb}" "${kicad_pcb}.bkp" 2> /dev/null
fi
dos2unix "${kicad_pcb}"

And I have change cp by mv to restore

# Restore board
if [[ -f "${kicad_pcb}.bkp" ]]; then

'- cp "${kicad_pcb}.bkp" "${kicad_pcb}" &> /dev/null
'+ mv "${kicad_pcb}.bkp" "${kicad_pcb}" &> /dev/null
fi

Have a nice day

Project with mixed Kicad 5 and 6 version

This issue was reported here, #32 (comment)

Hey @designer2k2, thanks for sharing this project https://github.com/designer2k2/BerlinUhr as a use case

I can see this project is not well organized which is pretty complex for Kiri, the way it is designed today.

First of all, you have files of both versions of Kicad 5 and 6 together. This is not good. You should decide which version you want to keep. To have Kiri working fully, it is important to keep the project on Kicad 5 since plotgitsch (the schematic exporter) does not work with the new .kicad_sch files. Now, if you don't care much about being able to review schematics visually, then Kicad 6 is good to go however keeping both versions in the same repo, in the same commit, is pretty bad for Kiri.

Also, to keep both versions of the files you have to work on both versions of the project having both versions of the Kicad to keep compatibility.

===

Now, running your project, I am seeing that there is always a commit that is empty (no image) between 2 commits. I don't know what is happening and why, but it feels like you are removing the board file every odd or even commit. I still have to understand what is going on here.

If you navigate up and down the commit list with one commit between 2 commits selected, then you can see boards changes.
image

Schematics suffer from the same problem.

===

Another problem with Kicad 6, is that it generates not pretty good svgs, at least until the current version 6.0.2
See, this big ball here. It is not there on your design but It is a bad-formed svg file.
I am already applying some fixes on the exported svgs. But this one I was not able to fix yet.
image

Can't install kicad-diff on windows

I am trying to install the external dependencies on a windows machine but when I go through the steps of installing kicad-diff I get the following.

After running the command opam install plotkicadsch

`[ERROR] The compilation of plotkicadsch failed at
"C:\OCaml64\home\Stanley\.opam\4.09.1+mingw64c\bin\dune.exe
build -p plotkicadsch -j 5".

=== ERROR while compiling plotkicadsch.0.8.0 ==
===============================#
context 2.0.8 | win32/x86_64 | ocaml-variants.4.09.1+min
gw64c | pinned(file://C:/Users/Stanley/Desktop/ELEC)
path ~/.opam/4.09.1+mingw64c/.opam-switch/build/plotk
icadsch.0.8.0
command C:\OCaml64\home\Stanley.opam\4.09.1+mingw64c\bi
n\dune.exe build -p plotkicadsch -j 5
exit-code 1
env-file ~/.opam/log/plotkicadsch-21024-42bb52.env
output-file ~/.opam/log/plotkicadsch-21024-42bb52.out
output
File "plotkicadsch/plotkicadsch/src/dune", line 7, characters 6-1
4:
7 | kicadsch
^^^^^^^^
Error: Library "kicadsch" not found.
Hint: try:
dune external-lib-deps --missing -p plotkicadsch -j 5 @install`

And running the command suggested by the hint I get
$ dune external-lib-deps --missing -p plotkicadsch -j 5 @install Error: I don't know about package plotkicadsch (passed through -p)

I am not very sure how to get this running on windows

Kicad v6

Kicad v6 is almost released and plotgitsch does not have a version that works with it. This is going to be a really good addition since Kicad still does not have python support for exporting the schematic to SVG

In this way, I was thinking to implement an alternative way to do this using xdotool on linux (maybe on windows too) and also some alternative for macos. The issue is that xdotool does not work on wayland on linux, then I have to have a different thing for linux too.. so lets see how this can work.

Also, there is still something to be improved in Kicad-Diff since it does not generate the outputs for v6 (and 5.99) as it does for v5. It is generating the image off-center and it also creates a dot on top-left.

build ocaml-base-compiler fails

This is on impish. Anyone have an idea what is going on here? I'm not familiar with ocaml and just following directions from README.md

----8<---------------------------------------

# gcc -c -O2 -fno-strict-aliasing -fwrapv -Wall -Werror -fno-common -fno-tree-vrp -g -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE  -DOCAML_STDLIB_DIR='"/home/christian/.opam/4.09.1/lib/ocaml"'  -DNATIVE_CODE -DTARGET_amd64 -DMODEL_default -DSYS_linux   -o misc_n.o misc.c
# signals_nat.c:185:13: error: variably modified β€˜sig_alt_stack’ at file scope
#   185 | static char sig_alt_stack[SIGSTKSZ];
#       |             ^~~~~~~~~~~~~
# make[3]: *** [Makefile:343: signals_nat_n.o] Error 1
# make[3]: *** Waiting for unfinished jobs....
# make[3]: Leaving directory '/home/christian/.opam/4.09.1/.opam-switch/build/ocaml-base-compiler.4.09.1/runtime'
# make[2]: *** [Makefile:1002: makeruntimeopt] Error 2
# make[2]: Leaving directory '/home/christian/.opam/4.09.1/.opam-switch/build/ocaml-base-compiler.4.09.1'
# make[1]: *** [Makefile:415: opt.opt] Error 2
# make[1]: Leaving directory '/home/christian/.opam/4.09.1/.opam-switch/build/ocaml-base-compiler.4.09.1'
# make: *** [Makefile:466: world.opt] Error 2



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
β”Œβ”€ The following actions failed
β”‚ Ξ» build ocaml-base-compiler 4.09.1
└─ 
β”Œβ”€ The following changes have been performed (the rest was aborted)
β”‚ βˆ— install base-bigarray base
β”‚ βˆ— install base-threads  base
β”‚ βˆ— install base-unix     base
└─ 

<><> ocaml-base-compiler.4.09.1 troubleshooting <><><><><><><><><><><><><><><><>
=> A failure in the middle of the build may be caused by build parallelism
      (enabled by default).

Add support for Linuxmint

Support for Linuxmint can be added by wildcarding the debian comparison with ${distro_id_like} like so:

if [[ "${distro_id}" == "debian" ]] || [[ "${distro_id_like}" == *"debian"* ]]; then

as Linuxmint identifies as "ubuntu debian".

if [[ "${distro_id}" == "debian" ]] || [[ "${distro_id_like}" == "debian" ]]; then

PCB Diffs are not shown in larger GIT repos

Bug Symptoms / Observed Behaviour

kiri runs normal, but in the webpage, when I go to the PCB diffs, nothing is shown.

Detailed Description

The problem occurs, if the repository reaches a certain size, because then, the default 7 digi short hash is no longer unique.
GIT automatically detects this and increases the short hash length to, e.g. 8 digis.

kiri works fine with larger hashes, but kidiff/kidiff.py is using only 7 digis (line 124), so renaming and moving the generated SVGs fails without any error message (kiri line 1525 ...).

Possible Solution / Workaround

It works fine, if I remove the [:7] in kidiff/kidiff.py line 124 and 127 and in kidiff/scms/git.py line 17 and 22.
I am not sure why they where introduced.

@Gasman2014 Hello, do you remember why the commit hash was cut to 7 digits?

System Info

  • KDE Neo (Ubuntu 22.04 base)
  • git version = 2.34.1
  • repo info
Processing blobs: 7829                        
Processing trees: 9061                        
Processing commits: 1378                        
Matching commits to trees: 1378                        
Processing annotated tags: 2                        
Processing references: 20                        
| Name                         | Value     | Level of concern               |
| ---------------------------- | --------- | ------------------------------ |
| Overall repository size      |           |                                |
| * Commits                    |           |                                |
|   * Count                    |  1.38 k   |                                |
|   * Total size               |   373 KiB |                                |
| * Trees                      |           |                                |
|   * Count                    |  9.06 k   |                                |
|   * Total size               |  2.57 MiB |                                |
|   * Total tree entries       |  65.7 k   |                                |
| * Blobs                      |           |                                |
|   * Count                    |  7.83 k   |                                |
|   * Total size               |  1.52 GiB |                                |
| * Annotated tags             |           |                                |
|   * Count                    |     2     |                                |
| * References                 |           |                                |
|   * Count                    |    20     |                                |
|     * Branches               |     2     |                                |
|     * Tags                   |     2     |                                |
|     * Remote-tracking refs   |    15     |                                |
|     * Git stash              |     1     |                                |
|                              |           |                                |
| Biggest objects              |           |                                |
| * Commits                    |           |                                |
|   * Maximum size         [1] |  1.50 KiB |                                |
|   * Maximum parents      [2] |     2     |                                |
| * Trees                      |           |                                |
|   * Maximum entries      [3] |   209     |                                |
| * Blobs                      |           |                                |
|   * Maximum size         [4] |   145 MiB | ***************                |
|                              |           |                                |
| History structure            |           |                                |
| * Maximum history depth      |  1.02 k   |                                |
| * Maximum tag depth      [5] |     1     |                                |
|                              |           |                                |
| Biggest checkouts            |           |                                |
| * Number of directories  [6] |   711     |                                |
| * Maximum path depth     [7] |    11     | *                              |
| * Maximum path length    [7] |   154 B   | *                              |
| * Number of files        [6] |  3.64 k   |                                |
| * Total size of files    [8] |   652 MiB |                                |
| * Number of symlinks         |     0     |                                |
| * Number of submodules       |     0     |                                |

Branching doesn't track PCB Changes

It seems if I make a branch and make changes it only track changes on the schematic. The PCB doesn't produce an SVG it seems, and there is no output on the actual PCB view.
image

This is the output spit from the verbose

    script_dir: /home/jordan/kicad/kdiff

     repo_root: /home/jordan/kicad/high-level-feedback-board
   project_dir: src

     kicad_pcb: src/HLFB_Breakout.kicad_pcb
     sch_files: src/HLFB.sch src/HLFB_Breakout.sch src/IO_Ports.sch
    board_name: HLFB_Breakout

    output_dir: /home/jordan/kicad/high-level-feedback-board/kidiff/src
       web_dir: /home/jordan/kicad/high-level-feedback-board/kidiff/src/web/

git-kdiff-log Jordan_Revision -- src/HLFB_Breakout.kicad_pcb src/HLFB.sch src/HLFB_Breakout.sch src/IO_Ports.sch

Commits list:
3c7c699 | 2021-05-18 13:04:37 -0700 | Jordan Lee | Moved 5V trace down
03a3ddb | 2021-05-18 11:35:56 -0700 | Jordan Lee | Added source files as well as changed README to reflect PCB

Generating artifacts for 2 commits.
Totaling 2 possible comparisons.

Schematic Pages
     1  HLFB_Breakout

Layers
     1  F_Cu
     2  B_Cu
     3  B_Adhes
     4  F_Adhes
     5  B_Paste
     6  F_Paste
     7  B_SilkS
     8  F_SilkS
     9  B_Mask
    10  F_Mask
    11  Dwgs_User
    12  Cmts_User
    13  Eco1_User
    14  Eco2_User
    15  Edge_Cuts
    16  Margin
    17  B_CrtYd
    18  F_CrtYd
    19  B_Fab
    20  F_Fab

Starting webserver at http://127.0.0.1:9092

Any idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.