-
Notifications
You must be signed in to change notification settings - Fork 0
/
dividedbox.scad
139 lines (116 loc) · 3.69 KB
/
dividedbox.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
include <plywood.scad>;
module vanecutter(length, material, count,edge, offset = 0) {
margin = 0.03;
jump = 0;
step = (length - offset) / (count*2+1);
for ( i = [0 : count-edge] ) {
if ( edge == 0 ) {
translate([ jump * (step - offset) + i * (step+offset) - margin, -0.005,0]) {
cube([step + margin*2 + offset,material+0.01,material+0.01]);
}
jump = i;
}
if ( edge == 1 ) {
jump = i+1;
translate([ jump * (step + offset) + i * (step-offset) - margin, -0.005,0]) {
cube([step + margin*2 - offset,material+0.01,material+0.01]);
}
}
}
}
module side(width, height, cuts, sidecut = 0, material = 4.2) {
difference() {
plywoodcube(width,height,-1,sidecut,1,sidecut);
for ( i = [0:cuts-2] ) {
translate([(i-(cuts/2-1))*(width-material)/cuts,0,0]) {
difference() {
translate([4.2/2, -height/2,-0.01])
rotate(90,[0,0,1])
vanecutter(height, 4.3, 1, 0, offset=-9);
}
}
}
}
}
module box(width = 391, height = 55, depth=331, cutw=4, cutd = 2, material = 4.2, spread=0) {
translate([spread * depth/2 + spread*10,0,0])
rotate(spread * 90, [0,1,0])
translate([-depth/2,0,width/2]) {
rotate(90, [0,1,0]) {
translate([0,spread * height + spread*10,depth-material])
side(width,height,cutw, material = material);
side(width,height,cutw, material = material);
}
}
for ( i = [1:cutw-1] ) {
translate([0,spread * i * (height +10), (i) * (width-material) / cutw]){
difference() {
plywoodcube(depth, height, [0,0,0,0]);
translate([-depth/2 + material,-height/2, -0.01])
rotate(90,[0,0,1])
vanecutter(height, 4.3,1,1, offset=-9);
translate([depth/2,-height/2, -0.01])
rotate(90,[0,0,1])
vanecutter(height, 4.3,1,1, offset=-9);
for( i = [1:cutd-1] ) {
translate([-depth / 2 + i*((depth-material)/cutd),-height / 2,-0.04]) {
cube([material,height/2,material + 0.1]);
}
}
translate([-depth/2,-height/2,0])
vanecutter(depth, material + 0.1, 5,1, offset=-depth/22);
}
}
}
side(depth,height,cutd,sidecut=1, material = material);
translate([0,spread * cutw * (height + 10),width-material])
side(depth,height,cutd,sidecut=1, material = material);
rotate(spread * 90, [0,1,0])
for ( i = [1:cutd-1] ) {
translate([0 - depth/2 + i * (depth-material)/cutd ,spread * (i+1)*(height + 10),width/2 + spread * depth/2 + spread * 10]){
rotate(90,[0,1,0])
difference() {
plywoodcube(width, height, [0,0,0,0]);
translate([-width/2 + material,-height/2, -0.01])
rotate(90,[0,0,1])
vanecutter(height, 4.3,1,1, offset=-9);
translate([width/2,-height/2, -0.01])
rotate(90,[0,0,1])
vanecutter(height, 4.3,1,1, offset=-9);
for( i = [1:cutw-1] ) {
translate([-width / 2 + i*(width - material)/cutw ,0,-0.04]) {
cube([material,height/2,material + 0.1]);
}
}
translate([-width/2,-height/2,0])
vanecutter(width, material + 0.1, 5,1, offset=-width/22);
}
}
}
translate([0,-(height+10)*spread,0])
rotate(spread * 90, [1,0,0])
translate([0, -height/2 + material,width/2])
difference() {
rotate(90, [0,1,0])
rotate(90, [1,0,0])
plywoodcube(width, depth, 0,0,0,0);
translate([-depth/2,-material, 0]) {
for( i = [1:cutw-1] ) {
translate([0,0,-width / 2 + i * (width-material)/cutw])
vanecutter(depth, material + 0.1, 5,0, offset=-width/22);
}
for( i = [1:cutd-1] ) {
translate([ i * (depth-material)/cutd,0,width/2])
rotate(90,[0,1,0])
vanecutter(width, material + 0.1, 5,0, offset=-width/22);
}
}
}
}
p = 0;
if ( p == 1 ) {
projection()
box(width = 391, height = 55, depth=331, cutw=3, cutd=3, spread=p);
} else {
box(width = 391, height = 55, depth=331, cutw=3, cutd=3, spread=p);
}