mirror of
https://github.com/DJSundog/NopSCADlib.git
synced 2024-11-27 09:10:02 -05:00
Merge branch 'tnuts' of https://github.com/martinbudden/NopSCADlib into martinbudden-tnuts
This commit is contained in:
commit
0cd89279a5
@ -22,13 +22,12 @@ use <../utils/layout.scad>
|
||||
include <../vitamins/screws.scad>
|
||||
|
||||
module nuts() {
|
||||
for(nyloc = [false, true])
|
||||
translate([0, nyloc ? 20 : 0])
|
||||
layout([for(n = nuts) 2 * nut_radius(n)], 5)
|
||||
nut(nuts[$i], nyloc);
|
||||
layout([for(n = nuts) 2 * nut_radius(n)], 5) let(n = nuts[$i]) {
|
||||
for(nyloc = [false, true])
|
||||
translate([0, nyloc ? 20 : 0])
|
||||
nut(n, nyloc);
|
||||
|
||||
translate([0, 40])
|
||||
layout([for(n = nuts) 2 * nut_radius(n)], 5) let(n = nuts[$i]) {
|
||||
translate([0, 40]) {
|
||||
if(n == M3_nut)
|
||||
nut(n, brass = true);
|
||||
|
||||
@ -45,6 +44,26 @@ module nuts() {
|
||||
if(n == M8_nut)
|
||||
#nut_trap(M8_cap_screw, n, h = 30);
|
||||
}
|
||||
|
||||
translate([0, 60]) {
|
||||
if(n == M3_nut)
|
||||
sliding_t_nut(M3_sliding_t_nut);
|
||||
|
||||
if(n == M4_nut)
|
||||
sliding_t_nut(M4_sliding_t_nut);
|
||||
|
||||
if(n == M5_nut)
|
||||
sliding_t_nut(M5_sliding_t_nut);
|
||||
}
|
||||
|
||||
translate([0, 80]) {
|
||||
if(n == M3_nut)
|
||||
hammer_nut(M3_hammer_nut);
|
||||
|
||||
if(n == M4_nut)
|
||||
hammer_nut(M4_hammer_nut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($preview)
|
||||
|
@ -25,6 +25,7 @@
|
||||
include <../core.scad>
|
||||
use <washer.scad>
|
||||
use <screw.scad>
|
||||
use <../utils/fillet.scad>
|
||||
use <../utils/rounded_cylinder.scad>
|
||||
use <../utils/thread.scad>
|
||||
use <../utils/tube.scad>
|
||||
@ -129,6 +130,75 @@ module wingnut(type) { //! Draw a wingnut
|
||||
female_metric_thread(thread_d, metric_coarse_pitch(thread_d), thickness, center = false, colour = colour);
|
||||
}
|
||||
}
|
||||
|
||||
module sliding_t_nut(type) {
|
||||
vitamin(str("sliding_t_nut(", type[0], "): Nut M", nut_size(type), " sliding T"));
|
||||
|
||||
size = [type[7], type[2], nut_thickness(type)];
|
||||
tabSizeY1 = type[8];
|
||||
tabSizeY2 = type[9];
|
||||
tabSizeZ = type[10];
|
||||
holeRadius = nut_size(type) / 2;
|
||||
|
||||
if($preview)
|
||||
color(grey80)
|
||||
extrusionSlidingNut(size, tabSizeY1, tabSizeY2, tabSizeZ, holeRadius);
|
||||
|
||||
}
|
||||
|
||||
module hammer_nut(type) {
|
||||
vitamin(str("hammer_nut(", type[0], "): Nut M", nut_size(type), " hammer"));
|
||||
|
||||
size = [type[7], type[2], nut_thickness(type)];
|
||||
tabSizeY1 = type[8];
|
||||
tabSizeY2 = type[9];
|
||||
tabSizeZ = type[10];
|
||||
holeRadius = nut_size(type) / 2;
|
||||
|
||||
if($preview)
|
||||
color(grey80)
|
||||
extrusionSlidingNut(size, tabSizeY1, tabSizeY2, tabSizeZ, holeRadius, 0, hammerNut = true);
|
||||
|
||||
}
|
||||
|
||||
module extrusionSlidingNut(size, tabSizeY1, tabSizeY2, tabSizeZ, holeRadius, holeOffset = 0, hammerNut = false) {
|
||||
// center section
|
||||
linear_extrude(size[2] - tabSizeZ)
|
||||
difference() {
|
||||
square([size[0], size[1]], center = true);
|
||||
if(hammerNut) {
|
||||
translate([size[0] / 2, size[1] / 2])
|
||||
rotate(180)
|
||||
fillet(1);
|
||||
translate([-size[0] / 2, -size[1] / 2])
|
||||
fillet(1);
|
||||
}
|
||||
if(holeRadius)
|
||||
translate([holeOffset, 0])
|
||||
circle(holeRadius);
|
||||
}
|
||||
translate_z(size[2] - tabSizeZ)
|
||||
linear_extrude(tabSizeZ)
|
||||
difference() {
|
||||
square([size[0], tabSizeY2], center = true);
|
||||
if(holeRadius)
|
||||
translate([holeOffset, 0])
|
||||
circle(holeRadius);
|
||||
}
|
||||
|
||||
// add the side tabs
|
||||
for(m = [0, 1])
|
||||
mirror([0, m, 0])
|
||||
translate([0, tabSizeY2 / 2, size[2] - tabSizeZ]) {
|
||||
cubeZ = 1;
|
||||
translate([-size[0] / 2, 0, 0])
|
||||
cube([size[0], (tabSizeY1 - tabSizeY2) / 2, cubeZ]);
|
||||
translate_z(cubeZ)
|
||||
rotate([0, -90, 0])
|
||||
right_triangle(tabSizeZ - cubeZ, (tabSizeY1 - tabSizeY2) / 2, size[0], 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
|
||||
|
||||
|
@ -51,6 +51,13 @@ 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_nut = ["M3_sliding_t_nut", 3, 6, 4.0, 0, M3_washer, 0, 10, 10, 6, 3];
|
||||
M4_sliding_t_nut = ["M4_sliding_t_nut", 4, 6, 4.5, 0, M4_washer, 0, 11, 10, 6, 3.25];
|
||||
M5_sliding_t_nut = ["M5_sliding_t_nut", 5, 6, 4.5, 0, M5_washer, 0, 11, 10, 7, 3.25];
|
||||
M3_hammer_nut = ["M3_hammer_nut", 3, 6, 4.0, 0, M3_washer, 0, 5.5, 10, 6, 2.75];
|
||||
M4_hammer_nut = ["M4_hammer_nut", 4, 6, 4.5, 0, M4_washer, 0, 5.5, 10, 6, 3.25];
|
||||
|
||||
nuts = [M2_nut, M2p5_nut, M3_nut, M4_nut, M5_nut, M6_nut, M8_nut];
|
||||
|
||||
use <nut.scad>
|
||||
|
Loading…
Reference in New Issue
Block a user