xypwn / scadqr

Effortlessly generate QR codes directly in OpenSCAD! No extra dependencies!
MIT License
92 stars 9 forks source link

ADD 2D option #6

Closed UBaer21 closed 5 months ago

UBaer21 commented 8 months ago

thickness = 0 will return a 2D code that can be used.

xypwn commented 8 months ago

Hi, thanks for taking the time to submit a PR, but after reviewing the code, there are multiple issues I've noticed.

UBaer21 commented 8 months ago

I used openSCAD to edit the .scad not sure why github can't handle this proper. Using a special variable was the easiest way without adding new variables on each module, as you switched to 3D already in your "helper" modules and then scaled instead of using offset() for epsilon (which btw is causing problems with the dev versions of scad and manifold but we have already an issue open for that). But it in general it would be cleaner to keep everything in 2D and then extrude at top-level. However as you made such a useful code i thought you maybe want to add the option, how ever you like to code that - as QR code is 2D.

xypwn commented 8 months ago

You can use an external editor like notepad++ (which can be set to LF) to edit the file, and OpenSCAD should automatically update the preview after each save. AFAIK, GitHub doesn't ever change the line ending.

Technically speaking, 2D QR codes are already possible by using qr_custom() with 2D elements.

But I agree that QR codes are 2D objects, and that a simple 2D option could definitely be useful. Extruding everything at top-level would probably be the most desirable approach, in the end, especially when also considering the implications this might have on the renderer.

xypwn commented 5 months ago

I went ahead and implemented the feature in a way that I find is more consistent with the rest of the codebase. A QR code is now made 2D by setting the thickness parameter to 0. Thanks for suggesting this feature :)