lørdag 9. januar 2016

QR Codes in Dynamo: Revisited

Last time I was looking into QR codes I was in the very beginning of my Dynamo addiction and I was blown away. In that post I stated that I wanted to look for other implementations that were open source, but I didn't quite come around to it. Not until about a week ago when I figured I would give it another go. I tried python versions, i tried web calls via API's but didn't go that much better this time either, so naturally  I gave in and went over to the forum to post a question.

I had a certain tingly feeling about who would answer.. Of course, Dimitar Venkov! Seriously, if I could get that guy the Dynamo Medal of Honor.. He had found an open source C# .NET QR generator called QRCoder here. After a little off forum chat and a little compiling later we had a .dll file on our hands. It didn't work with Zero Touch import in Dynamo, but it was callable from Ironpython from within the python module in Dynamo, if you put the .dll in the Dynamo-folder under Program Files,  like this:

Now at this point it is almost a package. I added some list capabilities, added the .dyf and .dll  and created the package. But because Dynamo's packages are stored in the appdata folder it should not be possible to call the .dll like above since each appdata path are unique for every user. But evidently this has kindly been taken care of by the Dynamo team, so no problem. Thanks to you guys as well!

So there you have it: Open source at it's best! QRCoder now in Dynamo.

PS: Just in time finishing this little post I've also included the color capabilities from the QRCoder project meaning your QRs from Dynamo now can look like this:

just if you really, really want..

PSS: The QRCoder is licensed under the MIT license.
PSSS: Notify me if you got ideas for potential uses of QR codes as a datacarrier in the AEC industry! :)

Edit: I've updated the package to also include a way to adjust the error correction level of the QR. Look here.
 Credit to Dimitar once again for providing a perfect IronPython script to adjust and adapt for a drop down menu!