forked from nophead/NopSCADlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdoor_hinge.scad
More file actions
186 lines (153 loc) · 6.82 KB
/
door_hinge.scad
File metadata and controls
186 lines (153 loc) · 6.82 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
//
// 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/>.
//
//
//! Door hinges to hang an acrylic sheet door on a 3D printer, default 6mm thick.
//!
//! The screws are tapped into the acrylic.
//! Rubber door [sealing strip](#sealing_strip) is used to make it airtight and a [door_latch](#door_latch) holds it closed.
//
include <../core.scad>
width = 18;
thickness = 4;
rad = 3;
dia = 12;
pin_screw = M3_cap_screw;
screw = M3_dome_screw;
stat_screw = M4_dome_screw;
stat_width = 15;
stat_length = 34;
stat_clearance = 0.75;
function door_hinge_pin_x() = -dia / 2; //! X offset of the hinge pin
function door_hinge_pin_y() = -dia / 2 - stat_clearance; //! Y offset of the hinge pin
function door_hinge_screw() = screw; //! Screw type used for hinge pin
function door_hinge_stat_screw() = stat_screw; //! Screw use to fasten the stationary part
function door_hinge_stat_width() = stat_width; //! Width of the stationary part
function door_hinge_stat_length() = stat_length; //! Length of the stationary part
module door_hinge_hole_positions(dir = 0) { //! Position chidren at the door hole positions
hole_pitch = width - 10;
for(side = [-1, 1])
translate([width / 2 + side * hole_pitch / 2, -dir * width / 2 -side * hole_pitch / 2])
children();
}
module door_hinge(door_thickness) { //! Generates STL for the moving part of the hinge
stl(str("door_hinge_", door_thickness));
hole_pitch = width - 10;
union() {
rotate([90, 0, 0])
linear_extrude(height = width, center = true)
difference() {
hull() {
translate([dia / 2, thickness + door_thickness / 2])
intersection() {
rotate(180)
teardrop(r = dia / 2, h = 0, truncate = false);
square([dia + 1, 2 * thickness + door_thickness], center = true);
}
square([1, thickness + door_thickness]);
}
translate([dia / 2, thickness + door_thickness / 2])
teardrop(r = screw_clearance_radius(pin_screw), h = 0);
}
linear_extrude(height = thickness)
difference() {
hull() {
translate([0, -width / 2])
square([1, width]);
for(side = [-1, 1])
translate([-width + rad, side * (width / 2 - rad)])
circle4n(rad);
}
rotate(180)
vflip()
door_hinge_hole_positions()
poly_circle(screw_clearance_radius(screw));
}
}
}
module door_hinge_6_stl() door_hinge(6);
module door_hinge_stat_hole_positions(dir = 0) { //! Position children over the screws holes of the stationary part
hole_pitch = dia + (stat_length - dia) / 2;
for(side = [-1, 1])
translate([side * hole_pitch / 2, dir * (stat_width / 2 + washer_thickness(screw_washer(pin_screw))), thickness])
children();
}
module door_hinge_stat_stl() { //! Generates the STL for the stationary part
stl("door_hinge_stat");
union() {
linear_extrude(height = thickness)
difference() {
rounded_square([stat_length, stat_width], rad);
door_hinge_stat_hole_positions()
poly_circle(screw_clearance_radius(stat_screw));
}
rotate([90, 0, 0])
linear_extrude(height = stat_width, center = true)
difference() {
hull() {
translate([0, dia / 2 + stat_clearance])
circle(d = dia);
translate([0, 0.5])
square([dia, 1], center = true);
}
translate([0, dia / 2 + stat_clearance])
teardrop(r = screw_clearance_radius(pin_screw), h = 0);
}
}
}
module door_hinge_assembly(top, door_thickness = 6) { //! The moving assembly that goes on the door
dir = top ? -1 : 1;
pin_x = door_hinge_pin_x();
pin_y = door_hinge_pin_y();
washer = screw_washer(screw);
screw_length = screw_shorter_than(thickness + door_thickness + washer_thickness(washer));
translate([0, pin_y - (thickness + door_thickness / 2), dir * width / 2]) {
rotate([90, 0, 180])
color(pp2_colour) door_hinge(door_thickness);
rotate([90, 0, 0])
door_hinge_hole_positions()
screw_and_washer(screw, screw_length);
}
translate([pin_x, pin_y, top ? 0 : -washer_thickness(screw_washer(pin_screw))])
washer(screw_washer(pin_screw));
translate([pin_x, pin_y, top ? washer_thickness(screw_washer(pin_screw)) + stat_width : width])
screw_and_washer(pin_screw, screw_longer_than(2 * washer_thickness(screw_washer(pin_screw)) + width + stat_width));
}
module door_hinge_static_assembly(top, sheet_thickness = 3) { //! The stationary assembly
dir = top ? -1 : 1;
pin_x = door_hinge_pin_x();
stat_washer = screw_washer(stat_screw);
stat_nut = screw_nut(stat_screw);
stat_screw_length = screw_longer_than(thickness + sheet_thickness + 2 * washer_thickness(stat_washer) + nut_thickness(stat_nut, true));
translate([pin_x, 0, -dir * (stat_width / 2 + washer_thickness(screw_washer(pin_screw)))])
rotate([90, 0, 0]) {
color(pp1_colour) door_hinge_stat_stl();
door_hinge_stat_hole_positions() {
screw_and_washer(stat_screw, stat_screw_length);
translate_z(-thickness - sheet_thickness)
vflip()
nut_and_washer(stat_nut, true);
}
}
}
module door_hinge_parts_stl() { //! Generates the STL for both parts of the hinge
translate([2, width / 2 + 1])
door_hinge_6_stl();
translate([0, -stat_width / 2 - 1])
door_hinge_stat_stl();
}