forked from nophead/NopSCADlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstrap_handle.scad
More file actions
188 lines (152 loc) · 6.38 KB
/
strap_handle.scad
File metadata and controls
188 lines (152 loc) · 6.38 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
//
// NopSCADlib Copyright Chris Palmer 2018
// nop.head@gmail.com
// hydraraptor.blogspot.com
//
// This file is part of NopSCADlib.
//
// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with NopSCADlib.
// If not, see <https://www.gnu.org/licenses/>.
//
//
//! Retracting strap handle. Print the strap with flexible filament. Shown with default dimensions but can
//! be fully customised by passing a list of properties.
//
include <../core.scad>
use <../vitamins/insert.scad>
strap = [18, 2, M3_pan_screw, 3, 25];
function strap() = strap;
wall = 2;
clearance = 0.5;
step = 0.3;
overlap = 3;
panel_clearance = 0.25;
counterbore = 1;
function strap_width(type = strap) = type[0]; //! Width of strap
function strap_thickness(type = strap) = type[1]; //! Thickness of strap
function strap_screw(type = strap) = type[2]; //! Screw type
function strap_panel(type = strap) = type[3]; //! Panel thickness
function strap_extension(type = strap) = type[4]; //! How much length of the strap that can pull out
function strap_insert(type) = screw_insert(strap_screw(type)); //! The insert type
function strap_key(type) = strap_panel(type) - panel_clearance;
function strap_height(type) = wall + max(insert_length(strap_insert(type)) - strap_key(type), strap_thickness(type) + clearance); //! Height of the ends
function strap_end_width(type = strap) = strap_width(type) + 2 * (wall + clearance); //! Width of the ends
function strap_boss_r(type) = wall + insert_hole_radius(strap_insert(type));
function strap_min_width(type) = (strap_width(type) - 2 * (strap_boss_r(type) + clearance)) / 2;
module strap_boss_shape(type)
hull() {
r = strap_boss_r(type);
circle4n(r);
translate([r / 2, 0])
rounded_square([r, 2 * r], r = 1);
}
module strap_screw_positions(length, type = strap) //! Place children at the screw positions
for(end = [-1, 1])
translate([end * (length / 2 - wall - 2 * clearance - strap_min_width(type) - strap_boss_r(type) - strap_extension(type) / 2), 0])
rotate(end * 90 + 90)
children();
module strap_holes(length, type = strap, h = 100) //! The panel cut outs
extrude_if(h)
strap_screw_positions(length, type)
offset(cnc_bit_r + 0.05)
offset(-step - cnc_bit_r)
strap_boss_shape(type);
module strap(length, type = strap) { //! Generate the STL for the rubber strap
stl("strap");
len = length - 2 * (wall + clearance);
w = strap_width(type);
linear_extrude(height = strap_thickness(type), convexity = 3)
difference() {
rounded_square([len, w], w / 2 - eps);
for(end = [-1, 1])
translate([end * (len / 2 - strap_min_width(type) - strap_boss_r(type) - clearance), 0])
rotate(end * 90 + 90)
hull() {
offset(clearance)
strap_boss_shape(type);
translate([strap_extension(type) / 2, 0])
offset(clearance)
strap_boss_shape(type);
}
}
}
module strap_end(type = strap) { //! Generate the STL for end piece
stl("strap_end");
z1 = strap_height(type) - strap_thickness(type) - clearance;
z2 = strap_height(type) + strap_key(type);
r1 = strap_boss_r(type) - 1;
module outer()
hull() {
translate([0, -strap_end_width(type) / 2])
square([strap_boss_r(type) + overlap, strap_end_width(type)]);
translate([-strap_extension(type) / 2, 0])
circle(d = strap_end_width(type));
}
module with_hole()
difference() {
children();
circle(r1);
}
union() {
linear_extrude(height = z1)
with_hole()
outer();
translate_z(z1)
linear_extrude(height = strap_height(type) - z1)
difference() {
outer();
hull() {
translate([0, -strap_width(type) / 2 - clearance])
square([strap_boss_r(type) + overlap, strap_width(type) + 2 * clearance]);
translate([-strap_extension(type) / 2, 0])
circle(d = strap_width(type) + 2 * clearance);
}
}
linear_extrude(height = strap_height(type) - layer_height)
with_hole()
strap_boss_shape(type);
linear_extrude(height = z2)
with_hole()
offset(cnc_bit_r)
offset(-step - cnc_bit_r)
strap_boss_shape(type);
render() difference() {
cylinder(r = r1 + eps, h = z2);
translate_z(z2)
insert_hole(strap_insert(type), counterbore);
}
}
}
//
//! * Place the insert into the hole and push home with a soldering iron with a tapered bit heated to 200°C.
//
module strap_end_assembly(type = strap)
assembly("strap_end") {
color(pp1_colour)
strap_end(type);
translate_z(strap_height(type) + strap_key(type))
insert(strap_insert(type));
}
module strap_assembly(length, type = strap) { //! Assembly with screws in place
screw = strap_screw(type);
washer = screw_washer(screw);
penny = penny_washer(washer);
insert = strap_insert(type);
screw_length = screw_shorter_than(washer_thickness(washer) + washer_thickness(penny) + insert_length(insert) + panel_clearance + counterbore);
color(pp4_colour) strap(length, type);
strap_screw_positions(length, type)
translate_z(strap_height(type))
vflip() {
explode(-50) strap_end_assembly(type);
translate_z(strap_height(type) + strap_panel(type))
screw_and_washer(screw, screw_length, true, true);
}
}