-
Notifications
You must be signed in to change notification settings - Fork 0
/
ledcubesphere.scad
133 lines (83 loc) · 2.55 KB
/
ledcubesphere.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
/*
create a sphere around a led cube
fully parametric
this code is not 100% accurate yet, but close enough to relase it for further improvement
-overflo 9/2022
Free software in the public domain (ab)use at will.
*/
// number of leds in one row
leds=8;
//distance between leds center to center
led_distance=7;
// this could be something else but lets calculate it for startes
cubesize= leds*led_distance;
// how thick the walld should be to fit between the leds
wallthickness=1;
// this could be something else
sphere_dia=cubesize*1.75;
module grid()
{
// we cut out a 45degree piece
intersection()
{
// unionize all fins
union()
{
// make fins in one direction on the plane starting from center
for(i=[0:leds/2])
{
//echo((45/leds)*i);
if (i==(leds/2)) {
color("green") translate([(i*led_distance),0,(cubesize/2)]) rotate([0,(90/leds)*i,0]) cube([wallthickness/2,1000,1000] ,center=true);
}
else
{
translate([(i*led_distance),0,(cubesize/2)]) rotate([0,(90/leds)*i,0]) cube([wallthickness,1000,1000] ,center=true);
}
}
// make fins on the other side of the center
for(i=[0:leds/2])
{
if (i==(leds/2)) {
color("blue") translate([-(i*led_distance),0,(cubesize/2)]) rotate([0,-(90/leds)*i,0]) cube([wallthickness/2,1000,1000] ,center=true);
}
else
{
translate([-(i*led_distance),0,(cubesize/2)]) rotate([0,-(90/leds)*i,0]) cube([wallthickness,1000,1000] ,center=true);
}
}
} //union
// create a "pyramid" to cut off the finsfrom cube side to furthest away edge
hull()
{
translate([0,0,500]) cube([1000,1000,1],center=true);
translate([0,0,cubesize/2]) cube([cubesize,cubesize,0.001],center=true);
}
} //intersection
}
// make a side from 2 grids at a 90 degree rotated axis
module sidegrid()
{
grid();
rotate([0,0,90]) grid();
}
//start of actual model
// the cube in the middle
color("red") cube([cubesize,cubesize,cubesize],center=true);
// we want to have a sphere at the end..
intersection()
{
// render all the sides / grids
union()
{
sidegrid();
rotate([90,0,0]) sidegrid();
rotate([-90,0,0]) sidegrid();
rotate([-90,0,90]) sidegrid();
rotate([180,0,0]) sidegrid();
rotate([-90,0,-90]) sidegrid();
}
// remove everything thats not inside out sphere
// this could be ANY shape..
sphere(d=sphere_dia,$fn=100);
}