QR code font


#1

Has any one run across a QR code font they like and is cheap or free? There are plenty of code generators on line and right now it looks like If I want to a have a QR code in the drawing I need to import the QR code image and apply curves to the image and then apply a hatch, and then get rid of the image. I don’t mind a little work for one code but there could be hundreds that would be on my documents and there has got to be an easier way using text


#2

How often does the QR Code change? I ran across this http://blog.qr4.nl/post/QR-Code-Fonts.aspx to make a font out of QR Codes (so each letter is one QR Code).

Or use an online generator to generate an SVG / PDF, then import that into Rhino. That should be easier than tracing a bitmap.


#3

Thanks for the response,

The code could potentially change often and be in hundreds of documents

I came across a font that does basically the same thing. Typing 123456 comes out as which is really 1 2 3 4 5 6 but should look this Which is 123,456.

What I’m looking for may not exist.

One of our manufacturing processes is converting foam sheets into wind turbine components. The check / run sheets for production comes from the cad. These show the part nesting and part numbers and other relevant information. And some day hopefully a QR code to identify that document so a machine can read it… And since this all exists in cad, eventually that same sheet (or the information on that sheet) will be printed on to the material to be processed before that material is sent to the routers to be cut. If that can be done before that sheet hits the routers then an operator only needs load the sheet scan the QR code and push the start button. The QR code calls the correct program and the router then cuts the part. When done the parts are pre printed with no chance of mislabeling

The machine program names are rather long, 003_500455_TE_47_46_45_44_43_Y is typical of length and structure (I didn’t name them). 1 D bar code really doesn’t work for this much information but the QR code is compact and can hold even more information,


#4

Understood. So what you are looking for is a method to generate QR Codes within Rhino.

Do you know Python at all? https://pypi.python.org/pypi/qrcode is a QR Code generator which can export SVG.

I think someone with good scripting (Python) knowledge of Rhino could write a fairly simple program to

  1. Accept input from the user
  2. Call the program above with the input from the user, with an output option of SVG
  3. Import the new file into Rhino.

Note I haven’t tried any of the above, but it seems like an outline you could give to someone good at scripting.


(Laurent Delrieu) #5

Hello
I did this in Grasshopper. It outputs surfaces, each cell has a size of 1 unit, so the size of qr code depends on the size of the string.


it uses the library from Raffael Herrmann
https://github.com/codebude/QRCoder/tree/master/QRCoder
Documentation here
https://en.code-bude.net/2013/10/17/qrcoder-an-open-source-qr-code-generator-implementation-in-csharp/
The “unblocked” dll (QRCoder.dll and UnityEngine.dll) needed are from
https://www.nuget.org/api/v2/package/QRCoder/1.2.6 (it will download a file named qrcoder.1.2.6.nupkg)
https://www.nuget.org/packages/QRCoder/1.2.6
the dll can be extracted from the nupkg unzipping it and putting it in the same directory as the gh script

QR_Code_Surface.gh (6.5 KB)

implementation
Inputs :
string text
int error (0, 1, 2 or 3) for levels L, M, Q, H
Code

List<Surface> black = new List<Surface>();
List<Surface> white = new List<Surface>();
QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeGenerator.ECCLevel eccLevel = QRCodeGenerator.ECCLevel.H;
if (error == 0)eccLevel = QRCodeGenerator.ECCLevel.L;
if (error == 1)eccLevel = QRCodeGenerator.ECCLevel.M;
if (error == 2)eccLevel = QRCodeGenerator.ECCLevel.Q;
if (error == 3)eccLevel = QRCodeGenerator.ECCLevel.H;
QRCodeData qrCodeData = qrGenerator.CreateQrCode(text, eccLevel);
QRCode qrCode = new QRCode(qrCodeData);

for  (int i = 0; i < qrCodeData.ModuleMatrix.Count; i++)
{
  for  (int j = 0; j < qrCodeData.ModuleMatrix[i].Count; j++)
  {
    Point3d corner1 = new Point3d((double) j, -(double) i, 0.0);
    Point3d corner2 = new Point3d((double) j + 1, -(double) i, 0.0);
    Point3d corner3 = new Point3d((double) j + 1, -(double) i - 1, 0.0);
    Point3d corner4 = new Point3d((double) j, -(double) i - 1, 0.0);
    if (qrCodeData.ModuleMatrix[i][j])
    {
      black.Add(NurbsSurface.CreateFromCorners(corner1, corner2, corner3, corner4));
    }
    else
    {
      white.Add(NurbsSurface.CreateFromCorners(corner1, corner2, corner3, corner4));
    }
  }
}
Black = black;
White = white;

Outputs
Black : List of surfaces for black coloring, you could extract edges to hatch that !
White : List of surfaces for white coloring

Just some fun


QR_Code_Surface_not_sharp.gh (41.1 KB)


#6

Thanks @laurent_delrieu and @nates

Looks like I need to learn a little bit more about scripting. I know enough about it to poke through some one else’s work and make a change to suit my needs but really would be clueless in creating the QR code

Thanks, this will help.


#7

Laurent,
I tried putting a few versions of that DLL (NET3.5, NET4.0, Portable NET4.5, and Xamarinios) in the same directory as the Grasshopper definition but always get a few errors and only Nulls come out of the component (Black/White outputs).


Any hints?


(Laurent Delrieu) #8

You could try a right click on the component and th en manage assemblies and add the dll ! Perphas the component keep a path in my PC !
As I have just one PC with rhino it is difficult to test things


#9

Thanks for the reply.
That didn’t do it, no. I removed the referenced DLL and added it again but that didn’t change anything.


(Laurent Delrieu) #10

Last thing are the dll unblocked ?


#11

Sorry, yes…


(Laurent Delrieu) #12

Arghh !!!
I Will try to make à version without dll.
Updated :
I also put this dll, when I suppress it I add same problems
UnityEngine.dll


#13

Thanks, Laurent! Now it works here as well!


(Laurent Delrieu) #14

Thanks and happy to know that.
I ommitted to say I add 2 dll, I didn’t thought the second was useful ! I began to make a version without dll but it didn’t work (surely some difference of syntax). I don’t master enough compilation. I correct the main message.