Skip to content

Instantly share code, notes, and snippets.

@mm12
Forked from MooseV2/altoids-razor.c
Last active October 5, 2022 01:09
Show Gist options
  • Save mm12/bd38d121dd8f1a6e14990a6a88424417 to your computer and use it in GitHub Desktop.
Save mm12/bd38d121dd8f1a6e14990a6a88424417 to your computer and use it in GitHub Desktop.
Parametric razor case, designed to fit into an Altoids tin.
//Coin case, designed to fit into an Altoids tin.
//Open with http://www.openscad.org
//Origionally by MooseV2, modified by Catt0s
height = 23;
tin = [90, 55, height, 12]; //length, width, depth, corner radius
dime = 17.91/2; // dime
penny = 19.05/2; // penny
nickle = 21.21/2; // nickle
quarter = 24.26/2; // quarter
dollar = 26.5/2; // dollar
coins = [
// center
[
nickle, // size
[-20,0] // position
],
[
dime, // size
[13,0] // position
],
// edge:
[
quarter, // size
[((tin[3]/2.1 + tin[0]/2) - 3.5*quarter),
(0-((tin[3]/2.1 + tin[1]/2) - quarter))] // position
],
[
nickle, // size
[(tin[3]/2.1 + tin[0]/2) - 3.5*nickle,
(tin[3]/2.1 + tin[1]/2) - nickle] // position
],
[
penny, // size
[0-((tin[3]/2.2 + tin[0]/2) - penny),
0] // position
],
[
penny, // size
[0-((tin[3]/2.3 + tin[0]/2) - 3.1*penny),
0-((tin[3]/2.5 + tin[1]/2) - penny)] // position
],
[
dime, // size
[0-((tin[3]/2.5 + tin[0]/2) - 3.1*dime),
((tin[3]/2.5 + tin[1]/2) - dime)] // position
],
// corners:
[
penny, // size
[0-((tin[3]/2.5 + tin[0]/2) - penny),
0-((tin[3]/2.5 + tin[1]/2) - penny)] // position
],
[
dime, // size
[0-((tin[3]/2.5 + tin[0]/2) - dime),
((tin[3]/2.5 + tin[1]/2) - dime)] // position
],
[
quarter, // size
[((tin[3]/2.1 + tin[0]/2) - quarter),
(0-((tin[3]/2.1 + tin[1]/2) - quarter))] // position
],
[
dollar, // size
[(tin[3]/2.1 + tin[0]/2) - dollar,
(tin[3]/2.1 + tin[1]/2) - dollar] // position
],
];
difference() {
//Main tin
roundedRect(tin);
//Subtract coins
for (coin = coins){
pos = coin[1];
size = coin[0];
translate([pos[0],pos[1],1])
cylinder(height,size,size);
}
}
module roundedRect(size)
{
//http://www.thingiverse.com/thing:9347
x = size[0];
y = size[1];
z = size[2];
radius = size[3];
linear_extrude(height=z)
hull()
{
// place 4 circles in the corners, with the given radius
translate([(-x/2)+(radius/2), (-y/2)+(radius/2), 0])
circle(r=radius);
translate([(x/2)-(radius/2), (-y/2)+(radius/2), 0])
circle(r=radius);
translate([(-x/2)+(radius/2), (y/2)-(radius/2), 0])
circle(r=radius);
translate([(x/2)-(radius/2), (y/2)-(radius/2), 0])
circle(r=radius);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment