Introduction: Automating Eagle Export and Preparing It for Printing.

This is my first instructable and English isn't my primary language so I hope it will be not so bad. There are many instructables for creating boards in Eagle and etching them trough many methods. But this instructable should be just for much faster and automated preparing images of board for printing. I was doing this on GNU/Linux Debian (so don't get confused from different GUI), but should be almost the same for Windows (just you need to edit the pathnames etc...). If it will be hard for somebody doing it on Windows platform I could make another one for Windows.

You need:
Eagle http://www.cadsoft.de/
GIMP (www.gimp.org)
Printer :)

It could be done in some other image editing software, for example in Photoshop. But Photoshop isn't for free and making there automated scripts is too easy and you don't need inscrutables to record action script there.

Step 1: Eagle

When you have your PCB board ready then open your favourite text editor and write there:


DISPLAY ALL
RATSNEST
DISPLAY None
DISPLAY Bottom Pads Vias
EXPORT IMAGE /mnt/slug_common/progs/!8051/!plosaky/!eagle_export.png MONOCHROME 600;
DISPLAY Top Unrouted Dimension tPlace bPlace



You can change the path there (I used this one because I have NSLU2 network drive and exporting directly there makes it accessible from every computer/PDA in my home (and garden as well :) ) ). It's awesome device :)

I saved it in my project folder under name "obraz.scr", you can save it where it is best for you and name it like you want, just keep the ".scr".

Then in Eagle click File -> Script.. Find the location of this script and open it. It will execute the script, it will hide some layers, export it as monochrome PNG image with 600 DPI (you can modify this if you want). You can see the resulting image here. And after exporting showes the layers back. It's great to have it automated because when I'm doing it over and over again, it eats plenty of time and usually I forget to hide some layer and I need it to do it once again. After time it's get very frustrating.

I think when you save this script in Eagles installation directory between others scripts you can execute the script just typing into command line "script obraz;"

Now you can click Options -> Assign and assign the command "script obraz;" with some short-cut, for example Shift+F1. And from this point exporting in Eagle will be super quick.

Step 2: GIMP

Why editing the exported image?

1) My laser printer (and many others) don't do great black colour, when you print it on transparent film and looking trough it, you see that the light can get trough and can make serious troubles in UV process. So I'm doing the same like many others, printing 2 copies (mirrored) and punting them together to make the black colour darker.

When you are printing 2 copies you get next problem, some printers get troubles when there are huge places of black or when there are high contrast lines and are making ghosts. So when you print 2 copies you can see some horizontal / vertical ghost lines on them. So I like to put them not beside, but into opposite corners to avoid all horizontal and vertical ghosts.

2) When you are doing the positive UV process (black should be there where you want keep the cooper) then you need to invert the image because the exported image is usable just for negative UV process. So when you are doing the negative process then you don't need to invert it. And to be honest with you I'm considering to switch to negative one.

What you need in this steep:
Installed and ready to use GIMP www.gimp.org

Open text editor and write there:

(define (script-fu-pcb-filter img)
(gimp-undo-push-group-start img)
(gimp-image-convert-grayscale img)
(gimp-invert 2)
(gimp-image-flip img 1)
(gimp-image-resize img (* (cadr (cddr (gimp-selection-bounds 1))) 2) (* (caddr (cddr (gimp-selection-bounds 1))) 2) 0 0)
(gimp-layer-copy 2 1)
(gimp-image-add-layer img 3 0)
(gimp-layer-new img (cadr (cddr (gimp-selection-bounds 1))) (caddr (cddr (gimp-selection-bounds 1))) 2 "druhy" 100 0)
(gimp-image-add-layer img 4 0)
(gimp-edit-fill 4 2)
(gimp-image-lower-layer-to-bottom img 4)
(gimp-image-merge-down img 2 0)
(gimp-selection-all img)
(gimp-flip 5 0)
(gimp-floating-sel-anchor 6)
(gimp-selection-all img)
(gimp-flip 5 1)
(gimp-floating-sel-anchor 7)
(gimp-flip 3 1)
(gimp-image-merge-down img 3 0)
(gimp-convert-indexed img 0 3 0 FALSE FALSE "a")
(gimp-undo-push-group-end img)
(file-png-save 1 img 8 "/mnt/slug_common/progs/!8051/!plosaky/!eagle_export.png" "/mnt/slug_common/progs/!8051/!plosaky/!eagle_export.png" FALSE 9 FALSE FALSE FALSE TRUE FALSE)

)
(script-fu-register "script-fu-pcb-filter"
"PCB-Filter"
"Gets ready export image from egale ready for print"
"Anton Krug <anton.krug@gmail.com>"
"Anton Krug"
"2009-04-25"
"RGB*, GRAY*, INDEXED*"
SF-IMAGE "Input Image" 0)

(script-fu-menu-register "script-fu-pcb-filter" "<Image>/Image/Eagle/")

You can delete "(gimp-invert 2)" line you don't want to invert the image. And you can modify/delete the line "(file-png-save 1 img 8 "/mnt/slug_common/progs/!8051/!plosaky/!eagle_export.png" "/mnt/slug_common/progs/!8051/!plosaky/!eagle_export.png" FALSE 9 FALSE FALSE FALSE TRUE FALSE)" when you want to save the final image somewhere else, or if you don't want to save it at all.

Then you saves this script in the "Script-Fu" directory of GIMP, on my system it was "/home/fredy/.gimp-2.4/scripts/pcb.scm". On windows try it in installation directory. The you just clicks Xtns -> Script-Fu -> Refresh Scripts, it should load your script too. Then it should be available in Image -> Eagle -> PCB-Filter. Clicking it does the all magic. Sound stupid, but repeating this steep (manualy editing pcb image) too many times it makes you plenty of pain.

I hope this two scripts will save you at least little bit of time and make you developing something much faster.