1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-06 15:36:30 +02:00

Fixed thread bug on threaded inserts revealed by latest OpenSCAD snapshot.

This commit is contained in:
Chris Palmer
2024-06-12 21:18:11 +01:00
parent f6f348b76e
commit c76be23867
2 changed files with 2 additions and 6 deletions

View File

@@ -47,7 +47,7 @@ thread_colour_factor = 0.8; // 60 degree threads appear too bright due to the an
function thread_profile(h, crest, angle, overlap = 0.1) = //! Create thread profile path
let(base = crest + 2 * (h + overlap) * tan(angle / 2))
[[-base / 2, -overlap, 0], [-crest / 2, h, 0], [crest / 2, h, 0], [base / 2, -overlap, 0]];
[[-base / 2, -overlap, 0], [-crest / 2, h, 0], if(crest) [crest / 2, h, 0], [base / 2, -overlap, 0]];
module thread(dia, pitch, length, profile, center = true, top = -1, bot = -1, starts = 1, solid = true, female = false, colour = undef) { //! Create male or female thread, ends can be tapered, chamfered or square
assert(is_undef(colour) || is_list(colour), "Thread colour must be in [r, g, b] form");

View File

@@ -212,13 +212,10 @@ module threaded_insert(type) { //! Draw specified threaded insert, for use in wo
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() {
render() difference() {
base_insert(type);
translate_z(-socket/2 + 0.01)
cylinder(r=socket, $fn = 6, h=socket/2);
@@ -245,5 +242,4 @@ module threaded_insert(type) { //! Draw specified threaded insert, for use in wo
female = false,
colour = silver);
}
}