1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-01-17 05:28:14 +01:00

Added support for shoulder screws.

This commit is contained in:
Martin Budden 2023-04-05 12:30:22 +01:00
parent 81f3b084ab
commit 07e7eb77f7
3 changed files with 13 additions and 6 deletions

View File

@ -56,7 +56,7 @@ module screws() {
screw(screw, length);
}
}
translate([20, 40, -15])
translate([20, 60, -15])
polysink_stl();
}

View File

@ -41,6 +41,7 @@ function screw_washer(type) = type[9]; //! Default washer
function screw_nut(type) = type[10]; //! Default nut
function screw_pilot_hole(type) = type[11]; //! Pilot hole radius for wood screws, tap radius for machine screws
function screw_clearance_radius(type) = type[12]; //! Clearance hole radius
function screw_thread_diameter(type) = type[13]; //! Thread diamter, if different from nominal diamter
function screw_nut_radius(type) = screw_nut(type) ? nut_radius(screw_nut(type)) : 0; //! Radius of matching nut
function screw_boss_diameter(type) = max(washer_diameter(screw_washer(type)) + 1, 2 * (screw_nut_radius(type) + 3 * extrusion_width)); //! Boss big enough for nut trap and washer
function screw_head_depth(type, d = 0) = //! How far a counter sink head will go into a straight hole diameter d
@ -94,25 +95,27 @@ module screw(type, length, hob_point = 0, nylon = false) { //! Draw specified sc
socket_depth= screw_socket_depth(type);
socket_rad = socket_af / cos(30) / 2;
max_thread = screw_max_thread(type);
thread_rad = is_undef(screw_thread_diameter(type)) ? rad : screw_thread_diameter(type) / 2 - eps;
thread = max_thread ? length >= max_thread + 5 ? max_thread
: length
: length;
thread_offset = is_undef(screw_thread_diameter(type)) ? 0 : thread;
d = 2 * screw_radius(type);
pitch = metric_coarse_pitch(d);
colour = nylon || head_type == hs_grub ? grey(40) : grey(80);
module shaft(socket = 0, headless = false) {
point = screw_nut(type) ? 0 : 3 * rad;
shank = length - thread - socket;
shank = length - socket - (is_undef(screw_thread_diameter(type)) ? thread : 0);
if(show_threads && !point && pitch)
translate_z(-length)
male_metric_thread(d, pitch, thread - (shank > 0 || headless ? 0 : socket), false, top = headless ? -1 : 0, solid = !headless, colour = colour);
translate_z(-length - thread_offset)
male_metric_thread(2 * thread_rad, pitch, thread - (shank > 0 || headless ? 0 : socket), false, top = headless ? -1 : 0, solid = !headless, colour = colour);
else
color(colour * 0.9)
rotate_extrude() {
translate([0, -length + point])
square([rad, length - socket - point]);
translate([0, -length + point - thread_offset])
square([thread_rad, length - socket - point]);
if(point)
polygon([

View File

@ -103,6 +103,9 @@ M8_hex_screw = ["M8_hex", "M8 hex", hs_hex, 8, 15, 5.65, 0, 0
M3_low_cap_screw = ["M3_low_cap", "M3 low cap", hs_cap, 3, 5.5, 2, 1.5, 2.0, 18, M3_washer, M3_nut, M3_tap_radius, M3_clearance_radius];
M3_shoulder_screw= ["M3_shoulder", "M3 shoulder",hs_cap, 4, 7.0, 2.4, 1.5, 3.0, 6, M4_washer, M3_nut, M3_tap_radius, 2, 3];
M4_shoulder_screw= ["M4_shoulder", "M4 shoulder",hs_cap, 5, 9.0, 2.4, 1.5, 3.0, 8, M5_washer, M4_nut, M4_tap_radius, 2.5, 4];
M3_grub_screw = ["M3_grub", "M3 grub", hs_grub, 3, 0, 0, 2.5, 1.5, 0, M3_washer, M3_nut, M3_tap_radius, M3_clearance_radius];
M4_grub_screw = ["M4_grub", "M4 grub", hs_grub, 4, 0, 0, 2.4, 2.0, 0, M4_washer, M4_nut, M4_tap_radius, M4_clearance_radius];
M5_grub_screw = ["M5_grub", "M5 grub", hs_grub, 5, 0, 0, 2.4, 2.5, 0, M5_washer, M5_nut, M5_tap_radius, M5_clearance_radius];
@ -117,6 +120,7 @@ No8_screw = ["No8", "No8 pan wood", hs_pan, 4.2, 8.2, 3.05, 0, 0
screw_lists = [
[ M2_cap_screw, M2p5_cap_screw, M3_cap_screw, M4_cap_screw, M5_cap_screw, M6_cap_screw, M8_cap_screw],
[ 0, 0, M3_low_cap_screw],
[ 0, 0, M3_shoulder_screw, M4_shoulder_screw],
[ M2_cs_cap_screw, 0, M3_cs_cap_screw, M4_cs_cap_screw, M5_cs_cap_screw, M6_cs_cap_screw, M8_cs_cap_screw],
[ M2_dome_screw, M2p5_dome_screw,M3_dome_screw, M4_dome_screw, M5_dome_screw],
[ 0, 0, M3_hex_screw, M4_hex_screw, M5_hex_screw, M6_hex_screw, M8_hex_screw],