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

fixed the calculations for dome screws to now use equations for a scaled sphere cap instead. This allows for larger and smaller sizes than were previously possible, and also eliminates the need for that lift value. Adding M6 and M8 dome screws as a result of this new ability

This commit is contained in:
texas
2024-08-14 09:40:52 -05:00
parent e97f9fdacc
commit f86dfef919
2 changed files with 14 additions and 8 deletions

View File

@@ -237,21 +237,25 @@ module screw(type, length, hob_point = 0, nylon = false) { //! Draw specified sc
}
if(head_type == hs_dome) {
lift = 0.38;
h = head_height - lift;
r = min(2 * head_height, (sqr(head_rad) + sqr(h)) / 2 * h); // Special case for M2
y = sqrt(sqr(r) - sqr(head_rad));
R_minus_h = head_height; // h would be the height of the sphere cap that's cut off of the top of the screw dome
a= socket_rad;
// this is the trig way to do this,
// alpha=atan(R_minus_h/a);
// R = R_minus_h/sin(alpha); //Radius if the cap was a perfect unscaled sphere
// this is mathematcially equivalent, but may run faster computationally with sqrt and ^2 instead of trig
R= a*sqrt((R_minus_h^2/a^2)+1); // Radius if the cap was a perfect unscaled sphere
dome_height_scaling_factor= R/head_rad;
color(colour) {
rotate_extrude() {
difference() {
intersection() {
translate([0, -y + lift])
circle(r);
scale([1,dome_height_scaling_factor])
circle(r=head_rad);
square([head_rad, head_height]);
}
translate([0, head_height - socket_depth])
square([socket_rad, 10]);
square([socket_rad, 20]);
}
}
linear_extrude(head_height)

View File

@@ -87,6 +87,8 @@ M2p5_dome_screw = ["M2p5_dome", "M2.5 dome", hs_dome,2.5, 5.35,1.6, 0.8, 2.0
M3_dome_screw = ["M3_dome", "M3 dome", hs_dome, 3, 5.7, 1.65, 1.04,2.0, 18, M3_washer, M3_nut, M3_tap_radius, M3_clearance_radius];
M4_dome_screw = ["M4_dome", "M4 dome", hs_dome, 4, 7.6, 2.2, 1.3, 2.5, 20, M4_washer, M4_nut, M4_tap_radius, M4_clearance_radius];
M5_dome_screw = ["M5_dome", "M5 dome", hs_dome, 5, 9.5, 2.75, 1.56,3.0, 22, M5_washer, M5_nut, M5_tap_radius, M5_clearance_radius];
M6_dome_screw = ["M6_dome", "M6 dome", hs_dome, 6, 10.5, 3.3, 2.5,4.0, 24, M6_washer, M6_nut, M6_tap_radius, M6_clearance_radius];
M8_dome_screw = ["M8_dome", "M8 dome", hs_dome, 8, 14, 4.4, 3,5.0, 30, M8_washer, M8_nut, M8_tap_radius, M8_clearance_radius];
M2p5_pan_screw = ["M2p5_pan", "M2.5 pan", hs_pan, 2.5, 4.7, 1.7, 0, 0, 0, M2p5_washer, M2p5_nut, M2p5_tap_radius, M2p5_clearance_radius];
M3_pan_screw = ["M3_pan", "M3 pan", hs_pan, 3, 5.4, 2.0, 0, 0, 0, M3_washer, M3_nut, M3_tap_radius, M3_clearance_radius];
@@ -122,7 +124,7 @@ screw_lists = [
[ 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],
[ M2_dome_screw, M2p5_dome_screw,M3_dome_screw, M4_dome_screw, M5_dome_screw, M6_dome_screw, M8_dome_screw],
[ 0, 0, M3_hex_screw, M4_hex_screw, M5_hex_screw, M6_hex_screw, M8_hex_screw],
[ 0, M2p5_pan_screw, M3_pan_screw, M4_pan_screw, M5_pan_screw, M6_pan_screw, No632_pan_screw],
[ No2_screw, 0, No4_screw, No6_screw, No8_screw, No6_cs_screw],