Commit | Line | Data |
---|---|---|
c9a67c51 CE |
1 | // |
2 | // Pacman Ghost | |
3 | // ------------ | |
4 | // | |
5 | // Created by Joao Alves (jpralves@gmail.com) | |
9080b73a | 6 | // Tea Light added by Clinton Ebadi <clinton@unknownlamer.org> |
61ee1453 | 7 | // Pac Guy model by Fry Hyde (https://www.thingiverse.com/thing:612888) |
c9a67c51 CE |
8 | // ------------------------------------------ |
9 | // | |
10 | // Parameters: | |
11 | ||
c9a67c51 | 12 | // Figure diameter |
9080b73a CE |
13 | ghost_diameter = 50; // [25:5:100] |
14 | pacguy_diameter = ghost_diameter * 1.5; | |
c9a67c51 | 15 | |
9080b73a | 16 | height = ghost_diameter*0.65; |
c9a67c51 CE |
17 | // Add keychain |
18 | key_chain = 0; // [1:On, 0:Off] | |
19 | // Add LED hole | |
9080b73a CE |
20 | led_hole = 0; // [0:Off, 5:5mm, 8:8mm, 10:10mm] |
21 | // Add tea light holder | |
22 | tea_light = true; | |
23 | ||
24 | // Render Ghost | |
25 | ghost = true; | |
26 | // Render Pac Guy | |
27 | pacguy = true; | |
c9a67c51 CE |
28 | |
29 | // Detail | |
9080b73a CE |
30 | $fa=4; // [20:Low Res, 10:Normal Res, 4:Hi Res] |
31 | ||
32 | /* [Hidden] */ | |
33 | $fs=0.1; | |
34 | ||
35 | module ghost() { | |
36 | difference () { | |
37 | union() { | |
38 | cylinder(d = ghost_diameter, h = height); | |
39 | translate([0, 0, height]) sphere(d = ghost_diameter); | |
40 | if (key_chain == 1) { | |
41 | translate([0, 0, height+ghost_diameter/2]) | |
42 | rotate([0, 90, 0]) | |
43 | rotate_extrude() | |
44 | translate([4, 0, 0]) | |
45 | circle(r = 1.5); | |
46 | } | |
47 | } | |
48 | translate([ghost_diameter/2, -ghost_diameter/4, height]) | |
49 | sphere(d = ghost_diameter/3.5); | |
50 | translate([ghost_diameter/2, ghost_diameter/4, height]) | |
51 | sphere(d = ghost_diameter/3.5); | |
52 | translate([0, 0, -0.1]) | |
53 | for(a = [0:11]) { | |
54 | rotate([a/12*360,-90,0]) | |
55 | scale([1.5,1,1]) | |
56 | translate([0,0,ghost_diameter/12.5]) | |
57 | cylinder(ghost_diameter, 0,ghost_diameter/25*6.5, $fn=4); | |
58 | } | |
59 | } | |
60 | } | |
61 | ||
62 | module led_hole (led_d = led_hole, led_h = 0) { | |
63 | // led_h==0 auto-sets height, openscad can't reference other | |
64 | // arguments so this abomination arises | |
65 | led_h = led_h ? led_h : height - (led_d+2); | |
66 | ||
67 | union() { | |
68 | cylinder(d = led_d+2, h = led_h); | |
69 | translate([0, 0, led_h]) sphere(d = led_d+2); | |
70 | } | |
71 | } | |
72 | ||
73 | module tea_light_base () { | |
74 | base_diameter = 30; | |
75 | base_height = 16.2; | |
76 | bulb_ghost_diameter = 9; | |
77 | ||
78 | difference () { | |
79 | union () { | |
80 | cylinder (d = base_diameter + 1, h = base_height + 1); | |
81 | led_hole (led_d = bulb_ghost_diameter, led_h = base_height+8); | |
82 | } | |
9080b73a CE |
83 | } |
84 | ||
85 | } | |
86 | ||
87 | module pacguy () { | |
88 | // original model ghost_diameter is 30.464mm, scale to 1mm and then to | |
89 | // final ghost_diameter. z is slightly smaller due to bottom being cut | |
90 | // flat. | |
91 | s = 1 / 30.464 * pacguy_diameter; | |
92 | scale ([s, s, s]) translate ([0, 0, 28.742 / 2]) import ("PacGuy.stl", convexity=10); | |
93 | } | |
94 | ||
95 | module subtract_led () { | |
96 | difference () { | |
97 | children (); | |
98 | if (led_hole > 0) led_hole (); | |
99 | if (tea_light) tea_light_base (); | |
100 | } | |
101 | } | |
102 | if (ghost) { | |
103 | subtract_led () { | |
104 | rotate ([0, 0, -90]) ghost (); | |
105 | } | |
106 | } | |
107 | ||
108 | if (pacguy) { | |
109 | translate ([ ghost ? (ghost_diameter + pacguy_diameter) / 2 + 10 : 0, 0, 0]) subtract_led () { | |
110 | pacguy (); | |
111 | } | |
112 | } |