From 37fe83e2e08b6a0bd23042e37fbe89122d78516c Mon Sep 17 00:00:00 2001 From: texas Date: Fri, 16 Aug 2024 16:49:04 -0500 Subject: [PATCH] added chamfer distance variable to taper in the bottom of the dome heads --- vitamins/screw.scad | 34 +++++++++++++++++++++------------- vitamins/screws.scad | 2 +- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/vitamins/screw.scad b/vitamins/screw.scad index 7023f53..65d4aa2 100644 --- a/vitamins/screw.scad +++ b/vitamins/screw.scad @@ -235,27 +235,35 @@ module screw(type, length, hob_point = 0, nylon = false) { //! Draw specified sc cylinder(h=2 * eps, r=socket_rad + eps); shaft(); } - if(head_type == hs_dome) { - 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; + edge_height = head_rad / 7.5; + head_chamfer_x=edge_height/2; + head_fillet_radius= 0.5; + p0 = [head_rad, edge_height]; // Lowest point on the arc + p1 = [1.3 * socket_rad / cos(30), head_height]; // Highest point on the arc + p = (p0 + p1) / 2; // Start of bisector + gradient = (p0.x - p1.x) / (p1.y - p0.y); // Gradient of perpendicular bisector = -1 / gradient of the line between p10 and p1 + c = p.y - gradient * p.x; // Y ordinate of the centre of the dome + r = norm(p1 - [0, c]); // Dome radius is distance from centre color(colour) { rotate_extrude() { difference() { intersection() { - scale([1,dome_height_scaling_factor]) - circle(r=head_rad); + translate([0, c]) + circle(r); - square([head_rad, head_height]); + // square([head_rad, head_height]); + offset(head_fillet_radius) offset(-head_fillet_radius) + polygon(points = [ + [0,0], + [head_rad-head_chamfer_x,0], + [head_rad, edge_height], + [head_rad,head_height], + [0,head_height], + ]); } translate([0, head_height - socket_depth]) - square([socket_rad, 20]); + square([socket_rad, 10]); } } linear_extrude(head_height) diff --git a/vitamins/screws.scad b/vitamins/screws.scad index 6fd2b7d..094010a 100644 --- a/vitamins/screws.scad +++ b/vitamins/screws.scad @@ -88,7 +88,7 @@ M3_dome_screw = ["M3_dome", "M3 dome", hs_dome, 3, 5.7, 1.65, 1.04,2.0 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]; +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];