Added parametric printed hinges.

This commit is contained in:
Chris Palmer 2019-07-19 10:30:02 +01:00
parent d068b972ff
commit 3a5e027bbb
5 changed files with 311 additions and 9 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 696 KiB

After

Width:  |  Height:  |  Size: 702 KiB

View File

@ -88,6 +88,7 @@ use <tests/socket_box.scad>
use <tests/strap_handle.scad> use <tests/strap_handle.scad>
use <tests/ssr_shroud.scad> use <tests/ssr_shroud.scad>
use <tests/psu_shroud.scad> use <tests/psu_shroud.scad>
use <tests/flat_hinge.scad>
x5 = 800; x5 = 800;
@ -114,6 +115,9 @@ translate([x5 + 70, cable_grommets_y + 150])
translate([x5, cable_grommets_y + 470]) { translate([x5, cable_grommets_y + 470]) {
door_hinges() door_hinges()
door_latches(); door_latches();
translate([120, 0])
flat_hinges();
} }
translate([x5, cable_grommets_y + 370]) translate([x5, cable_grommets_y + 370])

180
printed/flat_hinge.scad Normal file
View File

@ -0,0 +1,180 @@
//
// 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/>.
//
//
//! A parametric flat hinge. A piece of filament can be used for the hinge pin.
//!
//! The width, depth, thickness, number and type of screws, number of knuckles, knuckle diameter, pin diameter and clearance can all be varied.
//! A margin between the screws and the knuckle edge can be enforced to allow the hinge to bend all the way back to 270&deg; from closed.
//!
//! Opening the test in OpenSCAD with its customiser enabled allows these parameters to be played with.
//!
//! Note setting ```thickness1``` or ```thickness2``` to zero in the ```hinge_fastened_assembly()``` removes the screws from one side or the other and
//! setting ```show_hinge``` to false removes the hinge.
//! This allows the hinges and one set of screws to belong to one assembly and the other set of screws to another assembly.
//
include <../core.scad>
include <../vitamins/screws.scad>
function hinge_width(type) = type[1]; //! Width
function hinge_depth(type) = type[2]; //! Depth of each leaf
function hinge_thickness(type) = type[3]; //! Thickness of the leaves
function hinge_pin_dia(type) = type[4]; //! The pin diameter
function hinge_knuckle_dia(type) = type[5]; //! The knuckle diameter
function hinge_knuckles(type) = type[6]; //! How many knuckles
function hinge_screw(type) = type[7]; //! Screw type to mount it
function hinge_screws(type) = type[8]; //! How many screws
function hinge_clearance(type) = type[9]; //! Clearance between knuckles
function hinge_margin(type) = type[10]; //! How far to keep the screws from the knuckes
function hinge_radius(type) = washer_radius(screw_washer(hinge_screw(type))) + 1;
module hinge_screw_positions(type) { //! Place children at the screw positions
screws = hinge_screws(type);
w = hinge_width(type);
d = hinge_depth(type);
r = hinge_radius(type);
m = hinge_margin(type);
assert(screws > 1, "must be at least two screws");
w_pitch = (w - 2 * r) / (screws - 1);
d_pitch = d - 2 * r - m;
wr = washer_radius(screw_washer(hinge_screw(type)));
assert(w_pitch >= wr && norm([w_pitch, d_pitch]) >= 2 * wr && d_pitch >= 0, "not enough room for screws");
for(i = [0 : screws - 1])
translate([-w / 2 + r + i * w_pitch, r + m + (i % 2) * d_pitch])
children();
}
module hinge_male(type, female = false) { //! The half with the stationary pin
stl(str("hinge_", female ? "fe": "", "male_", type[0]));
r = hinge_radius(type);
w = hinge_width(type);
t = hinge_thickness(type);
kr = hinge_knuckle_dia(type) / 2;
pr = hinge_pin_dia(type) / 2;
assert(kr > pr, "knuckle diameter must be bigger than the pin diameter");
n = hinge_knuckles(type);
assert(n >= 3, "must be at least three knuckes");
mn = ceil(n / 2); // Male knuckles
fn = floor(n / 2); // Female knuckles
gap = hinge_clearance(type);
mw = (w - (n - 1) * gap) / 2 / mn; // Male knuckle width
fw = (w - (n - 1) * gap) / 2 / fn; // Female knuckle width
teardrop_r = kr / cos(22.5); // The corner on the teardrop
inset = sqrt(sqr(teardrop_r + gap) - sqr(kr - t)) - kr;
linear_extrude(height =t)
difference() {
hull() {
for(side = [-1, 1])
translate([side * (w / 2 - r), hinge_depth(type) - r])
circle4n(r);
translate([-w / 2, inset])
square([w, eps]);
}
hinge_screw_positions(type)
poly_circle(screw_clearance_radius(hinge_screw(type)));
}
pitch = mw + gap + fw + gap;
dir = female ? -1 : 1;
translate([0, -kr, kr])
rotate([90, 0, -90])
for(z = [0 : (female ? fn : mn) - 1])
translate_z(-dir * w / 2 + z * dir * pitch + (female ? -fw - mw - gap : 0))
linear_extrude(height = female ? fw : mw)
difference() {
hull() {
rotate(180)
teardrop(r = kr, h = 0);
translate([-kr - 1, -kr])
square(1);
}
teardrop_plus(r = pr + (female ? gap : 0), h = 0);
}
}
module hinge_female(type) hinge_male(type, true);
module hinge_both(type) { //! Both parts together for printing
hinge_male(type);
translate([0, -hinge_knuckle_dia(type)])
rotate(180)
hinge_female(type);
}
module hinge_assembly(type, angle = 0)
assembly(str("hinge_", type[0])) { //! Assembled hinge
kr = hinge_knuckle_dia(type) / 2;
hr = hinge_pin_dia(type) / 2;
w = hinge_width(type);
vitamin(str(": Hinge pin ", w, " x ", 2 * hr, "mm"));
color(pp1_colour) hinge_male(type);
translate([0, -kr, kr]) {
rotate([0, 90, 0])
explode(w + 10)
color("silver") cylinder(r = hr , h = w, center = true);
rotate([-angle, 0, 0])
translate([0, -kr, -kr])
rotate(180)
color(pp2_colour) hinge_female(type);
}
}
module hinge_fastened_assembly(type, thickness1, thickness2, angle, show_hinge = true) { //! Assembled hinge with its fasteners
if(show_hinge)
hinge_assembly(type, angle);
screw = hinge_screw(type);
washer_t = 2 * washer_thickness(screw_washer(screw));
nut = screw_nut(screw);
nut_t = nut_thickness(nut, true);
t = hinge_thickness(type);
kr = hinge_knuckle_dia(type) / 2;
module fasteners(thickness)
if(thickness)
hinge_screw_positions(type) {
translate_z(t)
screw_and_washer(screw, screw_longer_than(t + thickness + washer_t + nut_t));
translate_z(-thickness)
vflip()
nut_and_washer(nut, true);
}
fasteners(thickness1);
translate([0, -kr, kr])
rotate([-angle, 0, 0])
translate([0, -kr, - kr])
rotate(180)
fasteners(thickness2);
}

View File

@ -27,15 +27,15 @@ See [usage](docs/usage.md) for requirements, installation instructions and a usa
<tr><td> <a href = "#Cable_strips">Cable_strips</a> </td><td> <a href = "#Pulleys">Pulleys</a> </td><td> <a href = "#Door_latch">Door_latch</a> </td><td> <a href = "#Maths">Maths</a> </td><td> <a href = "#Teardrops">Teardrops</a> </td></tr> <tr><td> <a href = "#Cable_strips">Cable_strips</a> </td><td> <a href = "#Pulleys">Pulleys</a> </td><td> <a href = "#Door_latch">Door_latch</a> </td><td> <a href = "#Maths">Maths</a> </td><td> <a href = "#Teardrops">Teardrops</a> </td></tr>
<tr><td> <a href = "#Components">Components</a> </td><td> <a href = "#Rails">Rails</a> </td><td> <a href = "#Fan_guard">Fan_guard</a> </td><td> <a href = "#Offset">Offset</a> </td><td></td></tr> <tr><td> <a href = "#Components">Components</a> </td><td> <a href = "#Rails">Rails</a> </td><td> <a href = "#Fan_guard">Fan_guard</a> </td><td> <a href = "#Offset">Offset</a> </td><td></td></tr>
<tr><td> <a href = "#Displays">Displays</a> </td><td> <a href = "#Ring_terminals">Ring_terminals</a> </td><td> <a href = "#Fixing_block">Fixing_block</a> </td><td> <a href = "#Quadrant">Quadrant</a> </td><td></td></tr> <tr><td> <a href = "#Displays">Displays</a> </td><td> <a href = "#Ring_terminals">Ring_terminals</a> </td><td> <a href = "#Fixing_block">Fixing_block</a> </td><td> <a href = "#Quadrant">Quadrant</a> </td><td></td></tr>
<tr><td> <a href = "#D_connectors">D_connectors</a> </td><td> <a href = "#Rockers">Rockers</a> </td><td> <a href = "#Foot">Foot</a> </td><td> <a href = "#Round">Round</a> </td><td></td></tr> <tr><td> <a href = "#D_connectors">D_connectors</a> </td><td> <a href = "#Rockers">Rockers</a> </td><td> <a href = "#Flat_hinge">Flat_hinge</a> </td><td> <a href = "#Round">Round</a> </td><td></td></tr>
<tr><td> <a href = "#Fans">Fans</a> </td><td> <a href = "#Rod">Rod</a> </td><td> <a href = "#Handle">Handle</a> </td><td> <a href = "#Rounded_cylinder">Rounded_cylinder</a> </td><td></td></tr> <tr><td> <a href = "#Fans">Fans</a> </td><td> <a href = "#Rod">Rod</a> </td><td> <a href = "#Foot">Foot</a> </td><td> <a href = "#Rounded_cylinder">Rounded_cylinder</a> </td><td></td></tr>
<tr><td> <a href = "#Fuseholder">Fuseholder</a> </td><td> <a href = "#Screws">Screws</a> </td><td> <a href = "#Psu_shroud">Psu_shroud</a> </td><td> <a href = "#Rounded_polygon">Rounded_polygon</a> </td><td></td></tr> <tr><td> <a href = "#Fuseholder">Fuseholder</a> </td><td> <a href = "#Screws">Screws</a> </td><td> <a href = "#Handle">Handle</a> </td><td> <a href = "#Rounded_polygon">Rounded_polygon</a> </td><td></td></tr>
<tr><td> <a href = "#Green_terminals">Green_terminals</a> </td><td> <a href = "#Sealing_strip">Sealing_strip</a> </td><td> <a href = "#Ribbon_clamp">Ribbon_clamp</a> </td><td> <a href = "#Sector">Sector</a> </td><td></td></tr> <tr><td> <a href = "#Green_terminals">Green_terminals</a> </td><td> <a href = "#Sealing_strip">Sealing_strip</a> </td><td> <a href = "#Psu_shroud">Psu_shroud</a> </td><td> <a href = "#Sector">Sector</a> </td><td></td></tr>
<tr><td> <a href = "#Hot_ends">Hot_ends</a> </td><td> <a href = "#Sheets">Sheets</a> </td><td> <a href = "#Screw_knob">Screw_knob</a> </td><td> <a href = "#Sweep">Sweep</a> </td><td></td></tr> <tr><td> <a href = "#Hot_ends">Hot_ends</a> </td><td> <a href = "#Sheets">Sheets</a> </td><td> <a href = "#Ribbon_clamp">Ribbon_clamp</a> </td><td> <a href = "#Sweep">Sweep</a> </td><td></td></tr>
<tr><td> <a href = "#Iecs">Iecs</a> </td><td> <a href = "#Spades">Spades</a> </td><td> <a href = "#Socket_box">Socket_box</a> </td><td> <a href = "#Tube">Tube</a> </td><td></td></tr> <tr><td> <a href = "#Iecs">Iecs</a> </td><td> <a href = "#Spades">Spades</a> </td><td> <a href = "#Screw_knob">Screw_knob</a> </td><td> <a href = "#Tube">Tube</a> </td><td></td></tr>
<tr><td> <a href = "#Inserts">Inserts</a> </td><td> <a href = "#Spools">Spools</a> </td><td> <a href = "#Ssr_shroud">Ssr_shroud</a> </td><td></td><td></td></tr> <tr><td> <a href = "#Inserts">Inserts</a> </td><td> <a href = "#Spools">Spools</a> </td><td> <a href = "#Socket_box">Socket_box</a> </td><td></td><td></td></tr>
<tr><td> <a href = "#Jack">Jack</a> </td><td> <a href = "#Springs">Springs</a> </td><td> <a href = "#Strap_handle">Strap_handle</a> </td><td></td><td></td></tr> <tr><td> <a href = "#Jack">Jack</a> </td><td> <a href = "#Springs">Springs</a> </td><td> <a href = "#Ssr_shroud">Ssr_shroud</a> </td><td></td><td></td></tr>
<tr><td> <a href = "#Leadnuts">Leadnuts</a> </td><td> <a href = "#Ssrs">Ssrs</a> </td><td></td><td></td><td></td></tr> <tr><td> <a href = "#Leadnuts">Leadnuts</a> </td><td> <a href = "#Ssrs">Ssrs</a> </td><td> <a href = "#Strap_handle">Strap_handle</a> </td><td></td><td></td></tr>
<tr><td> <a href = "#Leds">Leds</a> </td><td> <a href = "#Stepper_motors">Stepper_motors</a> </td><td></td><td></td><td></td></tr> <tr><td> <a href = "#Leds">Leds</a> </td><td> <a href = "#Stepper_motors">Stepper_motors</a> </td><td></td><td></td><td></td></tr>
<tr><td> <a href = "#Light_strips">Light_strips</a> </td><td> <a href = "#Toggles">Toggles</a> </td><td></td><td></td><td></td></tr> <tr><td> <a href = "#Light_strips">Light_strips</a> </td><td> <a href = "#Toggles">Toggles</a> </td><td></td><td></td><td></td></tr>
<tr><td> <a href = "#Linear_bearings">Linear_bearings</a> </td><td> <a href = "#Transformers">Transformers</a> </td><td></td><td></td><td></td></tr> <tr><td> <a href = "#Linear_bearings">Linear_bearings</a> </td><td> <a href = "#Transformers">Transformers</a> </td><td></td><td></td><td></td></tr>
@ -3475,6 +3475,76 @@ Note that the block with its inserts is defined as a sub assembly, but its faste
| 1 | fixing_block_M40_assembly | | 1 | fixing_block_M40_assembly |
<a href="#top">Top</a>
---
<a name="Flat_hinge"></a>
## Flat_hinge
A parametric flat hinge. A piece of filament can be used for the hinge pin.
The width, depth, thickness, number and type of screws, number of knuckles, knuckle diameter, pin diameter and clearance can all be varied.
A margin between the screws and the knuckle edge can be enforced to allow the hinge to bend all the way back to 270&deg; from closed.
Opening the test in OpenSCAD with its customiser enabled allows these parameters to be played with.
Note setting ```thickness1``` or ```thickness2``` to zero in the ```hinge_fastened_assembly()``` removes the screws from one side or the other and
setting ```show_hinge``` to false removes the hinge.
This allows the hinges and one set of screws to belong to one assembly and the other set of screws to another assembly.
[printed/flat_hinge.scad](printed/flat_hinge.scad) Implementation.
[tests/flat_hinge.scad](tests/flat_hinge.scad) Code for this example.
### Properties
| Function | Description |
|:--- |:--- |
| ```hinge_clearance(type)``` | Clearance between knuckles |
| ```hinge_depth(type)``` | Depth of each leaf |
| ```hinge_knuckle_dia(type)``` | The knuckle diameter |
| ```hinge_knuckles(type)``` | How many knuckles |
| ```hinge_margin(type)``` | How far to keep the screws from the knuckes |
| ```hinge_pin_dia(type)``` | The pin diameter |
| ```hinge_screw(type)``` | Screw type to mount it |
| ```hinge_screws(type)``` | How many screws |
| ```hinge_thickness(type)``` | Thickness of the leaves |
| ```hinge_width(type)``` | Width |
### Modules
| Module | Description |
|:--- |:--- |
| ```hinge_both(type)``` | Both parts together for printing |
| ```hinge_fastened_assembly(type, thickness1, thickness2, angle, show_hinge = true)``` | Assembled hinge with its fasteners |
| ```hinge_male(type, female = false)``` | The half with the stationary pin |
| ```hinge_screw_positions(type)``` | Place children at the screw positions |
![flat_hinge](tests/png/flat_hinge.png)
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 1 | | Hinge pin 20 x 2.85mm |
| 1 | | Hinge pin 50 x 4mm |
| 14 | ```nut(M3_nut, nyloc = true)``` | Nut M3 x 2.4mm nyloc |
| 4 | ```screw(M3_dome_screw, 10)``` | Screw M3 dome x 10mm |
| 10 | ```screw(M3_dome_screw, 12)``` | Screw M3 dome x 12mm |
| 28 | ```washer(M3_washer)``` | Washer M3 x 7mm x 0.5mm |
### Printed
| Qty | Filename |
| ---:|:--- |
| 1 | hinge_female_big.stl |
| 1 | hinge_female_small.stl |
| 1 | hinge_male_big.stl |
| 1 | hinge_male_small.stl |
### Assemblies
| Qty | Name |
| ---:|:--- |
| 1 | hinge_big_assembly |
| 1 | hinge_small_assembly |
<a href="#top">Top</a> <a href="#top">Top</a>
--- ---

48
tests/flat_hinge.scad Normal file
View File

@ -0,0 +1,48 @@
//
// 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/>.
//
include <../core.scad>
include <../vitamins/screws.scad>
use <../utils/layout.scad>
use <../printed/flat_hinge.scad>
width = 50; // [20 : 100]
depth = 20; // [8 : 50]
thickness = 4; //[1 : 10]
screws = 5; // [1 : 20]
knuckles = 5; // [3 : 10]
pin_diameter = 4; // [1: 10]
knuckle_diameter = 9; //[4 : 15]
margin = 0; // [0 : 10]
clearance = 0.2;
angle = 0; // [-90 : 180]
big_hinge = ["big", width, depth, thickness, pin_diameter, knuckle_diameter, knuckles, M3_dome_screw, screws, clearance, margin];
small_hinge = ["small", 20, 16, 2, 2.85, 7, 3, M3_dome_screw, 2, 0.2, 0];
hinges = [small_hinge, big_hinge];
module flat_hinges()
layout([for(h = hinges) hinge_width(h)], 10)
if($preview)
hinge_fastened_assembly(hinges[$i], 3, 3, angle);
else
hinge_male(hinges[$i]);
flat_hinges();