aboutsummaryrefslogtreecommitdiff
path: root/tabletop_tablet_stand_clamp.scad
blob: b74efd426cb6c47d5538cb4825a6b369b8df1265 (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
module prism(l, w, h) {
  polyhedron(
    points=[
      [0,0,h],           // 0    front top corner
      [0,0,0], [w,0,0],  // 1, 2 front left & right bottom corners
      [0,l,h],           // 3    back top corner
      [0,l,0], [w,l,0]   // 4, 5 back left & right bottom corners
    ],
    faces=[       // points for all faces must be ordered clockwise when looking in
      [0,2,1],    // top face
      [3,4,5],    // base face
      [0,1,4,3],  // h face
      [1,2,5,4],  // w face
      [0,3,5,2],  // hypotenuse face
    ]
  );
}

module reflect(axises) {
  children();
  mirror(axises) children();
}

baseThickness = 3;
baseHeight = 20;
baseWidth = 80;

gapWidth = 30;
clampDepth = 15;
clampHeight = 5;

threadDiameter = 6.5;
threadTubeOuterDiameter = threadDiameter+baseThickness*2;

difference() {
  union() {
    cube([baseThickness, baseWidth, baseHeight]);

    translate([-clampDepth, 0, 0])
      cube([clampDepth, baseWidth, baseThickness+clampHeight]);

    translate([baseThickness, baseWidth/2, 0])
      reflect([0, 1, 0])
        rotate([90, 0, 0])
          prism(baseHeight, threadTubeOuterDiameter-baseThickness, baseWidth/2);

    translate([threadTubeOuterDiameter/2, baseWidth/2, 0])
      cylinder(r = threadTubeOuterDiameter/2, h = baseHeight);
  }

  // thread hole
  translate([threadTubeOuterDiameter/2, baseWidth/2, 0])
    cylinder(r = threadDiameter/2, h = baseHeight);

  // clamp gap
  translate([-clampDepth, (baseWidth-gapWidth)/2, 0])
    cube([clampDepth, gapWidth, clampHeight+baseThickness]);

  // clamp indent
  translate([-clampDepth/2, 0, clampDepth/2+baseThickness])
    rotate([-90, 0, 0])
      cylinder(r = clampDepth/2, h = baseWidth);
}