summaryrefslogtreecommitdiff
path: root/lampenhalter.scad
blob: ade368e5c151a431f4350ac3baa8b44b5bbef402 (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
t = 50;
w = 20;
wi = 15;
h = 5;
d = 1;

aw = 4;
at = 5;
ad = 2;

cr = 2;

support_fraction = 0.5;

module round_corner(r, h) {
  translate([-r, -r, 0])
  difference() {
    cube([r, r, h]);
    cylinder(h=h, r=r, $fn=50);
  }
}

module side() {
  w2 = (w-wi)/2;
  s = support_fraction * (w2 - d);
  translate([0, t, 0])
    rotate([90, 0, 0])
      linear_extrude(height = t, convexity=2)
        polygon([[0,0], [0,h], [w2,h], [w2,h-d+s], [d,h-d], [d,0]]);
}

difference() {
  union() {
    // base plate
    cube([w, t, d]);

    // back
    cube([w, d, h]);

    // sides and top
    side();
    translate([w, 0, 0]) mirror() side();
  }
  union() {
    // retainer hole
    translate([(w-aw)/2, t-at-ad, 0]) cube([aw, at, 2*d]);

    // round vertical corners
    translate([0, 0, 0]) rotate(a=180) round_corner(r=cr, h=h);
    translate([w, 0, 0]) rotate(a=270) round_corner(r=cr, h=h);
    translate([w, t, 0]) rotate(a=0  ) round_corner(r=cr, h=h);
    translate([0, t, 0]) rotate(a=90 ) round_corner(r=cr, h=h);
  }
}
contact: Jan Huwald // Impressum