diff --git a/tests/nuts.scad b/tests/nuts.scad index 4004702..6626223 100644 --- a/tests/nuts.scad +++ b/tests/nuts.scad @@ -45,6 +45,19 @@ module nuts() { if(n == M8_nut) #nut_trap(M8_cap_screw, n, h = 30); } + + translate([0, 60]) + layout([for(n = nuts) 2 * nut_radius(n)], 5) let(n = nuts[$i]) { + if(n == M3_nut) + sliding_t_nut(M3_sliding_t); + + if(n == M4_nut) + sliding_t_nut(M4_sliding_t); + + if(n == M5_nut) + sliding_t_nut(M5_sliding_t); + + } } if($preview) diff --git a/vitamins/nut.scad b/vitamins/nut.scad index 435465b..9a3384c 100644 --- a/vitamins/nut.scad +++ b/vitamins/nut.scad @@ -108,6 +108,45 @@ module wingnut(type) { //! Draw a wingnut } } } + +module sliding_t_nut(type) { //! Draw a sliding T-nut + vitamin(str("sliding_t_nut(", type[0], "): Sliding T-nut M", nut_size(type))); + + hole_diameter = nut_size(type); + sizeX = type[7]; + sizeY = type[2]; + tabSizeY1 = type[8]; + tabSizeY2 = type[9]; + nut_thickness = nut_thickness(type); + tabSizeZ = type[10]; + + color(grey70) { + // center section + linear_extrude(nut_thickness - tabSizeZ) + difference() { + square([sizeX, sizeY], center = true); + circle(d = hole_diameter); + } + translate_z(nut_thickness - tabSizeZ) + linear_extrude(tabSizeZ) + difference() { + square([sizeX, tabSizeY2], center = true); + circle(d = hole_diameter); + } + // add the side tabs + for(m = [0, 1]) + mirror([0, m, 0]) + translate([0, tabSizeY2 / 2, nut_thickness - tabSizeZ]) { + cubeZ = 1; + translate([-sizeX / 2, 0, 0]) + cube([sizeX, (tabSizeY1 - tabSizeY2) / 2, cubeZ]); + translate_z(cubeZ) + rotate([0, -90, 0]) + right_triangle(tabSizeZ - cubeZ, (tabSizeY1 - tabSizeY2) / 2, sizeX, center = true); + } + } +} + function nut_trap_radius(nut, horizontal = false) = nut_radius(nut) + (horizontal ? layer_height / 4 : 0); //! Radius across the corners of a nut trap function nut_trap_flat_radius(nut, horizontal = false) = nut_trap_radius(nut, horizontal) * cos(30); //! Radius across the flats of a nut trap diff --git a/vitamins/nuts.scad b/vitamins/nuts.scad index 6de2459..8e1ef7d 100644 --- a/vitamins/nuts.scad +++ b/vitamins/nuts.scad @@ -51,6 +51,11 @@ toggle_nut = ["toggle_nut", 6.1, 9.2, 1.5, 1.5, M6_washer, 1.5]; M4_wingnut = ["M4_wingnut", 4, 10, 3.75,8, M4_washer, 0, 22, 10, 6, 3]; +// sx ty1 ty2 tz +M3_sliding_t= ["M3_sliding_t_nut",3, 6, 4.0, 0, M3_washer, 0, 10, 10, 6, 3]; +M4_sliding_t= ["M4_sliding_t_nut",4, 6, 4.5, 0, M4_washer, 0, 11, 10, 6, 3.25]; +M5_sliding_t= ["M5_sliding_t_nut",5, 7, 4.5, 0, M5_washer, 0, 11, 10, 7, 3.25]; + nuts = [M2_nut, M2p5_nut, M3_nut, M4_nut, M5_nut, M6_nut, M8_nut]; use