Introduction: Visualizing EAGLE Edits With a Gerber Viewer
The EAGLE Schematic/PCB editor keeps up to 10 backups of your board and schematics, reflecting the board start at the last times you saved you work. This can be very valuable if you screw something up, but I've always been a bit frustrated that it isn't easier to look at those files to see what changed in which revision. (EAGLE won't directly open the backup files, so you have to rename each backup before you can look at it. And EAGLE won't open multiple files at one time, so that you can compare them side-by-side, either.)
Now, one way to look at a PCB is to generate gerbers (the standard "plotter format" for PCBs), and use one of the gerber viewers to look at those. This has the advantage of simplifying the "picture", AND most gerber viewers will load up multiple layers of a PCB so that you can see them all together. I realized that it would also let you display multiple copies of the same layer, so that you could "flip" through them and (hopefully) notice changes. In fact, the gerber viewer I use (gerbv, an open-source utility that runs on Windows, Macs, and Linuxes), has a display mode where the layer are displayed with their colors XORed together. (In theory, this is an option to allow you to look at multiple layers at once, although in reality how well it works depends on the actual bit patterns of the colors used for each layer.)
However, if you DO pick your layer colors carefully, you can display two (or more) layers that are almost the same, and have the differences HIGHLIGHTED for you! This seemed close to ideal for visualizing the changes in a PCB design. Well, for small changes, anyway. We'll have to see how the community feels about its usefulness.
All it needed was some sort of script that would go through all the backup files, generate appropriate gerber files, and then load up the gerber viewer having given each file an appropriate set of color, color mixing mode, and other display parameters. It seems to be somewhat useful. Here are some examples of how it works.
Step 1: The Original PCB and Its Changes
Here's screenshot collecting the actual EAGLE PCB view of the board I was experimenting with. This is the SparkFun Arduno PRO board. Nice and simple, with some room to do stuff.
As examples of the sort of think I might do in the course of final editing of a PCB, I increased the width of some tracks, and then switched one of the tiny SMT LEDs that I don't have for a larger SMT LED that I do have. This over a period of several edit sessions, so several backup files are created. In the next step we'll see what is done to them, and what the results look like.
Step 2: Running the Script
My first effort being described here is a "bash" shell script, so it runs from a unix shell window. Such unix shell windows are available on Mac (via the Terminal or X-windows), and PCs using the cygwin or mingw environments, and of course on linux systems. This particular bash script has only been tested on my Mac, where it seems to work fine. It may (will!) need slight adjustments for other systems. At least, it needs the actual install location of the eagle executable that is run from CLI mode.
A future version of this utility might run within an EAGLE ULP. It looks like it would have somwhat similar capabilities, and have a bit of internal knowledge about the EAGLE environment that could make the ULP be more OS-independent, which would be a good thing. Meanwhile, early adopters might want to play with the bash script to see if it looks useful in concept.
The script does the following:
Inputs: board or schematic file name, followed by a list of layers:
eagle_backview ~/Documents/EagleProjects/Arduino-Pro-v12.brd top pads vias
From this, the script figures out the directory where the backups would live, and that this is a .BRD file. And it creates a tmp directory.
For each backup file found, a renamed copy of that is moved into the tmp directory and has the specified layers converted to a gerber file of appropriate name (using EAGLE itself) The script keeps track of the oldest backup seen as well. And of course we make a similar gerber of the newest version of the file (the one currently called .BRD)
Next we build up a gerbv project file that references all of the gerbers we've produced, putting each one on a different layer, with a specially chosen color. The current .BRD layer is 192R+15G. The oldest backup is 192R+32G. Any intermediate version is 192R+16G.
The color mixing mode is set to XOR, and the oldest and newest layers are set to be visible at the same time.
Next, we see what this looks like!
Step 3: Looking at the Initial Results
So we have the oldest and newest gerbers displayed at the same time. XOR'ed together. Since both layers have R=192, everywhere the boards are the same the RED will cancel each other out. Since one board has green=15 and one has green=32, you'll see a deep green shadow of the layer wherever the boards are the same. Now, where the boards are DIFFERENT, the red won't cancel out at all (and some green may or may not), so you see red highlights in the areas that have changed, as shown here.
Note that if you've made major changes like shifting the PCB in its frame, it's going to look like crap. There's no magic to make the two gerbers overlap the way they need to be be most useful; the PCBs have to have essentially the same offsets from the origin. (changed titles can mess this up too.)
Of course, the other backups are there too...
Step 4: Traveling Backward From Latest
We can step back in time from the latest version, one edit at a time, till we get to the oldest, for a better idea of what happened.
It's just a matter of checking and unchecking the checkboxes that make layers visible.
Note that displaying more than two layers at a time will give odd results that are probably not useful. All the red is present for any odd number of layers, for example.
Step 5: Traveling Forward From Oldest
You can do it the other way around too, watching the changes get gradually added to the oldest version.
Step 6: Viewing Consecutive Changes
You you can examine the changes between adjacent versions, to look at each edit on its own.
Note that since the intermediate levels have the same "Green" value, the "same" parts will not be shown at all when XORing adjacent intermediate versions. Changed areas are still bright red. I think this is the least useful comparison mode, so I didn't spend a lot of time searching for a solution that would improve this.
Step 7: That's About It...
Here's the bash script. I hope to improve this some based on feedback. So .... provide feedback please!
We have a be nice policy.
Please be positive and constructive.