Last active
October 2, 2021 06:26
-
-
Save xoan/4e9e75aa3fca2402513162a2c64365e7 to your computer and use it in GitHub Desktop.
This file contains 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
// iconum.scad | |
// Author: Xoan Sampaiño <xoansampainho@gmail.com>, 2018. | |
// Based on https://www.thingiverse.com/thing:183392 | |
// Licensed under the terms of the MIT license | |
// the iconum | |
iconum(units = 1); | |
// the board | |
board(length = 5, width = 5); | |
// internal parameters | |
module_size = 23; // | |
module_height = 5; // | |
hole_radius = 8.5; // | |
board_thickness = 3; // | |
board_margin = 3; // | |
pin_height = 6; // | |
pin_clearance = 2; // | |
pin_bevel = 1; // | |
corner_radius = 5; // | |
colors = [ // colors (just for CSG preview) | |
"white", // board | |
"darkorange", // iconum(units = 1) | |
"lightblue", // iconum(units = 2) | |
"gold", // iconum(units = 3) | |
"darkseagreen", // iconum(units = 4) | |
"red", // iconum(units = 5) | |
"steelblue", // iconum(units = 6) | |
"lightcoral", // iconum(units = 7) | |
"forestgreen", // iconum(units = 8) | |
"purple", // iconum(units = 9) | |
"midnightblue" // iconum(units = 10) | |
]; | |
// arc parameters | |
$fa = 5; $fs = 1; | |
// safe | |
fudge = 0.01; | |
module iconum(units = 1) | |
{ | |
// sanitice units | |
units = units < 1 ? 1 : floor(units); | |
color(colors[units]) linear_extrude(height = module_height) difference() | |
{ | |
minkowski() | |
{ | |
translate(v = [-(module_size / 2) + corner_radius, -(module_size / 2) + corner_radius]) | |
{ | |
square(size = [ | |
module_size * (units > 1 ? 2 : 1) - corner_radius * 2, | |
module_size * (units > 1 ? floor(units / 2) : 1) - corner_radius * 2 | |
]); | |
square(size = [ | |
module_size - corner_radius * 2, | |
module_size * ceil(units / 2) - corner_radius * 2 | |
]); | |
} | |
circle(r = corner_radius); | |
} | |
translate(v = [-module_size, -module_size]) | |
for (i = [1 : (units > 1 ? 2 : 1)], j = [1 : ceil(units / 2)]) | |
translate(v = [i * module_size, j * module_size, 0]) | |
circle(r = hole_radius); | |
} | |
} | |
module board(length = 5, width = 5) | |
{ | |
length = length < 1 ? 0 : floor(length) - 1; | |
width = width < 1 ? 0 : floor(width) - 1; | |
color(colors[0]) | |
{ | |
minkowski() | |
{ | |
translate(v = [-module_size / 2 - board_margin + corner_radius, -module_size / 2 - board_margin + corner_radius, -board_thickness]) | |
cube(size = [ | |
module_size * length + module_size + board_margin * 2 - corner_radius * 2, | |
module_size * width + module_size + board_margin * 2 - corner_radius * 2, | |
board_thickness / 2 | |
]); | |
cylinder(r = corner_radius, h = board_thickness / 2); | |
} | |
for (i = [0 : length], j = [0 : width]) | |
translate(v = [i * module_size, j * module_size, 0]) | |
{ | |
cylinder(r = hole_radius - pin_clearance, h = pin_height - pin_bevel); | |
translate(v = [0, 0, pin_height - pin_bevel]) | |
cylinder(r1 = hole_radius - pin_clearance, r2 = hole_radius - pin_clearance - pin_bevel, h = pin_bevel); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment