forked from SensorsIot/Project-Box-Templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
roundbox.scad
58 lines (48 loc) · 1.55 KB
/
roundbox.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
// Qick and dirty example for a simple box with lid
//
// set box parameters
box_length = 35;
box_width = 20;
box_height = 10;
box_corner_radius = 5;
box_wall_thickness = 1;
$fn=200;
box_and_lid(box_length, box_width, box_height, box_corner_radius, box_wall_thickness);
module box_and_lid(length, width, height, cornerRadius, thick){
box(length, width, height, cornerRadius, thick);
lid(length, width, height, cornerRadius, thick);
}
module box(length, width, height, cornerRadius, thick){
difference() {
roundBox(length+2*thick, width+2*thick, height, cornerRadius);
translate([thick,thick,thick]) {
roundBox(length, width, height, cornerRadius);
}
}
}
module lid(length, width, height, cornerRadius, thick){
translate([width*2, 0, 0]){
union() {
roundBox(length+2*thick, width+2*thick, thick, cornerRadius);
difference(){
difference() {
translate([thick,thick,0]) {
roundBox(length,width,2*thick,cornerRadius);
}
translate([2*thick,2*thick,0]) {
roundBox(length-2*thick,width-2*thick,2*thick,cornerRadius);
}
}
}
}
}
}
module roundBox(length, width, height, radius)
{
Rad = 2*radius;
//base rounded shape
minkowski() {
cube(size=[width-Rad,length-Rad, height]);
cylinder(r=radius, h=0.01);
}
}