clarify code by moving nubs into their own modules
[ozzloy@gmail.com/3d-printables] / 3030-dampener-feet.scad
CommitLineData
ea7617aa 1/*
2 GNU AGPLv3 (or later at your option)
14f68eaf 3 see bottom for more license info.
ea7617aa 4 please keep this notice.
5*/
14f68eaf 6
ea7617aa 7/*
8 measurements from misumi's 3030 aluminum extrusion data sheet
9 https://us.misumi-ec.com/pdf/fa/2012/p2_0545.pdf
10*/
14f68eaf 11
12//$fn = 30; // use this while editing
13$fn = 100; // use this for generating STL
14
15foot_height = 18;
16foot_length = 20;
17wall_width = 2;
23bbb57b 18nub_depth = 4;
0cb1eaa0 19desired_corner_rounding_radius = 2/2.1;
20
21// rounding radius needs to be just under half the size of the wall_width
22maximum_corner_rounding_radius = wall_width / 2 - 0.1;
23corner_rounding_radius =
24 (desired_corner_rounding_radius < maximum_corner_rounding_radius)
25 ?
26 desired_corner_rounding_radius
27 :
28 maximum_corner_rounding_radius;
23bbb57b 29
293dbe2d 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.
23bbb57b 33fudge = 0.1;
34//fudge = 0.0;
14f68eaf 35
36// 3030 dimensions
293dbe2d 37x = 30;
38y = 30;
14f68eaf 39opening_width = 8;
40
41outer_block = (30 - 16.5) / 2;
42wall = 2;
43
44module ring(outer_radius, wall_width) {
45 difference() {
46 circle(outer_radius);
47 circle(outer_radius - wall_width); } }
48
49module fillet(r) {
50 offset(-r) {
51 offset(r) {
52 children(); } } }
53
54module round_corners(r) {
55 fillet(r) { fillet(-r) { children(); } } }
56
293dbe2d 57module 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
65module 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
14f68eaf 70module 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]); }
293dbe2d 87 bottom_nub();
88 side_nub(); }
14f68eaf 89
90module foot_2d() {
0cb1eaa0 91 round_corners(corner_rounding_radius) {
14f68eaf 92 translate([-x / 2, 0, 0]) {
93 half_foot_2d(); }
94 translate([x / 2, 0, 0]) {
95 mirror() {
96 half_foot_2d(); } } } }
97
98module 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();
105foot();
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*/