Thanks you, this code create xml file with all points needed
I use Pancake to export the output as svg file than import it, i don’t know how to do that with python;
and the result , small qrcode city
Hmm… first steps towards a Rhino QR code factory …
import qrcode import qrcode.image.rhino_image factory = qrcode.image.rhino_image.RhinoImage img = qrcode.make('Some data here', image_factory=factory)
Very nice , thank you
The code is here
Thank you very much; i make a little change
import Rhino.Geometry as rg import scriptcontext as sc import qrcode.image.base class RhinoImage(qrcode.image.base.BaseImage): """ Rhino QRCode image output class. """ kind = "Rhino" allowed_kinds = ("Rhino",) def __init__(self, *args, **kwargs): super(RhinoImage, self).__init__(*args, **kwargs) def drawrect(self, row, col): """ Draw point location of the QR code. """ point = rg.Point3d(col, -row, 0) self._img.append(point) def new_image(self, **kwargs): """ Build the image class. Subclasses should return the class created. """ return  def get_image(self, **kwargs): """ Return the image class for further processing. """ return self._img
QrCode.gh (6.5 KB)
Hi @seghierkhaled .
I would like to use the qrcode module in GHPython and RhinoPython, but when I try to import qrcode, I get an import error. how can I use qrcode in GHpython?
Read the topic carefuly, the solution already posted by @Dancergraham
Sorry, I had to read it properly again. However, I couldn’t figure out why the first line of the import shows invalid syntax.
Where is the qrcode module installed? I’m sorry that this is a fundamental question.
Thanks for your help!
Follow these steps to set python27 as interepter and to add it in rhino folders than you can install qrcode module.
You should put the qrcode module in your scripts folder. For Rhino 7 on Windows this should be
You should have a folder called
qrcode in there containing files like this:
and this file : rhino_image.py (1.5 KB) in the image directory
Hmm, I’m probably missing something essential but I have those folders and files seamingly in the right location
But cannot get it to work either…
Any idea what I might be missing here?
Did you download version 7 from Pypi ? It looks like they have gone Python 3 only - you may need to download and unpack the tar package from here qrcode · PyPI
That did something but it now seems like I’m missing a module named “six”. Any idea what that could be? Thanks a lot for the help.
If I remember correctly, Six should be a Python module that attempts to render scripts written in Python 2.7 and 3.x+ better compatible. The entire module should be contained within a single Python file. As long as you copy it to a directory that Rhino loads by default or even to your own project/module, you should be able to import from it. You can get it on GitHub.
yes as in 2 times 3 equals 6
I’m currently using 3.9.
I have incompatible libraries - I am stuck on 3.8 for the new day job, but at least I have f-strings and type annotations. Looking forward to structural pattern matching in 3.10 if I ever get there !!!
Love those two! Game changers!!!