xbox-board-re
xbox-board-re copied to clipboard
Implementation of compare script
This is a concept for a compare script. This script parses 2 simplified SVGs and converts the traces into polygons, to then do some boolean operations and a visual comparison between the 2 sets of polygons.
This tool exports SVGs, but those aren't meant to be simplified or re-used. They are purely visual indicators. The paths will have been turned into polygons, and getting the input path back is very difficult / impossible. So this is purely for the logic to find duplicated paths or to generate a preview image of a proposed change (and highlighting errors).
With a bit more work, this tool could be used to generate the final netlist, because it will tell us which of the paths / traces actually touch.
It requires:
- https://pypi.org/project/svg.path/
- https://shapely.readthedocs.io/
You should be able to install these using pip install svg.path shapely
.
You can do the following with this script:
- Compare a simplified SVG to itself; this should reveal any traces which touch each other, or traces which are duplicated. This way, even if we don't have IDs, we could still figure out which path is duplicated. This could be used to clean up the file before committing (by removing or warning about duplicates).
- Compare different SVGs to find additions or removals. This could be used to generate an image that can be shown during review.
Some more notes and limitations:
- Poor code quality; KISS to avoid bikeshedding on a tool which should reduce the amount of work, not to create much new work.
- The script shows how to do something like what's required for #10.
- The script is severly limited by #9.
- The script is severly limited by #11 and there's poor bezier curve support.
- Arcs in path are not supported at all (yet?).
- Zones are not supported yet.
- Only uses "Top Traces" layer (hardcoded).
- The script is kind-of slow.
- The "tmp/" output folder must be created or the tool will fail.
I currently have no plans to continue on this. Hence I'll just draft it. Take whatever you need - consider this CC0 / Public Domain / Unlicensed / ...; Before we continue with this tool it's more important to standardize the exchange format (some of which is already automated in #7 and even the basic script in #2) and to fix issues like #9 and #10, so we can continue work (without risking a lot of manual labour to combine our files).
Example output: