diff --git a/libtest.png b/libtest.png index c8ce112..4dfc414 100644 Binary files a/libtest.png and b/libtest.png differ diff --git a/readme.md b/readme.md index 576882a..959da97 100644 --- a/readme.md +++ b/readme.md @@ -1547,9 +1547,11 @@ Nuts for leadscrews. | Function | Description | |:--- |:--- | | `leadnut_bore(type)` | Thread size | +| `leadnut_colour(type)` | The colour | | `leadnut_flange_dia(type)` | Flange diameter | | `leadnut_flange_offset(type)` | Offset of the flange from the top | | `leadnut_flange_t(type)` | Flange thickness | +| `leadnut_flat(type)` | Flat section width | | `leadnut_height(type)` | Total height | | `leadnut_hole_dia(type)` | The diameter of the screw holes | | `leadnut_hole_pitch(type)` | The radial pitch of the screw holes | @@ -1577,6 +1579,7 @@ Nuts for leadscrews. | ---:|:--- |:---| | 1 | `leadnut(LSN8x2)` | Leadscrew nut 8 x 2 | | 1 | `leadnut(LSN8x8)` | Leadscrew nut 8 x 8 RobotDigg | +| 1 | `leadnut(SFU1610)` | Leadscrew nut for SFU1610 | Top diff --git a/tests/png/leadnuts.png b/tests/png/leadnuts.png index d7273da..6ac490f 100644 Binary files a/tests/png/leadnuts.png and b/tests/png/leadnuts.png differ diff --git a/vitamins/leadnut.scad b/vitamins/leadnut.scad index b5ca99b..313ff02 100644 --- a/vitamins/leadnut.scad +++ b/vitamins/leadnut.scad @@ -36,12 +36,17 @@ function leadnut_hole_pitch(type) = type[10]; //! The radial pitch of the function leadnut_screw(type) = type[11]; //! The type of the fixing screws function leadnut_pitch(type) = type[12]; //! Screw pitch function leadnut_lead(type) = type[13]; //! Screw lead +function leadnut_flat(type) = type[14]; //! Flat section width +function leadnut_colour(type) = type[15]; //! The colour function leadnut_shank(type) = leadnut_height(type) - leadnut_flange_t(type) - leadnut_flange_offset(type); //! The length of the shank below the flange module leadnut_screw_positions(type) { //! Position children at the screw holes holes = leadnut_holes(type); - for(i = [0 : holes - 1], a = i * 360 / holes + 180) + flat = leadnut_flat(type); + angles = flat ? [let(h = holes / 2, a = 90 / (h - 1)) for(i = [0 : h - 1], side = [-1, 1]) side * (45 + i * a)] + : [for(i = [0 : holes - 1]) i * 360 / holes + 180]; + for(a = angles) rotate(a) translate([leadnut_hole_pitch(type), 0, leadnut_flange_t(type)]) rotate(45) @@ -55,8 +60,10 @@ module leadnut(type) { //! Draw specified leadnut h = leadnut_height(type); pitch = leadnut_pitch(type); lead = leadnut_lead(type); + flat = leadnut_flat(type); + flange_d = leadnut_flange_dia(type); - color("dimgrey") vflip() + color(leadnut_colour(type)) vflip() translate_z(-leadnut_flange_offset(type) - leadnut_flange_t(type)) { tube(or = leadnut_od(type) / 2, ir = bore_r, h = h, center = false); @@ -66,12 +73,17 @@ module leadnut(type) { //! Draw specified leadnut translate_z(leadnut_flange_offset(type)) linear_extrude(leadnut_flange_t(type)) difference() { - circle(d = leadnut_flange_dia(type)); + circle(d = flange_d); circle(bore_r); leadnut_screw_positions(type) circle(d = leadnut_hole_dia(type)); + + if(flat) + for(side = [-1, 1]) + translate([side * flange_d / 2, 0]) + square([flange_d - flat, flange_d], center = true); } } } diff --git a/vitamins/leadnuts.scad b/vitamins/leadnuts.scad index 2a13596..7397f5d 100644 --- a/vitamins/leadnuts.scad +++ b/vitamins/leadnuts.scad @@ -16,10 +16,18 @@ // You should have received a copy of the GNU General Public License along with NopSCADlib. // If not, see . // +// b s h f f f h h h s p l f c +// o h e l l l o o o c i e l o +// r a i a a a l l l r t a a l +// e n g n n n e e e e c d t o +// k h g g g s w h u +// t e e e d p r +// +// d t o +LSN8x2 = ["LSN8x2", "Leadscrew nut 8 x 2", 8, 10.2, 15, 22, 3.5, 1.5, 4, 3.5, 8, M3_cap_screw, 2, 2, 0, "dimgrey"]; +LSN8x8 = ["LSN8x8", "Leadscrew nut 8 x 8 RobotDigg", 8, 12.75,19, 25.4, 4.1, 0, 3, 3.5, 19.05/2, M3_cap_screw, 2, 8, 0, "dimgrey"]; +SFU1610 = ["SFU1610", "Leadscrew nut for SFU1610", 16, 28, 42.5, 48, 10, 0, 6, 6, 38/2, M6_cap_screw, 5, 10, 40, "#DFDAC5"]; -LSN8x2 = ["LSN8x2", "Leadscrew nut 8 x 2", 8, 10.2, 15, 22, 3.5, 1.5, 4, 3.5, 8, M3_cap_screw, 2, 2]; -LSN8x8 = ["LSN8x8", "Leadscrew nut 8 x 8 RobotDigg",8, 12.75,19, 25.4, 4.1, 0, 3, 3.5, 19.05/2, M3_cap_screw, 2, 8]; - -leadnuts = [LSN8x2, LSN8x8]; +leadnuts = [LSN8x2, LSN8x8, SFU1610]; use