1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-20 06:11:41 +02:00

Insert lug made more flexible and insert_boss made faster.

Both added to the insert test.
This commit is contained in:
Chris Palmer
2019-08-21 17:31:23 +01:00
parent 9bb84593be
commit 79f1c95136
7 changed files with 61 additions and 34 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 712 KiB

After

Width:  |  Height:  |  Size: 713 KiB

View File

@@ -139,8 +139,8 @@ module psu_shroud(type, cable_d, name, cables = 1) { //! Generate the STL file f
mirror([0, 1, 0]) mirror([0, 1, 0])
psu_shroud_hole_positions(type) psu_shroud_hole_positions(type)
translate_z(height) translate_z(height)
rotate(90) rotate($side * 90)
insert_lug(insert, wall, $side, counter_bore); insert_lug(insert, wall, counter_bore);
} }
module psu_shroud_assembly(type, cable_d, name, cables = 1) //! The printed parts with inserts fitted module psu_shroud_assembly(type, cable_d, name, cables = 1) //! The printed parts with inserts fitted

View File

@@ -103,8 +103,8 @@ module ssr_shroud(type, cable_d, name) { //! Generate the STL file for a spec
ssr_shroud_hole_positions(type) ssr_shroud_hole_positions(type)
vflip() vflip()
translate_z(height) translate_z(height)
rotate(90) rotate($side * 90)
insert_lug(insert, wall, $side, counter_bore); insert_lug(insert, wall, counter_bore);
} }
module ssr_shroud_assembly(type, cable_d, name) //! The printed parts with inserts fitted module ssr_shroud_assembly(type, cable_d, name) //! The printed parts with inserts fitted

View File

@@ -955,7 +955,7 @@ Heatfit threaded inserts. Can be pushed into thermoplastics using a soldering ir
| ```insert(type)``` | Draw specified insert | | ```insert(type)``` | Draw specified insert |
| ```insert_boss(type, z, wall = 2 * extrusion_width)``` | Make a boss to take an insert | | ```insert_boss(type, z, wall = 2 * extrusion_width)``` | Make a boss to take an insert |
| ```insert_hole(type, counterbore = 0, horizontal = false)``` | Make a hole to take an insert, ```counterbore``` is the extra length for the screw | | ```insert_hole(type, counterbore = 0, horizontal = false)``` | Make a hole to take an insert, ```counterbore``` is the extra length for the screw |
| ```insert_lug(insert, wall, side, counter_bore = 0)``` | Make a flying insert lug, see [ssr_shroud](#Ssr_shroud) | | ```insert_lug(insert, wall, counter_bore = 0, extension = 0, corner_r = 0, flying = true)``` | Make a flying insert lug, see [ssr_shroud](#Ssr_shroud) |
![inserts](tests/png/inserts.png) ![inserts](tests/png/inserts.png)

View File

@@ -21,10 +21,20 @@ use <../utils/layout.scad>
include <../vitamins/inserts.scad> include <../vitamins/inserts.scad>
module inserts() module inserts() {
for(i = [0: len(inserts) -1]) for(i = [0: len(inserts) -1])
translate([10 * i, 0]) translate([10 * i, 0])
insert(inserts[i]); insert(inserts[i]);
color(pp1_colour)
translate([len(inserts) * 10, 0]) {
insert_lug(inserts[0], 2, 1);
translate([10, 0])
insert_boss(inserts[0], z = 10, wall = 2);
}
}
if($preview) if($preview)
inserts(); inserts();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 78 KiB

View File

@@ -21,6 +21,7 @@
//! Heatfit threaded inserts. Can be pushed into thermoplastics using a soldering iron with a conical bit set to 200&deg;C. //! Heatfit threaded inserts. Can be pushed into thermoplastics using a soldering iron with a conical bit set to 200&deg;C.
// //
include <../core.scad> include <../core.scad>
use <../utils/quadrant.scad>
function insert_length(type) = type[1]; //! Length function insert_length(type) = type[1]; //! Length
function insert_outer_d(type) = type[2]; //! Outer diameter at the top function insert_outer_d(type) = type[2]; //! Outer diameter at the top
@@ -96,31 +97,52 @@ module insert_hole(type, counterbore = 0, horizontal = false) { //! Make a hole
function insert_boss_radius(type, wall) = corrected_radius(insert_hole_radius(type)) + wall; //! Compute the outer radius of an insert boss function insert_boss_radius(type, wall) = corrected_radius(insert_hole_radius(type)) + wall; //! Compute the outer radius of an insert boss
module insert_boss(type, z, wall = 2 * extrusion_width) { //! Make a boss to take an insert module insert_boss(type, z, wall = 2 * extrusion_width) { //! Make a boss to take an insert
render(convexity = 3)
difference() {
ir = insert_hole_radius(type); ir = insert_hole_radius(type);
linear_extrude(height = z) or = corrected_radius(ir) + wall;
hull()
poly_ring(corrected_radius(ir) + wall, ir);
translate_z(z) module shape()
insert_hole(type, max(0, z - insert_hole_length(type) - 2 * layer_height)); hull()
poly_ring(or, ir);
linear_extrude(height = z)
poly_ring(or, ir);
linear_extrude(height = z - insert_hole_length(type))
difference() {
shape();
poly_circle(insert_screw_diameter(type) / 2 + 0.1);
} }
if(z > insert_hole_length(type) + 2 * layer_height)
linear_extrude(height = 2 * layer_height) // cap the end if room
shape();
} }
module insert_lug(insert, wall, side, counter_bore = 0) { //! Make a flying insert lug, see [ssr_shroud](#Ssr_shroud) module insert_lug(insert, wall, counter_bore = 0, extension = 0, corner_r = 0, flying = true) { //! Make a flying insert lug, see [ssr_shroud](#Ssr_shroud)
boss_r = insert_boss_radius(insert, wall); boss_r = insert_boss_radius(insert, wall);
boss_h = insert_hole_length(insert); boss_h = insert_hole_length(insert);
boss_h2 = boss_h + counter_bore; boss_h2 = boss_h + counter_bore;
translate_z(-boss_h)
linear_extrude(height = boss_h) module shape()
difference() { intersection() {
hull() { hull() {
circle(boss_r); circle(boss_r);
translate([side * (boss_r - 1), 0]) translate([boss_r + extension - eps, 0])
square([eps, 2 * boss_r], center = true); square([eps, 2 * boss_r], center = true);
} }
if(corner_r)
translate([boss_r + extension - corner_r, 0])
rotate(-45)
quadrant(w = 100, r = corner_r - eps, center = true);
}
translate_z(-boss_h)
linear_extrude(height = boss_h)
difference() {
shape();
poly_circle(insert_hole_radius(insert)); poly_circle(insert_hole_radius(insert));
} }
@@ -128,23 +150,18 @@ module insert_lug(insert, wall, side, counter_bore = 0) { //! Make a flying inse
translate_z(-boss_h2) { translate_z(-boss_h2) {
linear_extrude(height = counter_bore + eps) linear_extrude(height = counter_bore + eps)
difference() { difference() {
hull() { shape();
circle(boss_r);
translate([side * (boss_r - 1), 0])
square([eps, 2 * boss_r], center = true);
}
poly_circle(insert_screw_diameter(insert) / 2 + 0.1); poly_circle(insert_screw_diameter(insert) / 2 + 0.1);
} }
// support cones // support cone
if(flying)
hull() { hull() {
cylinder(h = eps, r = boss_r - eps); linear_extrude(height = eps)
shape();
translate([side * (boss_r - 1), 0]) translate([boss_r + extension - wall - eps, 0, - (2 * boss_r + extension - wall)])
cube([eps, 2 * boss_r, eps], center = true);
translate([side * (boss_r - wall + eps), 0, - (2 * boss_r - wall)])
cube(eps, center = true); cube(eps, center = true);
} }
} }