Hi all,
As i was preparing some boards for manufacturing (perhaps a 7400 entry) I thought it would be fun to partake in Itead's OpenPCB program. But that requires me to have some identifying mark on my board and I thought a QR code would be perfect.
The bmp import in eagle as some room for improvement so I skipped that and wrote my own.
As I was writing I found out that the latest eagle (5.11.0) can do http get/post statements in ulp.
So here it is, dynamic pcb qr code generation with the help of Web 2.0...
Hope somebody will find it useful. No rights reserved. It's just a little midnight hack, so expect bugs.
unzip and rename to .ulp
[EDIT]Look futher down this thread[/EDIT]
Very cool, I'll post this up.
I fixed a couple of errors :)
Fixed:
- other sizes then 1
- a typo (unterminated string) on line5
- disabled selecting the qr code (only works when layer is specified)
things to consider:
- eagle ulp does have xml parser capabilities
- you can run the script on exit (i.e. exit (grid mm;); )
BTW nice hack :)
Great, I didn't know about the xml parser functions. I'll definitely look into those. It'll make it more robust, hopefully.
Update to come, now I'm off for dinner.
It prolly does :) THere is no garantee the formatting stays exactly the same.
I've updated to the built-in XML decoding as suggested by Sjaak.
Another change is that it draws the QR at the mark instead of origo.
Warning!
On my way to work this morning I realize this is probably wrong.
If you use this on a "dark" board and white stencil the colors will be inverted.
I'll have to investigate if it will still work with inverted colors, or if anybody knows please tell.
Not sure what the deal is, but I'm trying to use honken's newest release and I'm not getting anything at all! I go through the dialog, select top/bottom silk, and hit generate, a progress bar runs up, then... nothing. No new objects, no visible anything, not sure what the deal is.
Also, it's unclear to me: What does 'current layer' mean? In order for there to be a 'current layer', I have to be in some tool, but the ULP doesn't run in the context of a tool.
EDIT: Hmmmm, it dumps a .scr into my project directory that makes the code. Makes more sense now, but still unintuitive.
EDIT 2: Here's a much bigger problem: Looks like characters don't get escaped correctly - my end URL reads as http%3A%2F%2F......
EDIT 3: Got a chance to look at the code, it turns out that the urlencode() is an unnecessary step. Not sure where it comes into play in the api calls, but I just made the change in the first line of the main make_gr_scr function:
//string url_enc = urlencode( url );
string url_enc = url;
tl;dr: made a quick modification, version attached below works for me with URLs.
hey,
i got following problem:
../qr-code.ulp(49): XML-Error (1, 1): unexpectedd end of file
using eagle 6.1.0 pro. any solution?
thx a lot !
The old url redirects to http://http://www.esponce.com and they also have a new API version.
The new url in line 46 should be
http://www.esponce.com/api/v3/generate?content=
.
OK,
I edited the file and reuploded.
[attachment=0]
I'll try to edit my previous posts.
It use the new API at esponce.com.
I have also changed from xml format to text, and then I can actually draw the QR non inverted with the most common case of white silkscreen on a "dark" board.
The urlencode part is very crude and "overdoes" things, ie encodes characters not necessary to encode, but without it it will break if you try to put an ampersand (&) or a space into the info you want in the QR-code.
Hi, looks like the script is not working anymore (permission denied).
Can this be fixed again? Great script...
I think the website used for generating the qrcode is a paid service now.