clarify code by moving nubs into their own modules
[ozzloy@gmail.com/3d-printables] / 3030-dampener-feet.scad
1 /*
2 GNU AGPLv3 (or later at your option)
3 see bottom for more license info.
4 please keep this notice.
5 */
6
7 /*
8 measurements from misumi's 3030 aluminum extrusion data sheet
9 https://us.misumi-ec.com/pdf/fa/2012/p2_0545.pdf
10 */
11
12 //$fn = 30; // use this while editing
13 $fn = 100; // use this for generating STL
14
15 foot_height = 18;
16 foot_length = 20;
17 wall_width = 2;
18 nub_depth = 4;
19 desired_corner_rounding_radius = 2/2.1;
20
21 // rounding radius needs to be just under half the size of the wall_width
22 maximum_corner_rounding_radius = wall_width / 2 - 0.1;
23 corner_rounding_radius =
24 (desired_corner_rounding_radius < maximum_corner_rounding_radius)
25 ?
26 desired_corner_rounding_radius
27 :
28 maximum_corner_rounding_radius;
29
30 // the printed nubs did not fit into the extrusion gap perfectly.
31 // we can change the model just a little bit to accomodate printing
32 // imperfections.
33 fudge = 0.1;
34 //fudge = 0.0;
35
36 // 3030 dimensions
37 x = 30;
38 y = 30;
39 opening_width = 8;
40
41 outer_block = (30 - 16.5) / 2;
42 wall = 2;
43
44 module ring(outer_radius, wall_width) {
45 difference() {
46 circle(outer_radius);
47 circle(outer_radius - wall_width); } }
48
49 module fillet(r) {
50 offset(-r) {
51 offset(r) {
52 children(); } } }
53
54 module round_corners(r) {
55 fillet(r) { fillet(-r) { children(); } } }
56
57 module side_nub() {
58 // side nub, goes into side 3030 openings
59 a = opening_width;
60 b = foot_height + wall_width - (y - opening_width) / 2;
61 side_nub_length = (a < b) ? a : b;
62 translate([0, (y - opening_width) / 2 + fudge]) {
63 square([nub_depth, side_nub_length - fudge]); } }
64
65 module bottom_nub() {
66 // bottom nub, goes into bottom 3030 opening
67 translate([(x - opening_width) / 2, 0]) {
68 square([opening_width / 2, nub_depth]); } }
69
70 module half_foot_2d() {
71 // outer ring
72 difference() {
73 ring(foot_height + wall_width, wall_width);
74 square(foot_height + wall_width);
75 rotate(-45) {
76 square(foot_height + wall_width); } }
77 // upper connector, vertical 3030 holder
78 translate([-wall_width, -wall_width]) {
79 square([wall_width, foot_height + wall_width]); }
80 // upper connecter, horizontal 3030 holder
81 translate([-wall_width, -wall_width]) {
82 square([wall_width + x / 2, wall_width]); }
83 // bottom connector
84 translate([cos(45) * foot_height,
85 -(sin(45) * foot_height + wall_width)]) {
86 square([x / 2 - cos(45) * foot_height, wall_width]); }
87 bottom_nub();
88 side_nub(); }
89
90 module foot_2d() {
91 round_corners(corner_rounding_radius) {
92 translate([-x / 2, 0, 0]) {
93 half_foot_2d(); }
94 translate([x / 2, 0, 0]) {
95 mirror() {
96 half_foot_2d(); } } } }
97
98 module foot() {
99 rotate(a = 0, v = [1, 0, 0]) {
100 linear_extrude(height = foot_length) {
101 foot_2d(); } } }
102
103 // half_foot_2d();
104 // foot_2d();
105 foot();
106
107 /*
108 This file is part of 3d-printables.
109
110 3d-printables is free software: you can redistribute it and/or modify
111 it under the terms of the GNU Affero General Public License as published by
112 the Free Software Foundation, either version 3 of the License, or
113 (at your option) any later version.
114
115 3d-printables is distributed in the hope that it will be useful,
116 but WITHOUT ANY WARRANTY; without even the implied warranty of
117 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
118 GNU Affero General Public License for more details.
119
120 You should have received a copy of the GNU Affero General Public License
121 along with challenge-bot. If not, see <http://www.gnu.org/licenses/>.
122 */