1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-11 09:53:58 +02:00

Merge branch 'stage4upstream' of https://github.com/allTexas/NopSCADlib into allTexas-stage4upstream

This commit is contained in:
Chris Palmer
2024-09-02 15:41:46 +01:00
7 changed files with 59 additions and 27 deletions

View File

@@ -85,6 +85,13 @@ module nuts() {
if(n == M8_nut) if(n == M8_nut)
nut_square(M8nS_thin_nut); nut_square(M8nS_thin_nut);
} }
translate([0,150]){
if(n==M4_nut)
weld_nut(M4_weld_nut);
if(n==M6_nut)
weld_nut(M6_weld_nut);
}
} }
} }

17
tests/rod_ends.scad Normal file
View File

@@ -0,0 +1,17 @@
include <../utils/core/core.scad>
use <../utils/layout.scad>
include <../vitamins/rod_ends.scad>
module do_rod_ends(list) {
diameters = [for(b = list) rod_end_bearing_od(b)];
max = max(diameters);
layout(diameters) let(b = list[$i])
//translate([0, (max - bb_diameter(b)) / 2])
rod_end_bearing(list[$i]);
}
if($preview)
do_rod_ends(rod_ends);

View File

@@ -37,6 +37,6 @@ BBF693 = ["F693", 3, 8, 3, "silver", 0.5, 0.7, 9.5, 0.7];
BBF625 = ["F625", 5, 16, 5, "silver", 1.0, 1.0, 18, 1]; BBF625 = ["F625", 5, 16, 5, "silver", 1.0, 1.0, 18, 1];
BBF695 = ["F695", 5, 13, 4, "silver", 1.0, 1.0, 15, 1]; BBF695 = ["F695", 5, 13, 4, "silver", 1.0, 1.0, 15, 1];
ball_bearings = [BBF693, BBF623, BBF695, BBMR63, BBMR83, BBMR93, BBSMR95, BB624, BB686, BB696, BB608, BB6200, BB6201, BB6808]; ball_bearings = [BBF625, BBF693, BBF623, BBF695, BBMR63, BBMR83, BBMR85, BBMR93, BBMR95, BBSMR95, BB624, BB686, BB696, BB608, BB6200, BB6201, BB6808];
use <ball_bearing.scad> use <ball_bearing.scad>

View File

@@ -190,7 +190,7 @@ module wingnut(type) { //! Draw a wingnut
function t_nut_tab(type) = [type[8], type[9]]; //! Sliding t-nut T dimensions function t_nut_tab(type) = [type[8], type[9]]; //! Sliding t-nut T dimensions
module sliding_ball_t_nut(size, w, h, r) { module sliding_ball_t_nut(size, w, h, r) { //! Draw a sliding ball t nut
rad = 0.5; rad = 0.5;
stem = size.z - h; stem = size.z - h;
ball_d = 4; ball_d = 4;
@@ -245,7 +245,7 @@ module sliding_t_nut(type) { //! Draw a sliding T nut, T nut with a spring loade
extrusionSlidingNut(size, tab[0], tab[1], tabSizeZ, holeRadius, 0, hammerNut); extrusionSlidingNut(size, tab[0], tab[1], tabSizeZ, holeRadius, 0, hammerNut);
} }
module weld_nut(type) { module weld_nut(type) { //! draw a weld nut
thread_d = nut_size(type); thread_d = nut_size(type);
hole_rad = thread_d / 2; hole_rad = thread_d / 2;
nut_neck_rad = nut_radius(type); nut_neck_rad = nut_radius(type);

View File

@@ -2,25 +2,25 @@ include <NopSCADlib/utils/core/core.scad>
include <NopSCADlib/utils/thread.scad> include <NopSCADlib/utils/thread.scad>
function rod_end_bearing_bore(type) =type[1]; // radius of the bore hole in the bearing function rod_end_bearing_bore(type) =type[1]; //! radius of the bore hole in the bearing
function rod_end_bearing_od(type) =type[2]; // Outer diameter of the bearing function rod_end_bearing_od(type) =type[2]; //! Outer diameter of the bearing
function rod_end_bore_width(type) = type[3]; //! Width function rod_end_bore_width(type) = type[3]; //! Width
function rod_end_bearing_width(type) = type[4]; //! Width function rod_end_bearing_width(type) = type[4]; //! Width
function rod_end_bearing_shield_colour(type) = type[5]; //! Shield colour, "silver" for metal function rod_end_bearing_shield_colour(type) = type[5]; //! Shield colour, "silver" for metal
function rod_end_screw_radius(type) =type[6]/2; // radius of the screw end, not the bore function rod_end_screw_radius(type) =type[6]/2; //! radius of the screw end, not the bore
// function screw_pitch(type) =type[6]; // pitch of the screw end, not the bore // function screw_pitch(type) =type[6]; //! pitch of the screw end, not the bore
function rod_end_sphere_seg_width(type) = type[7]; // the width of the pivoting part, effectively a (sphere - sphereCaps - center bore) function rod_end_sphere_seg_width(type) = type[7]; //! the width of the pivoting part, effectively a (sphere - sphereCaps - center bore)
function rod_end_sphere_radius(type) = type[8]; function rod_end_sphere_radius(type) = type[8]; //!radius of the rod end sphere
function rod_end_screw_length(type) =type[9]; // length of the screw from eye center, not the bore function rod_end_screw_length(type) =type[9]; //! length of the screw from eye center, not the bore
function rod_end_thread_length(type) =type[10]; // length of the threads function rod_end_thread_length(type) =type[10]; //! length of the threads
function rod_end_overall_length(type) = type[11]; function rod_end_overall_length(type) = type[11]; //! overall length of the rod end
function rod_end_bearing_rim(type) = type[12]; //! Outer rim thickness guesstimate function rod_end_bearing_rim(type) = type[12]; //! Outer rim thickness guesstimate
// function screw_thread_radius(type) = //! Thread radius // function screw_thread_radius(type) = //! Thread radius
// let(d = screw_thread_diameter(type)) is_undef(d) ? rod_end_screw_radius(type) : d / 2; // let(d = screw_thread_diameter(type)) is_undef(d) ? rod_end_screw_radius(type) : d / 2;
module rod_end_bearing(type) { module rod_end_bearing(type) { //! Draw a rod end bearing
bb_bore = rod_end_bearing_bore(type); bb_bore = rod_end_bearing_bore(type);
bb_od=rod_end_bearing_od(type); bb_od=rod_end_bearing_od(type);

View File

@@ -235,27 +235,35 @@ module screw(type, length, hob_point = 0, nylon = false) { //! Draw specified sc
cylinder(h=2 * eps, r=socket_rad + eps); cylinder(h=2 * eps, r=socket_rad + eps);
shaft(); shaft();
} }
if(head_type == hs_dome) { 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 edge_height = head_rad / 7.5;
a= socket_rad; head_chamfer_angle= 15; // degrees
// this is the trig way to do this, head_chamfer_x=edge_height*tan(head_chamfer_angle);
// alpha=atan(R_minus_h/a); head_fillet_radius= 0.3;
// R = R_minus_h/sin(alpha); //Radius if the cap was a perfect unscaled sphere p0 = [head_rad, edge_height]; // Lowest point on the arc
// this is mathematcially equivalent, but may run faster computationally with sqrt and ^2 instead of trig p1 = [1.3 * socket_rad / cos(30), head_height]; // Highest point on the arc
R= a*sqrt((R_minus_h^2/a^2)+1); // Radius if the cap was a perfect unscaled sphere p = (p0 + p1) / 2; // Start of bisector
dome_height_scaling_factor= R/head_rad; 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) { color(colour) {
rotate_extrude() { rotate_extrude() {
difference() { difference() {
intersection() { intersection() {
scale([1,dome_height_scaling_factor]) translate([0, c])
circle(r=head_rad); circle(r);
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]) translate([0, head_height - socket_depth])
square([socket_rad, 20]); square([socket_rad, 10]);
} }
} }
linear_extrude(head_height) linear_extrude(head_height)

View File

@@ -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]; 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]; 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]; 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]; 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]; 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];