1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-01-17 21:48:43 +01:00

Merge branch 'martinbudden-shoulder_screws'

This commit is contained in:
Chris Palmer 2023-04-23 20:31:18 +01:00
commit cc82cf2a6c
7 changed files with 31 additions and 20 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 974 KiB

After

Width:  |  Height:  |  Size: 970 KiB

View File

@ -225,7 +225,7 @@ inserts_y = 0;
nuts_y = inserts_y + 20;
washers_y = nuts_y + 120;
screws_y = washers_y + 120;
circlips_y = screws_y + 160;
circlips_y = screws_y + 180;
springs_y = circlips_y + 20;
o_rings_y = springs_y;
sealing_strip_y = springs_y + 20;
@ -402,21 +402,21 @@ extrusions_y = panel_meters_y + 80;
translate([x3, veroboard_y])
veroboard_test();
translate([x3 + 60, veroboard_y + 20])
translate([x3 + 50, veroboard_y + 20])
geared_steppers();
translate([x3 + 160, ssrs_y])
pcb_mounts();
translate([x3 + 170, veroboard_y + 16])
translate([x3 + 145, veroboard_y + 16])
cameras();
translate([x3 + 145, d_connectors_y - 10])
camera_housings();
translate([x3, d_connectors_y])
d_connectors();
translate([x3 + 170, d_connectors_y - 10])
camera_housings();
translate([x3, iecs_y])
iecs();

View File

@ -3484,6 +3484,7 @@ For an explanation of `screw_polysink()` see <https://hydraraptor.blogspot.com/2
| `screw_radius(type)` | Nominal radius |
| `screw_socket_af(type)` | Socket across flats |
| `screw_socket_depth(type)` | Socket or slot depth |
| `screw_thread_diameter(type)` | Thread diameter, if different from nominal diamter |
| `screw_washer(type)` | Default washer |
### Functions
@ -3526,12 +3527,14 @@ For an explanation of `screw_polysink()` see <https://hydraraptor.blogspot.com/2
| 1 | `screw(M3_hex_screw, 10)` | Screw M3 hex x 10mm |
| 1 | `screw(M3_low_cap_screw, 10)` | Screw M3 low cap x 10mm |
| 1 | `screw(M3_pan_screw, 10)` | Screw M3 pan x 10mm |
| 1 | `screw(M3_shoulder_screw, 12)` | Screw M3 shoulder x 12mm |
| 1 | `screw(M4_cap_screw, 25)` | Screw M4 cap x 25mm |
| 1 | `screw(M4_cs_cap_screw, 25)` | Screw M4 cs cap x 25mm |
| 1 | `screw(M4_dome_screw, 25)` | Screw M4 dome x 25mm |
| 1 | `screw(M4_grub_screw, 8)` | Screw M4 grub x 8mm |
| 1 | `screw(M4_hex_screw, 30)` | Screw M4 hex x 30mm |
| 1 | `screw(M4_pan_screw, 30)` | Screw M4 pan x 30mm |
| 1 | `screw(M4_shoulder_screw, 16)` | Screw M4 shoulder x 16mm |
| 1 | `screw(M5_cap_screw, 30)` | Screw M5 cap x 30mm |
| 1 | `screw(M5_cs_cap_screw, 30)` | Screw M5 cs cap x 30mm |
| 1 | `screw(M5_dome_screw, 30)` | Screw M5 dome x 30mm |

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 KiB

After

Width:  |  Height:  |  Size: 162 KiB

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 diameter, 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
@ -87,47 +88,50 @@ module screw(type, length, hob_point = 0, nylon = false) { //! Draw specified sc
vitamin(str("screw(", type[0], "_screw, ", length, arg(hob_point, 0, "hob_point"), arg(nylon, false, "nylon"), "): ", description));
head_type = screw_head_type(type);
rad = screw_radius(type) - eps;
shaft_rad = screw_radius(type) - eps;
head_rad = screw_head_radius(type);
head_height = screw_head_height(type);
socket_af = screw_socket_af(type);
socket_depth= screw_socket_depth(type);
socket_rad = socket_af / cos(30) / 2;
max_thread = screw_max_thread(type);
has_shoulder = !is_undef(screw_thread_diameter(type));
thread_rad = has_shoulder ? screw_thread_diameter(type) / 2 : screw_radius(type);
thread = max_thread ? length >= max_thread + 5 ? max_thread
: length
: length;
d = 2 * screw_radius(type);
pitch = metric_coarse_pitch(d);
thread_offset = has_shoulder ? thread : 0;
thread_d = 2 * thread_rad;
pitch = metric_coarse_pitch(thread_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;
point = screw_nut(type) ? 0 : 3 * shaft_rad;
shank = length - socket - (has_shoulder ? 0 : thread);
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(thread_d, 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 - eps, length - socket - point]);
if(point)
polygon([
[0.4, -length], [0, point - length], [rad, point - length]
[0.4, -length], [0, point - length], [shaft_rad, point - length]
]);
}
if(shank > 0)
color(colour)
translate_z(-shank - socket)
cylinder(r = rad + eps, h = shank);
cylinder(r = shaft_rad + eps, h = shank);
}
module cs_head(socket_rad, socket_depth) {
head_t = rad / 5;
head_t = shaft_rad / 5;
head_height = head_rad + head_t;
color(colour) {
@ -173,7 +177,7 @@ module screw(type, length, hob_point = 0, nylon = false) { //! Draw specified sc
}
if(head_type == hs_grub) {
color(colour) {
r = show_threads ? rad - pitch / 2 : rad;
r = show_threads ? shaft_rad - pitch / 2 : shaft_rad;
translate_z(-socket_depth)
linear_extrude(socket_depth)
difference() {

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],