Created
February 27, 2026 02:39
-
-
Save scruss/9801a0cd8e0a3e1a88a26e9939020278 to your computer and use it in GitHub Desktop.
Improved MicroPython logo keychain in OpenSCAD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| MicroPython logo keyfob - scruss, 2026-02 | |
| OpenSCAD | |
| As this is a work derived from the MicroPython logo, | |
| its licence (MIT) is the same: | |
| https://github.com/micropython/micropython/blob/master/LICENSE | |
| Print size: 27.6 × 27.6 × 6 mm | |
| */ | |
| // list of points to drag a 10x10 square through | |
| // makes a 46 × 46 mm logo | |
| centreline = [ | |
| [ 5, 5, 0 ], | |
| [ 5, 41, 0 ], | |
| [ 17, 41, 0 ], | |
| [ 17, 5, 0 ], | |
| [ 29, 5, 0 ], | |
| [ 29, 41, 0 ], | |
| [ 41, 41, 0 ], | |
| [ 41, 5, 0 ] | |
| ]; | |
| arm_width = 10; // don't change this | |
| thickness = 6; | |
| eps = 1e-4; | |
| // these squoff* modules make a squared-off hexagon shape | |
| // that is easy to print | |
| module | |
| squoffhex(side) | |
| { | |
| intersection() | |
| { | |
| square(side, center = true); | |
| circle(side / (sqrt(3)), $fn = 6); // hexagon | |
| } | |
| } | |
| module | |
| squoff_blob(side) | |
| { | |
| intersection() | |
| { | |
| rotate([ 90, 0, 0 ]) linear_extrude(2 * side, center = true) | |
| squoffhex(side); | |
| rotate([ 90, 0, 90 ]) linear_extrude(2 * side, center = true) | |
| squoffhex(side); | |
| } | |
| } | |
| module | |
| squoff_raft(width, height) | |
| { | |
| hull() | |
| { | |
| translate([ (width - height) / 2, (width - height) / 2, 0 ]) | |
| squoff_blob(height); | |
| translate([ (width - height) / 2, -(width - height) / 2, 0 ]) | |
| squoff_blob(height); | |
| translate([ -(width - height) / 2, (width - height) / 2, 0 ]) | |
| squoff_blob(height); | |
| translate([ -(width - height) / 2, -(width - height) / 2, 0 ]) | |
| squoff_blob(height); | |
| } | |
| } | |
| module | |
| mpy_logo_3d() | |
| { | |
| scale([ 6 / 10, 6 / 10, 1 ]) difference() | |
| { | |
| // trace out path of M | |
| for (i = [1:7]) { | |
| hull() | |
| { | |
| translate(centreline[i - 1]) squoff_raft(arm_width, thickness); | |
| translate(centreline[i]) squoff_raft(arm_width, thickness); | |
| } | |
| } | |
| // cut out eye | |
| translate([ 40, 4, -2 * thickness ]) | |
| cube([ 8 / 3, 14 / 3, 4 * thickness + eps ]); | |
| } | |
| } | |
| module | |
| hole() | |
| { | |
| // for keyring | |
| translate([ 3, 24, 0 ]) rotate([ 0, 90, 45 ]) | |
| cylinder(h = 4 * thickness, d = 4, center = true, $fn = 32); | |
| } | |
| // cut the hole from the logo | |
| difference() | |
| { | |
| mpy_logo_3d(); | |
| hole(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment