Commit | Line | Data |
---|---|---|
1ab13332 DR |
1 | include <configuration.scad> |
2 | ||
3 | module boltTrack(width, length, height) { | |
4 | hwidth = width / 2; | |
5 | hdiff = hwidth - height; | |
6 | union() { | |
7 | difference() { | |
8 | rotate([90, 0, 0]) | |
9 | translate([hwidth, height, -length]) | |
10 | cylinder(h=length, r=hwidth, $fn=12); | |
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 | ||
21 | ||
22 | module yrodbracket(lip_thickness, lip_length) { | |
23 | innerRadius = threaded_rod_diameter / 2; | |
24 | outerRadius = innerRadius + lip_thickness; | |
25 | r_head = 3.5; // FIXME: stolen from screw() in inc/functions.scad | |
26 | r_screw = 2; | |
27 | screw_margin = r_head + 2; | |
28 | holeOuterDiameter = r_screw + screw_margin * 2; | |
29 | holeCenter = holeOuterDiameter / 2; | |
30 | width = threaded_rod_diameter + holeOuterDiameter * 2; | |
31 | middle = width / 2; | |
32 | height = outerRadius + innerRadius; | |
33 | ||
34 | depth = holeOuterDiameter * 2 + lip_thickness; | |
35 | ||
36 | function pythag(a, b) = sqrt(a * a + b * b); | |
37 | function bevelradius(x, y, bevel) = pythag(x, y) - bevel * max(x, y) / min(x, y); | |
38 | ||
39 | xzbevel = bevelradius(width, board_thickness, 2.0); | |
40 | yzbevel = bevelradius(depth, board_thickness, 2.0); | |
41 | difference() { | |
42 | union() { | |
43 | intersection() { | |
44 | cube([width, depth, board_thickness]); | |
45 | translate([width / 2, depth / 2, board_thickness / 2]) | |
46 | rotate([0, 45, 0]) | |
47 | cube([xzbevel, depth, xzbevel], center=true); | |
48 | translate([width / 2, depth / 2, board_thickness / 2]) | |
49 | rotate([45, 0, 0]) | |
50 | cube([width, yzbevel, yzbevel], center=true); | |
51 | ||
52 | } | |
53 | translate([0, 0, -lip_length]) | |
54 | cube([width, lip_thickness, lip_length + lip_thickness]); | |
55 | } | |
56 | translate([holeOuterDiameter, -1, -lip_length - lip_thickness]) | |
57 | boltTrack(threaded_rod_diameter, depth + 2, lip_length + lip_thickness + innerRadius); | |
58 | ||
59 | // screw holes | |
60 | for (x = [holeCenter, width - holeCenter]) { | |
61 | for (y = [lip_thickness + holeCenter, holeOuterDiameter + lip_thickness + holeCenter]) { | |
62 | translate([x, y, board_thickness]) | |
63 | rotate([180, 0, 0]) | |
64 | screw(); | |
65 | } | |
66 | } | |
67 | } | |
68 | } | |
69 | ||
70 | module yrodbracket2(lip_thickness, lip_length) { | |
71 | innerRadius = threaded_rod_diameter / 2; | |
72 | outerRadius = innerRadius + lip_thickness; | |
73 | r_head = 3.5; // FIXME: stolen from screw() in inc/functions.scad | |
74 | r_screw = 2; | |
75 | screw_margin = r_head + 2; | |
76 | holeOuterDiameter = r_screw + screw_margin * 2; | |
77 | holeCenter = holeOuterDiameter / 2; | |
78 | width = threaded_rod_diameter + holeOuterDiameter * 2; | |
79 | middle = width / 2; | |
80 | height = outerRadius + innerRadius; | |
81 | ||
82 | depth = holeOuterDiameter * 2 + lip_thickness; | |
83 | ||
84 | function pythag(a, b) = sqrt(a * a + b * b); | |
85 | function bevelradius(x, y, bevel) = pythag(x, y) - bevel * max(x, y) / min(x, y); | |
86 | ||
87 | xzbevel = bevelradius(width, board_thickness + lip_length, 2.0); | |
88 | yzbevel = bevelradius(depth, board_thickness + lip_length, 2.0); | |
89 | bracket_thickness = board_thickness + lip_length; | |
90 | difference() { | |
91 | union() { | |
92 | intersection() { | |
93 | translate([0, 0, -lip_length]) | |
94 | cube([width, depth, bracket_thickness]); | |
95 | translate([width / 2, depth / 2, bracket_thickness / 2 - lip_length]) | |
96 | rotate([0, 45, 0]) | |
97 | cube([xzbevel, depth, xzbevel], center=true); | |
98 | translate([width / 2, depth / 2, bracket_thickness / 2 - lip_length]) | |
99 | rotate([45, 0, 0]) | |
100 | cube([width, yzbevel, yzbevel], center=true); | |
101 | } | |
102 | } | |
103 | translate([holeOuterDiameter, -1, -lip_length - lip_thickness]) | |
104 | boltTrack(threaded_rod_diameter, depth + 2, lip_length + lip_thickness + innerRadius); | |
105 | ||
106 | translate([-1, lip_thickness, -lip_length - 1]) | |
107 | cube([width + 2, depth, lip_length + 1]); | |
108 | ||
109 | // screw holes | |
110 | for (x = [holeCenter, width - holeCenter]) { | |
111 | for (y = [lip_thickness + holeCenter, holeOuterDiameter + lip_thickness + holeCenter]) { | |
112 | translate([x, y, board_thickness]) | |
113 | rotate([180, 0, 0]) | |
114 | screw(); | |
115 | } | |
116 | } | |
117 | } | |
118 | } | |
119 | ||
120 | translate([-10, 0, 0]) | |
121 | color("blue") | |
122 | cube([1, 1, board_thickness]); // xxx: ruler | |
123 | translate([-9, 0, 0]) | |
124 | color("Red") | |
125 | cube([1, 1, threaded_rod_diameter]); // xxx: ruler | |
126 | ||
127 | yrodbracket2(3, 3); | |
128 | //rotate([90, 0, 0]) | |
129 | //translate([3.5 + 6 + 3 + threaded_rod_diameter / 2, threaded_rod_diameter / 2, -50]) | |
130 | //# cylinder(r=threaded_rod_diameter / 2, h=100); |