Skip to content

Instantly share code, notes, and snippets.

@asadoughi
Last active April 3, 2016 17:48
Show Gist options
  • Save asadoughi/0a10795f0a53059d9484d4c269d530f7 to your computer and use it in GitHub Desktop.
Save asadoughi/0a10795f0a53059d9484d4c269d530f7 to your computer and use it in GitHub Desktop.
// Key-ring comb.
// Author: Amir Sadoughi.
// Date: 2016/04/03.
// Units in mm.
module tooth(width, height) {
depth = 2;
/* Note: points in faces must be left-hand rule clockwise ordered
otherwise it will fail to render
*/
polyhedron(points=[[0, 0, 0], [0, width, 0], [depth, 0, 0], [depth, width, 0],
[depth, width/2, height], [0, width/2, height]],
faces=[[0, 1, 3, 2],
[1, 0, 5], [3, 4, 2],
[3, 1, 5, 4], [0, 2, 4, 5]]);
}
cube_height = 5;
comb_length = 85;
comb_width = 3; // 1/8 of an inch
keyring_length = 12;
tooth_height = 20;
// base of comb
cube([comb_length, comb_width, cube_height]);
// keyring
translate([comb_length - keyring_length, 0, cube_height]) difference() {
cube([keyring_length, comb_width, tooth_height]);
translate([keyring_length/2, comb_width*1.5, 8]) rotate([90,0,0]) cylinder(comb_width*2, r=3, $fn=20);
}
// teeth
for (i = [0:3.5:comb_length - keyring_length]) {
translate([i, 0, cube_height]) tooth(comb_width, tooth_height);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment