5c17fd9b62f8c2cfab3b0f5c941eab3cfecf7717
[clinton/3d-models.git] / pacman-ghost / pacman-ghost.scad
1 //
2 // Pacman Ghost
3 // ------------
4 //
5 // Created by Joao Alves (jpralves@gmail.com)
6 // ------------------------------------------
7 //
8 // Parameters:
9
10
11 // Figure diameter
12 diameter = 25; // [25:5:100]
13
14 height = diameter*0.65;
15 // Add keychain
16 key_chain = 0; // [1:On, 0:Off]
17 // Add LED hole
18 led_Hole = 0; // [0:Off, 5:5mm, 8:8mm, 10:10mm]
19
20 // Detail
21 $fn=100; // [20:Low Res, 50:Normal Res, 100:Hi Res]
22
23 rotate([0,0,-90])
24 difference() {
25 union() {
26 cylinder(d = diameter, h = height);
27 translate([0, 0, height]) sphere(d = diameter);
28 if (key_chain == 1) {
29 translate([0, 0, height+diameter/2])
30 rotate([0, 90, 0])
31 rotate_extrude()
32 translate([4, 0, 0])
33 circle(r = 1.5);
34 }
35 }
36 translate([diameter/2, -diameter/4, height])
37 sphere(d = diameter/3.5);
38 translate([diameter/2, diameter/4, height])
39 sphere(d = diameter/3.5);
40 translate([0, 0, -0.1])
41 for(a = [0:11]) {
42 rotate([a/12*360,-90,0])
43 scale([1.5,1,1])
44 translate([0,0,diameter/12.5])
45 cylinder(diameter, 0,diameter/25*6.5, $fn=4);
46 }
47 if (led_Hole > 0) {
48 union() {
49 cylinder(d = led_Hole+2, h = height-(led_Hole+2));
50 translate([0, 0, height-(led_Hole+2)]) sphere(d = led_Hole+2);
51 }
52 }
53 }