Commit | Line | Data |
---|---|---|
1ab13332 DR |
1 | include <configuration.scad> |
2 | ||
5b158621 | 3 | module bolt_track(width, length, height) { |
1ab13332 DR |
4 | hwidth = width / 2; |
5 | hdiff = hwidth - height; | |
6 | union() { | |
7 | difference() { | |
8 | rotate([90, 0, 0]) | |
9 | translate([hwidth, height, -length]) | |
5b158621 | 10 | cylinder(h=length, r=hwidth, $fn=$fn); |
1ab13332 DR |
11 | |
12 | if (height < hwidth) { | |
13 | translate([0, -1, height - hwidth - 1]) | |
14 | cube([width, length + 2, hdiff + 1]); | |
15 | } | |
16 | } | |
17 | cube([width, length, height]); | |
18 | } | |
19 | } | |
20 | ||
5b158621 DR |
21 | function bracket_width(screw_area) = screw_area * 2 + threaded_rod_diameter; |
22 | function bracket_depth(lip_thickness, screw_area) = screw_area * 2 + lip_thickness; | |
23 | function bracket_height(lip_length) = board_thickness + lip_length; | |
1ab13332 | 24 | |
5b158621 | 25 | module beveled_box(size, bevel_size=4) { |
1ab13332 DR |
26 | function pythag(a, b) = sqrt(a * a + b * b); |
27 | function bevelradius(x, y, bevel) = pythag(x, y) - bevel * max(x, y) / min(x, y); | |
28 | ||
5b158621 DR |
29 | xzbevel = bevelradius(size[0], size[2], bevel_size); |
30 | yzbevel = bevelradius(size[1], size[2], bevel_size); | |
31 | intersection() { | |
32 | cube(size); | |
33 | translate([size[0] / 2, size[1] / 2, size[2] / 2]) | |
34 | rotate([0, 45, 0]) | |
35 | cube([xzbevel, size[1], xzbevel], center=true); | |
36 | translate([size[0] / 2, size[1] / 2, size[2] / 2]) | |
37 | rotate([45, 0, 0]) | |
38 | cube([size[0], yzbevel, yzbevel], center=true); | |
1ab13332 DR |
39 | } |
40 | } | |
41 | ||
5b158621 DR |
42 | module yrodbracket(screw_area, lip_thickness, lip_length, bevel_size=2.0) { |
43 | inner_radius = threaded_rod_diameter / 2; | |
44 | screw_center = screw_area / 2; | |
1ab13332 | 45 | |
5b158621 DR |
46 | width = bracket_width(screw_area); |
47 | depth = bracket_depth(lip_thickness, screw_area); | |
48 | height = bracket_height(lip_length); | |
1ab13332 | 49 | |
1ab13332 | 50 | difference() { |
5b158621 DR |
51 | translate([0, 0, -lip_length]) |
52 | beveled_box([width, depth, height], bevel_size); | |
53 | translate([screw_area, -1, -lip_length - lip_thickness]) | |
54 | bolt_track(threaded_rod_diameter, depth + 2, lip_length + lip_thickness + inner_radius); | |
1ab13332 DR |
55 | |
56 | translate([-1, lip_thickness, -lip_length - 1]) | |
57 | cube([width + 2, depth, lip_length + 1]); | |
58 | ||
59 | // screw holes | |
5b158621 DR |
60 | for (x = [screw_center, width - screw_center]) { |
61 | for (y = [lip_thickness + screw_center, screw_area + lip_thickness + screw_center]) { | |
1ab13332 DR |
62 | translate([x, y, board_thickness]) |
63 | rotate([180, 0, 0]) | |
64 | screw(); | |
65 | } | |
66 | } | |
67 | } | |
68 | } | |
69 | ||
5b158621 DR |
70 | rotate([90, 0, 0]) { |
71 | for (x = [0, bracket_width(12) + 5]) { | |
72 | for (y = [0, bracket_height(3) + 5]) { | |
73 | translate([x, 0, y]) | |
74 | yrodbracket(12, 3, 3); | |
75 | } | |
76 | } | |
77 | } |