Merge branch 'square-nuts' of https://github.com/FLamparski/NopSCADlib into FLamparski-square-nuts

This commit is contained in:
Chris Palmer 2020-03-15 17:06:15 +00:00
commit 0738893510
3 changed files with 56 additions and 0 deletions

View File

@ -61,6 +61,19 @@ module nuts() {
if(n == M4_nut)
sliding_t_nut(M4_hammer_nut);
}
translate([0, 100]) {
if(n == M3_nut)
nut_square(M3nS_thin_nut);
if(n == M4_nut)
nut_square(M4nS_thin_nut);
if(n == M5_nut)
nut_square(M5nS_thin_nut);
if(n == M6_nut)
nut_square(M6nS_thin_nut);
if(n == M8_nut)
nut_square(M8nS_thin_nut);
}
}
}

View File

@ -39,6 +39,10 @@ function nut_trap_depth(type) = type[6]; //! Depth of nut trap
function nut_flat_radius(type) = nut_radius(type) * cos(30); //! Radius across the flats
function nut_square_size(type) = type[1]; //! Diameter of the corresponding screw
function nut_square_width(type) = type[2]; //! Width of the square nut
function nut_square_thickness(type) = type[3]; //! Thickness of the square nut
module nut(type, nyloc = false, brass = false, nylon = false) { //! Draw specified nut
thread_d = nut_size(type);
hole_rad = thread_d / 2;
@ -189,6 +193,31 @@ module extrusionSlidingNut(size, tabSizeY1, tabSizeY2, tabSizeZ, holeRadius, hol
}
}
module nut_square(type, brass = false, nylon = false) { //! Draw specified square nut
thread_d = nut_size(type);
hole_rad = thread_d / 2;
width = nut_square_width(type);
thickness = nut_square_thickness(type);
desc = brass ? "brass" : nylon ? "nylon" : "";
vitamin(str("nut(", type[0], arg(brass, false, "brass"), arg(nylon, false, "nylon"),
"): Nut M", nut_size(type), "nS ", width, " x ", thickness, "mm ", desc));
colour = brass ? brass_colour : nylon ? grey30 : grey70;
color(colour)
difference() {
linear_extrude(height = thickness) {
difference() {
square([width, width], center = true);
circle(hole_rad);
}
}
if(show_threads)
female_metric_thread(thread_d, metric_coarse_pitch(thread_d), thickness, center = false, colour = colour);
}
}
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

View File

@ -51,6 +51,20 @@ 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];
// DIN 562 (thin) square nuts
// s w h
// c i e
// r d i
// e t g
// w h h
// t
//
M3nS_thin_nut = ["M3nS_thin_nut", 3, 5.5, 1.8];
M4nS_thin_nut = ["M4nS_thin_nut", 4, 7, 2.2];
M5nS_thin_nut = ["M5nS_thin_nut", 5, 8, 2.7];
M6nS_thin_nut = ["M6nS_thin_nut", 6, 10, 3.2];
M8nS_thin_nut = ["M8nS_thin_nut", 8, 13, 4];
// sx ty1 ty2 hammer
M3_sliding_t_nut = ["M3_sliding_t_nut", 3, 6, 3.0, 4.0, false, 0, 10, 10, 6, false];
M4_sliding_t_nut = ["M4_sliding_t_nut", 4, 6, 3.25,4.5, false, 0, 11, 10, 6, false];