2019-06-08 17:10:47 -04:00
|
|
|
//
|
|
|
|
// 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/>.
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
//! Heatfit threaded inserts. Can be pushed into thermoplastics using a soldering iron with a conical bit set to 200°C.
|
|
|
|
//
|
2020-02-29 12:52:36 -05:00
|
|
|
include <../utils/core/core.scad>
|
2019-08-21 12:31:23 -04:00
|
|
|
use <../utils/quadrant.scad>
|
2020-02-22 14:44:01 -05:00
|
|
|
use <../utils/thread.scad>
|
2019-06-08 17:10:47 -04:00
|
|
|
|
2020-08-13 12:02:14 -04:00
|
|
|
function insert_length(type) = type[1]; //! Length
|
|
|
|
function insert_outer_d(type) = type[2]; //! Outer diameter at the top
|
2019-06-08 17:10:47 -04:00
|
|
|
function insert_hole_radius(type) = type[3] / 2; //! Radius of the required hole in the plastic
|
2020-08-13 12:02:14 -04:00
|
|
|
function insert_screw_diameter(type) = type[4]; //! Screw size
|
|
|
|
function insert_barrel_d(type) = type[5]; //! Diameter of the main barrel
|
|
|
|
function insert_ring1_h(type) = type[6]; //! Height of the top and middle rings
|
|
|
|
function insert_ring2_d(type) = type[7]; //! Diameter of the middle ring
|
|
|
|
function insert_ring3_d(type) = type[8]; //! Diameter of the bottom ring
|
2019-06-08 17:10:47 -04:00
|
|
|
|
|
|
|
function insert_hole_length(type) = round_to_layer(insert_length(type));
|
|
|
|
|
2020-08-22 09:31:06 -04:00
|
|
|
function insert_nose_length(type, d) = let( //! The length before the second ring.
|
|
|
|
length = insert_length(type),
|
|
|
|
ring1_h = insert_ring1_h(type),
|
|
|
|
chamfer1 = (insert_ring2_d(type) - insert_barrel_d(type)) / 2,
|
|
|
|
chamfer2 = (insert_ring3_d(type) - insert_barrel_d(type)) / 2,
|
|
|
|
ring2_h = ring1_h + chamfer1,
|
|
|
|
gap = (length - ring1_h - ring2_h - chamfer2) / 3
|
|
|
|
) ring1_h + gap + ring2_h - d + insert_barrel_d(type);
|
|
|
|
|
2019-06-08 17:10:47 -04:00
|
|
|
module insert(type) { //! Draw specified insert
|
|
|
|
length = insert_length(type);
|
|
|
|
ring1_h = insert_ring1_h(type);
|
|
|
|
|
|
|
|
chamfer1 = (insert_ring2_d(type) - insert_barrel_d(type)) / 2;
|
|
|
|
chamfer2 = (insert_ring3_d(type) - insert_barrel_d(type)) / 2;
|
|
|
|
ring2_h = ring1_h + chamfer1;
|
2020-08-13 12:02:14 -04:00
|
|
|
gap = (length - ring1_h - ring2_h - chamfer2) / 3;
|
2019-06-08 17:10:47 -04:00
|
|
|
|
|
|
|
vitamin(str("insert(", type[0], "): Heatfit insert M", insert_screw_diameter(type)));
|
|
|
|
$fn = 64;
|
2020-02-22 14:44:01 -05:00
|
|
|
thread_d = insert_screw_diameter(type);
|
2020-08-13 12:02:14 -04:00
|
|
|
explode(20, offset = [0, 0, -5]) translate_z(eps) vflip() {
|
2020-02-22 14:44:01 -05:00
|
|
|
r1 = thread_d / 2;
|
|
|
|
r2 = insert_barrel_d(type) / 2;
|
|
|
|
r3 = insert_ring3_d(type) / 2;
|
|
|
|
r4 = insert_ring2_d(type) / 2;
|
|
|
|
r5 = insert_outer_d(type) / 2;
|
|
|
|
h1 = ring1_h;
|
|
|
|
h2 = ring1_h + gap;
|
|
|
|
h3 = ring1_h + gap + ring2_h;
|
|
|
|
h4 = ring1_h + gap + ring2_h + gap;
|
|
|
|
color(brass)
|
2020-08-22 09:31:06 -04:00
|
|
|
rotate_extrude(convexity = 3)
|
2019-06-08 17:10:47 -04:00
|
|
|
polygon([
|
|
|
|
[r1, 0],
|
|
|
|
[r1, length],
|
|
|
|
[r2, length],
|
|
|
|
[r3, length - chamfer2],
|
|
|
|
[r3, h4],
|
|
|
|
[r2, h4],
|
|
|
|
[r2, h3],
|
|
|
|
[r4, h3 - chamfer1],
|
|
|
|
[r4, h2],
|
|
|
|
[r2, h2],
|
|
|
|
[r2, h1],
|
|
|
|
[r5, h1],
|
|
|
|
[r5, 0],
|
|
|
|
]);
|
2020-02-22 14:44:01 -05:00
|
|
|
|
|
|
|
if(show_threads)
|
|
|
|
female_metric_thread(thread_d, metric_coarse_pitch(thread_d), length, center = false, colour = brass);
|
2019-06-08 17:10:47 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module insert_hole(type, counterbore = 0, horizontal = false) { //! Make a hole to take an insert, ```counterbore``` is the extra length for the screw
|
|
|
|
h = insert_hole_length(type);
|
|
|
|
|
2019-06-14 08:13:15 -04:00
|
|
|
render(convexity = 2)
|
|
|
|
if(horizontal) {
|
|
|
|
teardrop_plus(r = insert_hole_radius(type), h = 2 * h);
|
2019-06-08 17:10:47 -04:00
|
|
|
|
2019-06-14 08:13:15 -04:00
|
|
|
if(counterbore)
|
|
|
|
teardrop_plus(r = insert_screw_diameter(type) / 2 + 0.1, h = 2 * (h + counterbore));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
poly_cylinder(r = insert_hole_radius(type), h = 2 * h, center = true);
|
2019-06-08 17:10:47 -04:00
|
|
|
|
2019-06-14 08:13:15 -04:00
|
|
|
if(counterbore)
|
|
|
|
poly_cylinder(r = insert_screw_diameter(type) / 2 + 0.1, h = 2 * (h + counterbore), center = true);
|
|
|
|
}
|
2019-06-08 17:10:47 -04:00
|
|
|
}
|
|
|
|
|
2019-07-24 08:48:44 -04:00
|
|
|
function insert_boss_radius(type, wall) = corrected_radius(insert_hole_radius(type)) + wall; //! Compute the outer radius of an insert boss
|
|
|
|
|
2019-06-08 17:10:47 -04:00
|
|
|
module insert_boss(type, z, wall = 2 * extrusion_width) { //! Make a boss to take an insert
|
2019-08-21 12:31:23 -04:00
|
|
|
ir = insert_hole_radius(type);
|
|
|
|
or = corrected_radius(ir) + wall;
|
|
|
|
|
|
|
|
module shape()
|
|
|
|
hull()
|
|
|
|
poly_ring(or, ir);
|
|
|
|
|
2020-03-29 15:18:57 -04:00
|
|
|
linear_extrude(z)
|
2019-08-21 12:31:23 -04:00
|
|
|
poly_ring(or, ir);
|
|
|
|
|
2020-03-29 15:18:57 -04:00
|
|
|
linear_extrude(z - insert_hole_length(type))
|
2019-06-16 12:07:02 -04:00
|
|
|
difference() {
|
2019-08-21 12:31:23 -04:00
|
|
|
shape();
|
2019-06-08 17:10:47 -04:00
|
|
|
|
2019-08-21 12:31:23 -04:00
|
|
|
poly_circle(insert_screw_diameter(type) / 2 + 0.1);
|
2019-06-16 12:07:02 -04:00
|
|
|
}
|
2019-08-21 12:31:23 -04:00
|
|
|
|
|
|
|
if(z > insert_hole_length(type) + 2 * layer_height)
|
2020-03-29 15:18:57 -04:00
|
|
|
linear_extrude(2 * layer_height) // cap the end if room
|
2019-08-21 12:31:23 -04:00
|
|
|
shape();
|
2019-06-08 17:10:47 -04:00
|
|
|
}
|
2019-07-25 05:39:31 -04:00
|
|
|
|
2019-08-21 12:31:23 -04:00
|
|
|
module insert_lug(insert, wall, counter_bore = 0, extension = 0, corner_r = 0, flying = true) { //! Make a flying insert lug, see [ssr_shroud](#Ssr_shroud)
|
2019-07-25 05:39:31 -04:00
|
|
|
boss_r = insert_boss_radius(insert, wall);
|
|
|
|
boss_h = insert_hole_length(insert);
|
|
|
|
boss_h2 = boss_h + counter_bore;
|
2019-08-21 12:31:23 -04:00
|
|
|
|
2020-10-03 10:53:41 -04:00
|
|
|
module shape() {
|
|
|
|
module _shape()
|
2019-08-21 12:31:23 -04:00
|
|
|
hull() {
|
|
|
|
circle(boss_r);
|
|
|
|
|
|
|
|
translate([boss_r + extension - eps, 0])
|
|
|
|
square([eps, 2 * boss_r], center = true);
|
|
|
|
}
|
2020-10-03 10:53:41 -04:00
|
|
|
|
|
|
|
if(corner_r)
|
|
|
|
intersection() {
|
|
|
|
_shape();
|
|
|
|
|
2019-08-21 12:31:23 -04:00
|
|
|
translate([boss_r + extension - corner_r, 0])
|
|
|
|
rotate(-45)
|
|
|
|
quadrant(w = 100, r = corner_r - eps, center = true);
|
2020-10-03 10:53:41 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
_shape();
|
|
|
|
}
|
2019-08-21 12:31:23 -04:00
|
|
|
|
2019-07-25 05:39:31 -04:00
|
|
|
translate_z(-boss_h)
|
2020-03-29 15:18:57 -04:00
|
|
|
linear_extrude(boss_h)
|
2019-07-25 05:39:31 -04:00
|
|
|
difference() {
|
2019-08-21 12:31:23 -04:00
|
|
|
shape();
|
2019-07-25 05:39:31 -04:00
|
|
|
|
|
|
|
poly_circle(insert_hole_radius(insert));
|
|
|
|
}
|
|
|
|
|
|
|
|
// insert boss counter_bore
|
|
|
|
translate_z(-boss_h2) {
|
2020-03-29 15:18:57 -04:00
|
|
|
linear_extrude(counter_bore + eps)
|
2019-07-25 05:39:31 -04:00
|
|
|
difference() {
|
2019-08-21 12:31:23 -04:00
|
|
|
shape();
|
2019-07-25 05:39:31 -04:00
|
|
|
|
|
|
|
poly_circle(insert_screw_diameter(insert) / 2 + 0.1);
|
|
|
|
}
|
|
|
|
|
2019-08-21 12:31:23 -04:00
|
|
|
// support cone
|
|
|
|
if(flying)
|
|
|
|
hull() {
|
2020-03-29 15:18:57 -04:00
|
|
|
linear_extrude(eps)
|
2019-08-21 12:31:23 -04:00
|
|
|
shape();
|
2019-07-25 05:39:31 -04:00
|
|
|
|
2019-08-21 12:31:23 -04:00
|
|
|
translate([boss_r + extension - wall - eps, 0, - (2 * boss_r + extension - wall)])
|
|
|
|
cube(eps, center = true);
|
|
|
|
}
|
2019-07-25 05:39:31 -04:00
|
|
|
}
|
|
|
|
}
|