1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-09-02 20:02:46 +02:00

Merge branch 'threaded_inserts' of https://github.com/jeroenrnl/NopSCADlib into jeroenrnl-threaded_inserts

This commit is contained in:
Chris Palmer
2024-02-19 15:00:48 +00:00
5 changed files with 93 additions and 2 deletions

View File

@@ -32,6 +32,9 @@ function insert_barrel_d(type) = type[5]; //! Diameter of the main bar
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
function threaded_insert_pitch(type) = type[9]; //! Pitch of the outer thread for threaded inserts
function threaded_insert_chamfer(type) = type[10]; //! Size of the chamfer for threaded inserts
function insert_hole_length(type) = round_to_layer(insert_length(type)); //! Length of the insert rounded to layer height
@@ -46,6 +49,14 @@ function insert_nose_length(type, d) = let( //! The length before the second rin
module insert(type) { //! Draw specified insert
length = insert_length(type);
vitamin(str("insert(", type[0], "): Heatfit insert M", insert_screw_diameter(type), " x ", length, "mm"));
base_insert(type);
}
module base_insert(type) {
length = insert_length(type);
ring1_h = insert_ring1_h(type);
chamfer1 = (insert_ring2_d(type) - insert_barrel_d(type)) / 2;
@@ -53,7 +64,6 @@ module insert(type) { //! Draw specified insert
ring2_h = ring1_h + chamfer1;
gap = (length - ring1_h - ring2_h - chamfer2) / 3;
vitamin(str("insert(", type[0], "): Heatfit insert M", insert_screw_diameter(type), " x ", length, "mm"));
$fn = 64;
thread_d = insert_screw_diameter(type);
explode(20, offset = [0, 0, -length]) translate_z(eps) vflip() {
@@ -186,3 +196,54 @@ module insert_lug(insert, wall, counter_bore = 0, extension = 0, corner_r = 0, f
}
}
}
module threaded_insert(type) { //! Draw specified threaded insert, for use in wood
d2 = insert_outer_d(type);
d3 = insert_barrel_d(type);
pitch = threaded_insert_pitch(type);
profile = thread_profile((d2 - d3) /2 , 0, 60);
socket = insert_screw_diameter(type) / cos(30) / 2;
length = insert_length(type);
r=insert_barrel_d(type) / 2;
z=threaded_insert_chamfer(type);
thread_l = insert_length(type) - z; // - insert_ring1_h(type);
vitamin(str("threaded_insert(", type[0], "): Threaded insert M", insert_screw_diameter(type), " x ", length, "mm"));
union() {
color(silver)
difference() {
base_insert(type);
translate_z(-socket/2 + 0.01)
cylinder(r=socket, $fn = 6, h=socket/2);
// chamfer the end
rotate_extrude(convexity = 3)
polygon([
[r - z, -length],
[r + 0.1, - length],
[r + 0.1, - length + z + 0.1]
]);
}
translate_z(-thread_l/2)
thread(insert_barrel_d(type),
pitch,
thread_l,
profile,
center = true,
top = 1,
bot = -1,
starts = 1,
solid = false,
female = false,
colour = silver);
}
}

View File

@@ -39,8 +39,23 @@ CNCKM3 = [ "CNCKM3", 3.0, 4.6, 4.0, 3, 3.65, 0.7, 4.4, 3.9 ];
CNCKM4 = [ "CNCKM4", 4.0, 6.3, 5.6, 4, 5.15, 1.0, 6.0, 5.55];
CNCKM5 = [ "CNCKM5", 5.8, 7.1, 6.4, 5, 6.0, 1.6, 6.8, 6.33];
// Measurements according to DIN 7965
//
// If you want to add an additional length, it should be sufficient copy one with the same
// M size and change the name (2x) and the first number column (l), all others are dependent
// on the M size.
// l, d2, d5, d, d3, h, d3, d3, P1 (h), z
M3x8 = [ "M3x8", 8, 6, 5, 3, 4.5, 0.5, 4.5, 4.5, 2, 0.6];
M4x10 = [ "M4x10", 10, 8, 6.5, 4, 5.5, 0.5, 5.5, 5.5, 2.5, 0.6];
M5x12 = [ "M5x12", 12, 10, 8.5, 5, 7.5, 0.5, 7.5, 7.5, 3.5, 0.8];
M6x15 = [ "M6x15", 15, 12, 10.5, 6, 9.5, 0.5, 9.5, 9.5, 4, 1];
M8x18 = [ "M8x18", 18, 16, 14.5, 8, 12.5, 0.5, 12.5, 12.5, 5, 1];
M10x25 = [ "M10x25", 25, 18.5, 17, 10, 15, 0.5, 15, 15, 5, 1.6];
M12x30 = [ "M12x30", 30, 22, 20, 12, 18, 0.5, 18, 18, 5, 1.6];
M16x30 = [ "M16x30", 30, 25, 22.5, 16, 20.5, 0.5, 20.5, 20.5, 5, 1.6];
inserts = [ F1BM2, F1BM2p5, F1BM3, F1BM4, CNCKM5 ];
short_inserts = [ F1BM2, CNCKM2p5, CNCKM3, CNCKM4, CNCKM5 ];
threaded_inserts = [ M3x8, M4x10, M5x12, M6x15, M8x18, M10x25, M12x30, M16x30 ];
use <insert.scad>