1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-07 07:56:30 +02:00

Leadnuts: add nuthousing

This commit is contained in:
Jeroen Roos
2022-09-27 21:50:28 +02:00
parent 272b7efd45
commit ce258d6d4f
3 changed files with 92 additions and 1 deletions

View File

@@ -25,6 +25,26 @@ module leadnuts()
layout([for(n = leadnuts) leadnut_flange_dia(n)], 5)
leadnut(leadnuts[$i]);
module leadnuthousings()
layout([for(n = leadnuthousings) leadnuthousing_width(n)], 5) {
rotate([0,0,270]) {
leadnuthousing(leadnuthousings[$i]);
explode(15)
leadnuthousing_nut_position(leadnuthousings[$i])
leadnut(leadnuthousing_nut(leadnuthousings[$i]));
explode(17 + leadnuthousing_nut_screw_length(leadnuthousings[$i]))
translate_z(leadnuthousing_height(leadnuthousings[$i])/2)
leadnuthousing_nut_screw_positions(leadnuthousings[$i])
screw(leadnut_screw(
leadnuthousing_nut(leadnuthousings[$i])),
leadnuthousing_nut_screw_length(leadnuthousings[$i])
);
}
}
if($preview)
let($show_threads = true)
let($show_threads = true) {
leadnuts();
translate([0,50,0])
leadnuthousings();
}

View File

@@ -23,6 +23,7 @@
include <../utils/core/core.scad>
use <../utils/tube.scad>
use <../utils/thread.scad>
use <../vitamins/screw.scad>
function leadnut_bore(type) = type[2]; //! Thread size
function leadnut_od(type) = type[3]; //! Outer diameter of the shank
@@ -41,6 +42,17 @@ 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
function leadnuthousing_length(type) = type[2]; //! Length of housing
function leadnuthousing_width(type) = type[3]; //! Width of housing
function leadnuthousing_height(type) = type[4]; //! Height of housing
function leadnuthousing_hole_pos(type) = type[5]; //! Offset from center for nut hole
function leadnuthousing_screw_dist_l(type) = type[6]; //! Distance between mounting holes length
function leadnuthousing_screw_dist_w(type) = type[7]; //! Distance between mounting holes width
function leadnuthousing_mount_screw(type) = type[8]; //! Mounting screw
function leadnuthousing_mount_screw_len(type) = type[9]; //! Mounting screw length
function leadnuthousing_nut(type) = type[10]; //! Nut type this is suitable for
function leadnuthousing_nut_screw_length(type) = type[11]; //! Length of mounting screw for nut
module leadnut_screw_positions(type) { //! Position children at the screw holes
holes = leadnut_holes(type);
flat = leadnut_flat(type);
@@ -87,3 +99,58 @@ module leadnut(type) { //! Draw specified leadnut
}
}
}
module leadnuthousing_screw_positions(type) { //! Get screw positions to mount the leadnut housing
for(p = [[-1,-1], [1,-1], [1,1], [-1,1]])
translate([p.x * leadnuthousing_screw_dist_l(type)/2, p.y * leadnuthousing_screw_dist_w(type)/2, 0])
children();
}
module leadnuthousing_nut_position(type) { //! The position of the nut may be off-center, use this to get the position
translate([leadnuthousing_hole_pos(type),0, leadnuthousing_height(type)/2])
children();
}
module leadnuthousing_nut_screw_positions(type) { //! get screw positions to mount the nut to the nut housing
translate([leadnuthousing_hole_pos(type),0, 0])
leadnut_screw_positions(leadnuthousing_nut(type))
children();
}
module leadnuthousing(type) { //! Nut housing, to connect a lead nut to another object
vitamin(str("nuthousing(", type[0], "): ", type[1]));
leadnut = leadnuthousing_nut(type);
screw = leadnut_screw(leadnut);
d = screw_radius(screw) * 2;
p = metric_coarse_pitch(d);
sl = leadnuthousing_nut_screw_length(type);
ms = leadnuthousing_mount_screw(type);
msl = leadnuthousing_mount_screw_len(type);
md = screw_radius (ms) * 2;
mp = metric_coarse_pitch(md);
color("silver")
difference() {
cube([leadnuthousing_length(type), leadnuthousing_width(type), leadnuthousing_height(type)], center = true);
translate([leadnuthousing_hole_pos(type),0,0]) {
cylinder(d=leadnut_od(leadnut), h=leadnuthousing_length(type)+2, center=true);
translate_z(leadnut_flange_offset(leadnut))
leadnut_screw_positions(leadnut)
cylinder(r=screw_radius(leadnut_screw(leadnut)), h=sl+1);
}
rotate([0,90,0])
leadnuthousing_screw_positions(type)
cylinder(r=screw_radius(ms), h=msl+1);
}
if(show_threads) {
translate([leadnuthousing_hole_pos(type),0,leadnuthousing_height(type)/2 - sl/2 - leadnut_flange_t(leadnut)])
leadnut_screw_positions(leadnut)
female_metric_thread(d, p, sl, center = true, colour = silver);
rotate([0,90,0])
translate_z(msl/2)
leadnuthousing_screw_positions(type)
female_metric_thread(md, mp, msl, center = true, colour = silver);
}
}

View File

@@ -29,5 +29,9 @@ LSN8x8 = ["LSN8x8", "Leadscrew nut 8 x 8 RobotDigg", 8, 12.75,19, 25.4, 4.1, 0
SFU1610 = ["SFU1610", "Leadscrew nut for SFU1610", 16, 28, 42.5, 48, 10, 0, 6, 6, 38/2, M6_cap_screw, 5, 10, 40, "#DFDAC5"];
leadnuts = [LSN8x2, LSN8x8, SFU1610];
// L W H Hole Mounting screws (top) Nut Nut mount screw
// Pos Dist L Dist W Type L Length
LNHT8x2 = [ "LNHT8x2", "Lead Screw Nut Housing T8", 30, 34, 30, -1, 20, 24, M4_cs_cap_screw, 15, LSN8x2, 15 ];
leadnuthousings = [LNHT8x2];
use <leadnut.scad>