-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFerdie.scad
More file actions
153 lines (146 loc) · 5.64 KB
/
Ferdie.scad
File metadata and controls
153 lines (146 loc) · 5.64 KB
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
//Draw text
s = 0.7;
h = 2;
module oval(w, h, height, center = false) {
scale([1, h/w, 1]) cylinder(h=height, r=w, center=center);
}
s2 = .7;
scale([s2,s2,s2]){
difference(){
translate([25,0,0]) oval(30, 20, h);
translate([25,14,-.1]) cylinder(r=2.5, h=h*2);
}
translate([17*s,11*s-2*s,h-2]) scale([s,s,4]) drawtext("Ferdie");
translate([0, 0-2*s,h-2]) scale([s,s,4]) drawtext("650-315-3731");
translate([0*s,-11*s-2*s,h-2]) scale([s,s,4]) drawtext("901 Clark Wy");
}
//Draw character set
//scale([2,2,2]) drawtext(" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}");
module drawtext(text) {
//Characters
chars = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}";
//Chracter table defining 5x7 characters
//Adapted from: http://www.geocities.com/dinceraydin/djlcdsim/chartable.js
char_table = [ [ 0, 0, 0, 0, 0, 0, 0],
[ 4, 0, 4, 4, 4, 4, 4],
[ 0, 0, 0, 0,10,10,10],
[10,10,31,10,31,10,10],
[ 4,30, 5,14,20,15, 4],
[ 3,19, 8, 4, 2,25,24],
[13,18,21, 8,20,18,12],
[ 0, 0, 0, 0, 8, 4,12],
[ 2, 4, 8, 8, 8, 4, 2],
[ 8, 4, 2, 2, 2, 4, 8],
[ 0, 4,21,14,21, 4, 0],
[ 0, 4, 4,31, 4, 4, 0],
[ 8, 4,12, 0, 0, 0, 0],
[ 0, 0, 0,31, 0, 0, 0],
[12,12, 0, 0, 0, 0, 0],
[ 0,16, 8, 4, 2, 1, 0],
[14,17,25,21,19,17,14],
[14, 4, 4, 4, 4,12, 4],
[31, 8, 4, 2, 1,17,14],
[14,17, 1, 2, 4, 2,31],
[ 2, 2,31,18,10, 6, 2],
[14,17, 1, 1,30,16,31],
[14,17,17,30,16, 8, 6],
[ 8, 8, 8, 4, 2, 1,31],
[14,17,17,14,17,17,14],
[12, 2, 1,15,17,17,14],
[ 0,12,12, 0,12,12, 0],
[ 8, 4,12, 0,12,12, 0],
[ 2, 4, 8,16, 8, 4, 2],
[ 0, 0,31, 0,31, 0, 0],
[16, 8, 4, 2, 4, 8,16],
[ 4, 0, 4, 2, 1,17,14],
[14,21,21,13, 1,17,14],
[17,17,31,17,17,17,14],
[30,17,17,30,17,17,30],
[14,17,16,16,16,17,14],
[30,17,17,17,17,17,30],
[31,16,16,30,16,16,31],
[16,16,16,30,16,16,31],
[15,17,17,23,16,17,14],
[17,17,17,31,17,17,17],
[14, 4, 4, 4, 4, 4,14],
[12,18, 2, 2, 2, 2, 7],
[17,18,20,24,20,18,17],
[31,16,16,16,16,16,16],
[17,17,17,21,21,27,17],
[17,17,19,21,25,17,17],
[14,17,17,17,17,17,14],
[16,16,16,30,17,17,30],
[13,18,21,17,17,17,14],
[17,18,20,30,17,17,30],
[30, 1, 1,14,16,16,15],
[ 4, 4, 4, 4, 4, 4,31],
[14,17,17,17,17,17,17],
[ 4,10,17,17,17,17,17],
[10,21,21,21,17,17,17],
[17,17,10, 4,10,17,17],
[ 4, 4, 4,10,17,17,17],
[31,16, 8, 4, 2, 1,31],
[14, 8, 8, 8, 8, 8,14],
[ 0, 1, 2, 4, 8,16, 0],
[14, 2, 2, 2, 2, 2,14],
[ 0, 0, 0, 0,17,10, 4],
[31, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 2, 4, 8],
[15,17,15, 1,14, 0, 0],
[30,17,17,25,22,16,16],
[14,17,16,16,14, 0, 0],
[15,17,17,19,13, 1, 1],
[14,16,31,17,14, 0, 0],
[ 8, 8, 8,28, 8, 9, 6],
[14, 1,15,17,15, 0, 0],
[17,17,17,25,22,16,16],
[14, 4, 4, 4,12, 0, 4],
[12,18, 2, 2, 2, 6, 2],
[18,20,24,20,18,16,16],
[14, 4, 4, 4, 4, 4,12],
[17,17,21,21,26, 0, 0],
[17,17,17,25,22, 0, 0],
[14,17,17,17,14, 0, 0],
[16,16,30,17,30, 0, 0],
[ 1, 1,15,19,13, 0, 0],
[16,16,16,25,22, 0, 0],
[30, 1,14,16,15, 0, 0],
[ 6, 9, 8, 8,28, 8, 8],
[13,19,17,17,17, 0, 0],
[ 4,10,17,17,17, 0, 0],
[10,21,21,17,17, 0, 0],
[17,10, 4,10,17, 0, 0],
[14, 1,15,17,17, 0, 0],
[31, 8, 4, 2,31, 0, 0],
[ 2, 4, 4, 8, 4, 4, 2],
[ 4, 4, 4, 4, 4, 4, 4],
[ 8, 4, 4, 2, 4, 4, 8] ];
//Binary decode table
dec_table = [ "00000", "00001", "00010", "00011", "00100", "00101",
"00110", "00111", "01000", "01001", "01010", "01011",
"01100", "01101", "01110", "01111", "10000", "10001",
"10010", "10011", "10100", "10101", "10110", "10111",
"11000", "11001", "11010", "11011", "11100", "11101",
"11110", "11111" ];
//Process string one character at a time
for(itext = [0:len(text)-1]) {
//Convert character to index
assign(ichar = search(text[itext],chars,1)[0]) {
//Decode character - rows
for(irow = [0:6]) {
assign(val = dec_table[char_table[ichar][irow]]) {
//Decode character - cols
for(icol = [0:4]) {
assign(bit = search(val[icol],"01",1)[0]) {
if(bit) {
//Output cube
translate([icol + (6*itext), irow, 0])
cube([1.0001,1.0001,1]);
}
}
}
}
}
}
}
}