summaryrefslogtreecommitdiff
path: root/lampenhalter.scad
blob: 1ed01ec909ee7afdb4c4bc641495a9ac13d571b1 (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
// dimension of the outer box: *w*idth, dep*t*h, *h*eight, thickness (d), width of the upper slot (wi)
d = 2.4;
t = 41 + d;
w = 18 + 2*d;
wi = 13.1;
h = 5.1 + d;

// dimension of the retainer hole: *w*idth, dep*t*h, *d*istance to edge
aw = 8.6;
at = 4.1;
ad = t - d - 34.6 - at;

// curve radius of rounded corners
cr = 2;

// inclination of ceiling support structure
support_fraction = 0.2;

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]]);
}

module half() {
  translate([-w/2, 0, 0])
  difference() {
    union() {
      // base plate
      cube([w/2, t, d]);

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

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

      // round vertical corners
      translate([0, 0, 0]) rotate(a=180) round_corner(r=cr, h=h);
      translate([0, t, 0]) rotate(a=90 ) round_corner(r=cr, h=h);

      // shorten rail at opening
      translate([d, t-d, h-d]) cube(d);
    }
  }
}

half();
mirror() half();
contact: Jan Huwald // Impressum