-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dessicant Holder.scad
95 lines (77 loc) · 3.31 KB
/
Dessicant Holder.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
base_length = 50;
base_width = 50;
height = 110;
thickness = 4;
hole_size = 0.75;
hole_count = 20;
hole_count_w = 20;
hole_spacing = .25;
do_difference = true;
hypotenuse = sqrt((hole_size * hole_size) + (hole_size * hole_size));
module length_cubes() {
useable_space = base_length - (thickness * 2);
hole_space_usage = hole_count * hypotenuse;
hole_gap = (useable_space - hole_space_usage) / (hole_count - 1);
useable_space_alt = base_length - (thickness * 2) - hypotenuse - hole_gap;
hole_space_usage_alt = (hole_count - 1) * hypotenuse;
hole_gap_alt = (useable_space_alt - hole_space_usage_alt) / (hole_count - 2);
for (z_pos = [thickness + (hypotenuse / 2) + hole_spacing : hypotenuse + hole_spacing : height - thickness]) {
for (x_pos = [thickness : hole_gap + hypotenuse : base_length - thickness]) {
translate([x_pos, thickness + 1, z_pos])
rotate([90, 45, 0])
color("red")
cube([hole_size, hole_size, thickness + 2]);
}
}
for (z_pos = [thickness + hypotenuse + (hole_spacing * 1.5) : hypotenuse + hole_spacing : height - thickness]) {
for (x_pos = [thickness + (hypotenuse / 2) + (hole_gap_alt / 2): hole_gap_alt + hypotenuse : base_length - thickness - (hypotenuse / 2) - (hole_gap / 2)]) {
translate([x_pos, thickness + 1, z_pos])
rotate([90, 45, 0])
color("blue")
cube([hole_size, hole_size, thickness + 2]);
}
}
}
module width_cubes() {
useable_space = base_width - (thickness * 2);
hole_space_usage = hole_count_w * hypotenuse;
hole_gap = (useable_space - hole_space_usage) / (hole_count_w - 1);
useable_space_alt = base_width - (thickness * 2) - hypotenuse - hole_gap;
hole_space_usage_alt = (hole_count_w - 1) * hypotenuse;
hole_gap_alt = (useable_space_alt - hole_space_usage_alt) / (hole_count_w - 2);
for (z_pos = [thickness + hole_spacing : hypotenuse + hole_spacing : height - thickness - (hypotenuse / 2)]) {
for (x_pos = [thickness + (hypotenuse / 2): hole_gap + hypotenuse : base_width - thickness]) {
translate([-1, x_pos, z_pos])
rotate([45, 0, 0])
color("red")
cube([thickness + 2, hole_size, hole_size]);
}
}
for (z_pos = [thickness + (hypotenuse / 2) + (hole_spacing * 1.5) : hypotenuse + hole_spacing : height - thickness - (hypotenuse / 2)]) {
for (x_pos = [thickness + hypotenuse + (hole_gap_alt / 2): hole_gap_alt + hypotenuse : base_width - thickness - (hypotenuse / 2) - (hole_gap / 2)]) {
translate([-1, x_pos, z_pos])
rotate([45, 0, 0])
color("blue")
cube([thickness + 2, hole_size, hole_size]);
}
}
}
module draw_holes() {
length_cubes();
translate([0, base_width - thickness, 0])
length_cubes();
width_cubes();
translate([base_length - thickness, 0, 0])
width_cubes();
}
difference() {
cube([base_length, base_width, height]);
translate([thickness, thickness, thickness])
cube([base_length - (thickness * 2), base_width - (thickness * 2), height]);
if (do_difference) {
draw_holes();
}
}
if (!do_difference) {
draw_holes();
}