1
0
mirror of https://github.com/nophead/Mendel90.git synced 2025-08-25 14:11:01 +02:00

Nut trap functions moved to nuts.scad.

nut_trap_radius() and nut_trap_flat_radius() now have a horizontal flag to allow them work for vertical holes.
The also have a snug flag to bodge around the fact M?_nut_radius is actually a nut trap radius with some clearance so not the same as nut_radius().
This commit is contained in:
Chris Palmer
2016-01-08 18:17:16 +00:00
parent c970a3b6aa
commit 154c3a56f9
2 changed files with 33 additions and 34 deletions

View File

@@ -54,31 +54,6 @@ module nut_trap_support(h, r, r2 = 0) {
}
}
function nut_trap_radius(nut) = nut_radius(nut) + layer_height / 4;
function nut_trap_flat_radius(nut) = nut_trap_radius(nut) * cos(30);
module nut_trap(screw_r, nut_r, depth, horizontal = false, supported = false) {
render(convexity = 5) union() {
if(horizontal) {
if(screw_r)
teardrop_plus(r = screw_r, h = 200, center = true);
cylinder(r = nut_r + layer_height / 4, h = depth * 2, center = true, $fn = 6);
}
else {
difference() {
union() {
if(screw_r)
poly_cylinder(r = screw_r, h = 200, center = true);
cylinder(r = nut_r, h = depth * 2, center = true, $fn = 6);
}
if(supported)
translate([0, 0, depth - eta])
cylinder(r = nut_r, h = layer_height, center = false);
}
}
}
}
module part_screw_hole(screw, nut, horizontal = false, supported = false) {
screw_r = screw_clearance_radius(screw);
if(nut)
@@ -107,7 +82,7 @@ module right_triangle(width, height, h, center = true) {
module rounded_square(w, h, r)
{
union() {
hull() {
square([w - 2 * r, h], center = true);
square([w, h - 2 * r], center = true);
for(x = [-w/2 + r, w/2 - r])

View File

@@ -7,14 +7,14 @@
//
// Washers
//
M2_nut = [2, 4.9, 1.6, 2.4, M2_washer, M2_nut_trap_depth];
M2p5_nut = [2.5, 5.8, 2.2, 3.8, M2p5_washer, M2p5_nut_trap_depth];
M3_nut = [3, 6.4, 2.4, 4, M3_washer, M3_nut_trap_depth];
M4_nut = [4, 8.1, 3.2, 5, M4_washer, M4_nut_trap_depth];
M5_nut = [5, 9.2, 4, 6.25, M5_washer, M5_nut_depth];
M6_nut = [6, 11.5, 5, 8, M6_washer, M6_nut_depth];
M6_half_nut = [6, 11.5, 3, 8, M6_washer, 3];
M8_nut = [8, 15, 6.5, 8, M8_washer, M8_nut_depth];
M2_nut = [2, 4.9, 1.6, 2.4, M2_washer, M2_nut_trap_depth, 5/2];
M2p5_nut = [2.5, 5.8, 2.2, 3.8, M2p5_washer, M2p5_nut_trap_depth, 5.9 / 2];
M3_nut = [3, 6.4, 2.4, 4, M3_washer, M3_nut_trap_depth, M3_nut_radius];
M4_nut = [4, 8.1, 3.2, 5, M4_washer, M4_nut_trap_depth, M4_nut_radius];
M5_nut = [5, 9.2, 4, 6.25, M5_washer, M5_nut_depth, M5_nut_radius];
M6_nut = [6, 11.5, 5, 8, M6_washer, M6_nut_depth, M6_nut_radius];
M6_half_nut = [6, 11.5, 3, 8, M6_washer, 3, M6_nut_radius];
M8_nut = [8, 15, 6.5, 8, M8_washer, M8_nut_depth, M8_nut_radius];
function nut_radius(type) = type[1] / 2;
function nut_flat_radius(type) = nut_radius(type) * cos(30);
@@ -100,3 +100,27 @@ module wingnut(type) {
cylinder(r = hole_rad, h = thickness + 2);
}
}
function nut_trap_radius(nut, horizontal = true, snug = true) = (snug ? nut_radius(nut) : nut[6]) + (horizontal ? layer_height / 4 : 0);
function nut_trap_flat_radius(nut, horizontal = true, snug = true) = nut_trap_radius(nut, horizontal, snug) * cos(30);
module nut_trap(screw_r, nut_r, depth, horizontal = false, supported = false) {
render(convexity = 5) union() {
if(horizontal) {
if(screw_r)
teardrop_plus(r = screw_r, h = 200, center = true);
cylinder(r = nut_r + layer_height / 4, h = depth * 2, center = true, $fn = 6);
}
else {
difference() {
union() {
if(screw_r)
poly_cylinder(r = screw_r, h = 200, center = true);
cylinder(r = nut_r, h = depth * 2, center = true, $fn = 6);
}
if(supported)
translate([0, 0, depth - eta])
cylinder(r = nut_r, h = layer_height, center = false);
}
}
}
}