inti-cmnb / kidiff Goto Github PK
View Code? Open in Web Editor NEWTool to generate a PDF file showing the changes between two KiCad PCB/SCH files. Also a git plug-in.
License: GNU General Public License v2.0
Tool to generate a PDF file showing the changes between two KiCad PCB/SCH files. Also a git plug-in.
License: GNU General Public License v2.0
I get the following output when running kicad-diff.py Old.kicad_pcb New.kicad_pcb --exclude Exclude.txt --cache_dir Cache --keep_pngs -vv
DEBUG:kicad-diff.py:Using cached User.5 layer
DEBUG:kicad-diff.py:Using cached User.6 layer
DEBUG:kicad-diff.py:Using cached User.7 layer
DEBUG:kicad-diff.py:Using cached User.8 layer
DEBUG:kicad-diff.py:Using cached User.9 layer
DEBUG:kicad-diff.py:Executing: bash -c 'convert -density 300 "Cache/6521f80d85529af422c7c0262e6843a2c431338a/0.pdf" -background white -alpha remove -alpha off -threshold 50% -colorspace Gray -resample 150 -depth 8 "Cache/6521f80d85529af422c7c0262e6843a2c431338a/0.png"'
DEBUG:kicad-diff.py:Running ['bash', '-c', 'convert -density 300 "Cache/6521f80d85529af422c7c0262e6843a2c431338a/0.pdf" -background white -alpha remove -alpha off -threshold 50% -colorspace Gray -resample 150 -depth 8 "Cache/6521f80d85529af422c7c0262e6843a2c431338a/0.png"'] returned 1
DEBUG:kicad-diff.py:- StdOut from command: convert-im6.q16: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/421.
convert-im6.q16: no images defined `Cache/6521f80d85529af422c7c0262e6843a2c431338a/0.png' @ error/convert.c/ConvertImageCommand/3229.
Traceback (most recent call last):
File "/usr/bin/kicad-diff.py", line 795, in <module>
output_pdf = DiffImages(old_file_hash, new_file_hash, layers_old, layers_new, args.only_different, changed)
File "/usr/bin/kicad-diff.py", line 439, in DiffImages
old = pdf2png(old_file, i not in layers_old, new_file)
File "/usr/bin/kicad-diff.py", line 329, in pdf2png
assert False
AssertionError
The Cache
directory only contains PDF
files and no PNG
files
Using the kicad 7 full docker image, generating a pcb diff, I am left with all PNG files in the output dir, even when cache_dir is set to blank, set to /tmp
or even removed entirely. While the png files are great for debugging, once the pdf is generated as final output, they become useless.
outputs:
- name: 'diffsch'
comment: 'Generates a PDF with the differences between schematic.'
type: 'diff'
dir: 'output/diff'
options: &diff_options
add_link_id: false
always_fail_if_missing: true
cache_dir: '/tmp/pdfdiff'
copy_instead_of_link: false
diff_mode: 'red_green'
force_checkout: false
fuzz: 5
new: ''
# [string='current'] [git,file,output,multivar,current] How to interpret the `new` name. Use `git` for a git hash, branch, etc.
new_type: 'current'
old: 'HEAD'
old_type: 'git'
only_different: true
only_first_sch_page: false
threshold: 0
use_file_id: false
pcb: false
layers: 'all'
- name: 'diffpcb'
comment: 'Generates a PDF with the differences between PCBs.'
type: 'diff'
dir: 'output/diff'
options:
<<: *diff_options
pcb: true
layers: 'all'
Hi @set-soft,
mentioned this in the kiri-integration issue of kibot here are my thoughts:
The way kiri works is comprehensive and simple, sadly the handling of the produced svgs leaves not much room for expansion.
The current problem for me is that changes made to the pcb are not really easy to spot or to understand, as the zones invert the actual colors of the new/old changes:
In my opinion, the presentation of the new changes is a bit confusing as zones can overlap tracks and vice versa.
Wouldn't it be cool if the zones could be hided? Dimming would also be an option but maybe impossible to implement with svgs.
Thanks in advance!
P.S.: As an example, the cadlab.io guys seem to have managed this somehow, although it seems not to be a comparison between svg files, but more a wrapper for whole projects while on a net and change basis the changes seem to be displayed Link
While we can run kidiff using the kibot container, having a dedicate kidiff container, which would be much smaller (hopefully) would be a nice feature.
Originally posted by @mdeweerd in INTI-CMNB/KiBot#392 (comment)
I think the test case I join here is a different demonstration of the shift issue mentionned int he post above where I observed a shift on the X-Axis when diffing.
.
In this test case, I changed the board in the latest version while maintaining a small board in the previous version.
The difference is shown like this:
I only changed the board size, not the tracks.
I guess that the original issue is related: the cropping/scaling is different between the two versions (for a reason that I did not identify, but the board is the same) and this results in a shift.
You exectute the testcase like this:
git clone --branch DIFF_PCB_CHANGE [email protected]:mdeweerd/kbot-testcases.git
cd kbot-testcases
docker compose run --rm diff_k7
# or (also launches docker):
make diff_k7
The difference output can be found in "tc7_01_20211224_header/Diffs" .
What do you want to achieve?
i have some project that contain schematics which are A3 or A2 sizes, with multiple variants. I want to diff them between variants and various commits.
this works whit projects that contain A4 sized schematics, but not with A2 and A3 sized ones.
Do you have some PCB/Schematic to use as example?
yes, see attached
Do you have some configuration file (.kibot.yaml) that you are using?
You can attach it or paste the content in the following section:
kibot:
version: 1
outputs:
# Documentation -------------------------------------------------------------
- name: 'schematic'
comment: "Export schematic as pdf"
type: pdf_sch_print
dir: documentation
# ---------------------------------------------------------------------------
- name: "sch_variant"
type: sch_variant
comment: "Generate sch variant for other outputs to use"
dir: /tmp
- name: "schdiff local<>master"
type: diff
dir: documentation/diffs
options:
output: '%f-%v-schdiff-pr.%x'
new: "sch_variant"
new_type: output
old: master
old_type: git
pcb: false
force_checkout: true
only_first_sch_page: false
priority: 10
#TODO
- name: "schdiff local<>last"
type: diff
comment: "Generate diff"
dir: documentation/diffs
options:
output: '%f-%v-schdiff-commit.%x'
new: "sch_variant"
new_type: output
old: "HEAD~"
old_type: git
pcb: false
force_checkout: true
only_first_sch_page: false
priority: 10
Environment (please complete the following information):
Where are you running KiBot:
kicad6_auto:latest
with git-lfs added.debug output (ran kibot with -vvv)`
DEBUG:Executing: /usr/bin/kicad-diff.py -vvv --no_reader --new_file_hash sch511fa71940ad1dc0c48b519b4f23dad68ea83dbb --old_file_hash sch146e35e6fa09bf0d7d78442f1a035c690786e586 --cache_dir /tmp/tmpjz2s6ro6 --output_dir /tmp/kibot_build/main/FULL/build/documentation/diffs --output_name main-FULL-schdiff-local.pdf --diff_mode red_green --fuzz 5 --no_exist_check --all_pages /tmp/tmpdf82snpw.kicad_sch /tmp/main.kicad_sch (kibot - kiplot.py:159)ERROR:Running ['/usr/bin/kicad-diff.py', '-vvv', '--no_reader', '--new_file_hash', 'sch511fa71940ad1dc0c48b519b4f23dad68ea83dbb', '--old_file_hash', 'sch146e35e6fa09bf0d7d78442f1a035c690786e586', '--cache_dir', '/tmp/tmpjz2s6ro6', '--output_dir', '/tmp/kibot_build/main/FULL/build/documentation/diffs', '--output_name', 'main-FULL-schdiff-local.pdf', '--diff_mode', 'red_green', '--fuzz', '5', '--no_exist_check', '--all_pages', '/tmp/tmpdf82snpw.kicad_sch', '/tmp/main.kicad_sch'] returned 6 (kibot - out_diff.py:460)
DEBUG:- Output from command: DEBUG:kicad-diff.py:/tmp/tmpdf82snpw.kicad_sch SHA1 is sch146e35e6fa09bf0d7d78442f1a035c690786e586 DEBUG:kicad-diff.py:/tmp/main.kicad_sch SHA1 is sch511fa71940ad1dc0c48b519b4f23dad68ea83dbb DEBUG:kicad-diff.py:Cache dir: /tmp/tmpjz2s6ro6 DEBUG:kicad-diff.py:Output dir: /tmp/kibot_build/main/FULL/build/documentation/diffs DEBUG:kicad-diff.py:Cache for /tmp/tmpdf82snpw.kicad_sch will be /tmp/tmpjz2s6ro6/sch146e35e6fa09bf0d7d78442f1a035c690786e586 INFO:kicad-diff.py:cache dir for `/tmp/tmpdf82snpw.kicad_sch` already exists DEBUG:kicad-diff.py:Using cached schematic DEBUG:kicad-diff.py:Cache for /tmp/main.kicad_sch will be /tmp/tmpjz2s6ro6/sch511fa71940ad1dc0c48b519b4f23dad68ea83dbb INFO:kicad-diff.py:cache dir for `/tmp/main.kicad_sch` already exists DEBUG:kicad-diff.py:Using cached schematic DEBUG:kicad-diff.py:/tmp/tmpjz2s6ro6/sch146e35e6fa09bf0d7d78442f1a035c690786e586/Schematic_root.pdf already converted to PNG DEBUG:kicad-diff.py:/tmp/tmpjz2s6ro6/sch511fa71940ad1dc0c48b519b4f23dad68ea83dbb/Schematic_root.pdf already converted to PNG INFO:kicad-diff.py:Creating diff for Schematic_root DEBUG:kicad-diff.py:Executing: ['bash', '-c', '( convert "/tmp/tmpjz2s6ro6/sch511fa71940ad1dc0c48b519b4f23dad68ea83dbb/Schematic_root.png" miff:- ; convert "/tmp/tmpjz2s6ro6/sch146e35e6fa09bf0d7d78442f1a035c690786e586/Schematic_root.png" miff:- ) | convert - \\( -clone 0-1 -compose darken -composite \\) -font helvetica -pointsize 30 -draw "text 10,30 \'/\'" -channel RGB -combine "/tmp/kibot_build/main/FULL/build/documentation/diffs/diff-Schematic_root0.png"'] DEBUG:kicad-diff.py:Running ['bash', '-c', '( convert "/tmp/tmpjz2s6ro6/sch511fa71940ad1dc0c48b519b4f23dad68ea83dbb/Schematic_root.png" miff:- ; convert "/tmp/tmpjz2s6ro6/sch146e35e6fa09bf0d7d78442f1a035c690786e586/Schematic_root.png" miff:- ) | convert - \\( -clone 0-1 -compose darken -composite \\) -font helvetica -pointsize 30 -draw "text 10,30 \'/\'" -channel RGB -combine "/tmp/kibot_build/main/FULL/build/documentation/diffs/diff-Schematic_root0.png"'] returned 1 DEBUG:kicad-diff.py:- StdOut from command: convert-im6.q16: images are not the same size `/tmp/magick-zYpjF9Fi_NNdTMeLo77p_YK7tXBskfjw' @ error/channel.c/CombineImages/128. ERROR:kicad-diff.py:Failed to create diff /tmp/kibot_build/main/FULL/build/documentation/diffs/diff-Schematic_root0.png (kibot - out_diff.py:462)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.