Skip to content

Instantly share code, notes, and snippets.

@reinhrst
Created July 26, 2022 09:27
Show Gist options
  • Save reinhrst/c48be7d792159ead5d9b42bfe6e5def2 to your computer and use it in GitHub Desktop.
Save reinhrst/c48be7d792159ead5d9b42bfe6e5def2 to your computer and use it in GitHub Desktop.
scale([4, 4, 1]) {
translate([20, 20, 0]) {linear_extrude (height=1) {circle(26);}};
color([0, 0, 0]) {
translate([0, 26, 0]) { linear_extrude (height=3){import("wifi.svg"); }; }
translate([2, 15, 1]) { linear_extrude (height=1){rotate(90){text("wifi", size=5); }}; }
translate([43, 12, 1]) { linear_extrude (height=1){rotate(90){text("hs3.pl", size=5); }}; }
translate([16, -2, 1]) { linear_extrude (height=1){text("QR", size=5); }; }
translate([28, 43, 1]) { linear_extrude (height=1){rotate(180)text("NFC", size=5);}; }
}
}

Notes

  • Not sure Pillow is needed (since we're exporting to SVG)
  • The above almost works. For some weird reason, OpenSCAD doesn't think the resulting mesh is closed. The solution is to seperately render the extruded QR code, and the rest, as two STL files, and then combine them in the slicer.
  • In the slicer, you would have to fix the colours (not sure if colours would be fixed automatically if OpenSCAD exports to .3MF)
  • The NFC label is because I also stuck an NFC sticker on the back of the print.

**Bounty: I buy you a beer if you can explain to me why the openSCAD file as advertised doesn't work, and how to fix it (note: I didn't check if it doesn't work for any QR codes, it doesn't for my wifi network)

#!/bin/bash
pip install qrcode\[pil\] # or conda install qrcode pillow
qr --factory=svg "WIFI:S:MySSID;T:WPA;P:MyPassword;;" > wifi.svg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment