summaryrefslogtreecommitdiff
path: root/soap-box.scad
blob: e706347d616a079a6d3b40bd0fb3147a6eacd64f (plain)
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
wall_thickness_mm=3;
length_mm=120;
width_mm=80;
height_mm=30;
net_slack_pc=15;
net_thickness_mm=0.5;
peg_diam_mm=2;
slot_tolerance=0.05;
peg_hole_tolerance=0.5;
notch_bump=0.7;
 
module notched_wall(x,y,z,side) {
  module bump() {
    cylinder(r=notch_bump,h=z*1.2$fs=0.1$fn=0);
  }
  bump_indent_r=notch_bump+slot_tolerance*2;
  module bump_indent() {
    rotate([0,90,0]) cylinder(r=bump_indent_r,h=z+slot_tolerance$fs=0.1$fn=0);
  }
  module notch() {
    translate ([-slot_tolerance,side*(y/2-slot_tolerance),-z/2])
      difference() {
      cube ([z+slot_tolerance*2,y,z*2]);
      translate ([0,y/2-side*(notch_bump/2-slot_tolerance),z*0.4]) bump();
      translate ([z,y/2-side*(notch_bump/2-slot_tolerance),z*0.4]) bump();
    }
  }
 
  bump_y=side>0 ? bump_indent_r/2 : y-bump_indent_r/2;
 
  difference() {
    cube ([x,y,z]);
    translate ([x/2,0,-z/2])
      scale ([(x-z*5)/2,y/2,1])
      cylinder(r=1,h=z*2$fs=0.1$fn=0);
 
    translate ([z,0,0]) notch();
    translate ([x-z*2,0,0]) notch();
 
    translate ([zbump_y0]) bump_indent();
    translate ([zbump_yz]) bump_indent();
 
    translate ([x-z*2bump_y0]) bump_indent();
    translate ([x-z*2bump_yz]) bump_indent();
}
}
 
module wall_NS() {
  module peg_slot() {
    size=peg_diam_mm+peg_hole_tolerance;
    translate([0,0,-wall_thickness_mm/2]) union() {
      cylinder(
               d=size,
               h=wall_thickness_mm*2,
               $fs=0.1$fn=0
               );
      translate([-size/2,0,0]) cube([size,100,wall_thickness_mm*2]);
    }
  }
  difference() {
    notched_wall(width_mm,height_mm,wall_thickness_mm,-1);
    translate([wall_thickness_mm*2.1+peg_diam_mm/2,height_mm-wall_thickness_mm,0]) rotate([0,0,-60]) peg_slot();
    translate([width_mm-wall_thickness_mm*2.1-peg_diam_mm/2,height_mm-wall_thickness_mm,0]) rotate([0,0,60]) peg_slot();
  }
}
 
module wall_EW() {
  notched_wall(length_mm,height_mm,wall_thickness_mm,1);
}
 
module soap_net() {
  net_width_mm=(width_mm-wall_thickness_mm*4.2-peg_diam_mm)*(1+net_slack_pc/100);
  net_length_mm=length_mm-wall_thickness_mm*4.2;
 
  module peg() {
    intersection() {
      translate([0,0,peg_diam_mm*0.4])
        rotate([-90,0,0])
        cylinder(
                 d=peg_diam_mm,
                 h=length_mm,
                 $fs=0.1$fn=0
                 );
      // this makes it flat on the bottom
      translate([-peg_diam_mm,-length_mm*0.5,0])
        cube([peg_diam_mm*2,length_mm*2,peg_diam_mm*2]);
    }
  }
  module outside_band() {
    intersection() {
      translate([0,0,peg_diam_mm*0.4])
      rotate ([0,90,0])
        cylinder(
                 d=peg_diam_mm,
                 h=net_width_mm+peg_diam_mm,
                 $fs=0.1$fn=0
                 );
      // this makes it flat on the bottom
      translate([-net_width_mm/2,-peg_diam_mm,0])
        cube([net_width_mm*2,peg_diam_mm*2,peg_diam_mm*2]);
    }
  }
 
  union() {
    cube ([net_width_mm,net_length_mm,net_thickness_mm]);
    translate ([0,-wall_thickness_mm*2,0]) peg();
    translate ([net_width_mm,-wall_thickness_mm*2,0]) peg();
 
    translate ([-peg_diam_mm/2,-wall_thickness_mm*2,0]) outside_band();
    translate ([-peg_diam_mm/2,net_length_mm+wall_thickness_mm*2,0]) outside_band();
  }
}
 
wall_NS();
translate([0,height_mm*1.2,0]) wall_NS();
 
translate ([width_mm*1.2,0,0]) wall_EW();
translate ([width_mm*1.2,height_mm*1.2,0]) wall_EW();
 
translate ([width_mm*2,height_mm*2.7 ,0]) rotate([0,0,90]) soap_net();