-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathandroid.scad
213 lines (190 loc) · 6.21 KB
/
android.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
// Android model
// Copyright 2011 John Cooper
// Licenced under Creative Commons Attribution 3.0 Unported (CC BY 3.0)
// https://creativecommons.org/licenses/by/3.0/deed.en
// Based on dimentions from the google Android.svg found here:
// https://secure.wikimedia.org/wikipedia/en/wiki/File:Android_robot.svg
// You can adjust the size here
bodywidth = 183.2;
bodyheight = bodywidth * 0.85; // 156
armwidth = bodywidth * 0.26; // 40
armlength = bodyheight * 0.8; // 125 including the round bits;
peg_r = armwidth * 0.1;
legwidth = armwidth ;
bodygap = bodywidth * 0.04;
leglength = bodyheight * 0.43; // 67
// headgap = 7.5;
// eye center from bottom of head = 40;
// between the eyes = 85
// antenna height = 25
// antenna width = 16
// antenna lenght = 29.6
// antenna angle = 25
eye_height = bodywidth * 0.22;
eye_width = bodywidth * 0.082 ; // 15.2
eye_sep = bodywidth * 0.46 ; // 85
antenna_length = bodywidth * 0.161 ;
antenna_width = bodywidth * 0.02 ; // 3.6
antenna_angle = 25 ;
antenna_height = bodywidth * 0.404;// 74
standing = true;
// You should not need to change anything after this
// Module: SplitPeg
// Create a split peg that can be pushed into a hole
module splitPeg(radius) {
// The length should relate to the length in splitPegHole
length = radius * 4;
splitWidth = radius * 0.4;
splitDepth = length * 0.4;
union () {
difference () {
cylinder (h=length, r=radius);
translate ([- radius,-(splitWidth / 2),-0.1]) {
cube ([radius * 2.2, splitWidth, splitDepth ]);
}
}
translate ([0,radius,0]) {
cylinder(h=splitDepth / 2, r1=0, r2=splitWidth);
}
translate ([0,- radius,0]) {
cylinder(h=splitDepth / 2, r1=0, r2=splitWidth);
}
}
}
// Module: SplitPegHole
// Create a hole that will take the split peg
// For now just a hole and hope that the printing with be rough
// enough to hold it.
module splitPegHole (radius) {
// The length should be related to the splitPeg length
length = radius * 4;
cylinder (h=length, r=radius);
}
module antenna(length, width) {
union () {
cylinder(h=length, r1=width, r2=width);
translate([0,0,length]) { sphere(width); }
}
}
module head(body_r) {
$fs = 1; // Crank up the resolution
union () {
difference () {
sphere(body_r);
translate ([-body_r, -body_r, -body_r * 2]) { cube(body_r * 2, body_r * 1, 1 );}
sphere(body_r - 5);
}
difference () {
translate ([0,0,-5]) {cylinder (h=10, r1=body_r -4, r2=body_r -4);}
translate ([0,0,-5.5]) { cylinder (h=11, r1=body_r -7, r2=body_r -7);}
}
}
// Now add the eyes
translate ([-eye_sep / 2 ,-body_r * 0.75,eye_height]) {sphere (eye_width / 2);}
translate ([eye_sep / 2,-body_r * 0.75, eye_height]) {sphere (eye_width / 2);}
// And the antenna
translate ([body_r * 0.5, 0, antenna_height]) {
rotate ([0,antenna_angle,0]) {
antenna (antenna_length, antenna_width);
}
}
translate ([-body_r * 0.5, 0, antenna_height]) {
rotate ([0,-antenna_angle,0]) {
antenna (antenna_length, antenna_width);
}
}
}
module body (body_r, bodyheight) {
difference () {
cylinder(h=bodyheight, r=body_r);
translate ([0,0,5]) {
cylinder(h=bodyheight, r=body_r - 5 );
}
}
}
module arm (arm_r, bodyheight, armlength) {
union () {
cylinder (h=armlength, r=arm_r);
translate ([0, 0, armlength]) {
sphere (arm_r);
}
sphere (arm_r);
// And now a peg to hold them on
translate ([arm_r + (bodygap * 2) , 0, armlength]) {
rotate ([180,90,0]) {
splitPeg(peg_r);
}
}
}
}
module leg ( leg_r, bodyheight, leglength, withfoot) {
union () {
cylinder (h=leglength, r=leg_r );
translate ([0, 0, leglength + leg_r * 0.4 ]) {
rotate ([180,0,180]) {
splitPeg(peg_r);
}
}
if (withfoot) {
difference () {
union () {
translate ([0, leg_r,0]) {
rotate ([90, 0, 0]) {
cylinder (h=leg_r * 2.4, r=leg_r);
}
}
translate ([0, - leg_r * 1.4,0]) {
sphere( leg_r );
}
}
translate ([- ( leg_r + 0.5), -leg_r * 2.5, - leg_r]) {
cube ([leg_r * 2 + 1 , leg_r * 3.6, leg_r] );
}
}
} else {
sphere ( leg_r );
}
}
}
translate ([0,0,bodyheight*2]) {
// head (bodywidth /2 );
translate ([0,0,-(bodyheight + bodygap)]) {
difference () {
% body (bodywidth / 2, bodyheight);
translate ([bodywidth / 2 - peg_r * 4, 0, armlength + bodygap ]) {
rotate ([0, 90, 0]) {
splitPegHole(peg_r);
}
}
translate ([- (bodywidth / 2 - peg_r * 4) , 0, armlength + bodygap ]) {
rotate ([0, -90, 0]) {
splitPegHole(peg_r);
}
}
if ( standing ) {
translate ([bodywidth / 2 * 0.4 , 0, -0.1]) {
splitPegHole(peg_r);
}
translate ([- (bodywidth / 2 * 0.4) , 0, -0.1]) {
splitPegHole(peg_r);
}
}
}
}
translate ([-(bodywidth/2 + armwidth/2 + bodygap), 0,-bodyheight]) {
arm(armwidth/2, bodyheight, armlength);
}
translate ([(bodywidth/2 + armwidth/2 + bodygap), 0,-bodyheight]) {
rotate ([0,0,180], center=true) {
arm(armwidth/2, bodyheight, armlength);
}
}
if ( standing ) {
translate ([ bodywidth/ 2 * 0.4 , 0, - (bodyheight + leglength + bodygap)]) {
% leg(legwidth/2, bodyheight, leglength, withfoot=true);
}
translate ([ - bodywidth / 2 * 0.4, 0, - (bodyheight + leglength + bodygap)]) {
leg(legwidth/2, bodyheight, leglength, withfoot=true);
}
}
}