1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-09-04 04:35:29 +02:00

Compare commits

...

4 Commits

5 changed files with 45 additions and 34 deletions

View File

@@ -626,10 +626,10 @@ Brackets for joining extrusions at a corner.
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 1 | ```extrusion(E2020, 20)``` | Extrusion E2020 x 20mm |
| 1 | ```extrusion(E2020, 30)``` | Extrusion E2020 x 30mm |
| 1 | ```extrusion(E2020, 40)``` | Extrusion E2020 x 40mm |
| 1 | ```extrusion(E2020, 50)``` | Extrusion E2020 x 50mm |
| 1 | ```extrusion(E2020, 20, false)``` | Extrusion E2020 x 20mm |
| 1 | ```extrusion(E2020, 30, false)``` | Extrusion E2020 x 30mm |
| 1 | ```extrusion(E2020, 40, false)``` | Extrusion E2020 x 40mm |
| 1 | ```extrusion(E2020, 50, false)``` | Extrusion E2020 x 50mm |
| 2 | ```extrusion_corner_bracket(E20_corner_bracket)``` | Extrusion corner bracket 20 |
| 2 | ```extrusion_inner_corner_bracket(E20_inner_corner_bracket, true)``` | Extrusion inner corner bracket 4.5 |
| 1 | ```extrusion_inner_corner_bracket(E20_inner_corner_bracket, false)``` | Extrusion inner corner bracket 4.5 |
@@ -669,21 +669,21 @@ Aluminium extrusion.
### Modules
| Module | Description |
|:--- |:--- |
| ```extrusion(type, length, cornerHole = false)``` | Draw the specified extrusion |
| ```extrusion(type, length, center = false, cornerHole = false)``` | Draw the specified extrusion |
![extrusions](tests/png/extrusions.png)
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 1 | ```extrusion(E2020, 80)``` | Extrusion E2020 x 80mm |
| 1 | ```extrusion(E2040, 80)``` | Extrusion E2040 x 80mm |
| 1 | ```extrusion(E2060, 80)``` | Extrusion E2060 x 80mm |
| 1 | ```extrusion(E2080, 80)``` | Extrusion E2080 x 80mm |
| 1 | ```extrusion(E3030, 80)``` | Extrusion E3030 x 80mm |
| 1 | ```extrusion(E3060, 80)``` | Extrusion E3060 x 80mm |
| 1 | ```extrusion(E4040, 80)``` | Extrusion E4040 x 80mm |
| 1 | ```extrusion(E4080, 80)``` | Extrusion E4080 x 80mm |
| 1 | ```extrusion(E2020, 80, false)``` | Extrusion E2020 x 80mm |
| 1 | ```extrusion(E2040, 80, false)``` | Extrusion E2040 x 80mm |
| 1 | ```extrusion(E2060, 80, false)``` | Extrusion E2060 x 80mm |
| 1 | ```extrusion(E2080, 80, false)``` | Extrusion E2080 x 80mm |
| 1 | ```extrusion(E3030, 80, false)``` | Extrusion E3030 x 80mm |
| 1 | ```extrusion(E3060, 80, false)``` | Extrusion E3060 x 80mm |
| 1 | ```extrusion(E4040, 80, false)``` | Extrusion E4040 x 80mm |
| 1 | ```extrusion(E4080, 80, false)``` | Extrusion E4080 x 80mm |
<a href="#top">Top</a>
@@ -2474,6 +2474,8 @@ Rocker switch. Also used for neon indicator in the same form factor.
## Rod
Steel rods and studding with chamfered ends.
These items are sysmtrical, so by default the origin is in the centre but it can be changed to the bottom.
[vitamins/rod.scad](vitamins/rod.scad) Implementation.
@@ -2782,8 +2784,8 @@ SK shaft support brackets
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 2 | ```extrusion(E2020, 20)``` | Extrusion E2020 x 20mm |
| 2 | ```extrusion(E3030, 20)``` | Extrusion E3030 x 20mm |
| 2 | ```extrusion(E2020, 20, false)``` | Extrusion E2020 x 20mm |
| 2 | ```extrusion(E3030, 20, false)``` | Extrusion E3030 x 20mm |
| 2 | ```sliding_t_nut(M4_hammer_nut)``` | Nut M4 hammer |
| 2 | ```sliding_t_nut(M4_sliding_t_nut)``` | Nut M4 sliding T |
| 2 | ```sliding_t_nut(M5_sliding_t_nut)``` | Nut M5 sliding T |
@@ -2885,6 +2887,8 @@ Filament spool models
## Springs
Compression springs. Can be tapered, have open, closed or ground ends. Ground ends will render a lot slower.
By default springs have their origin at the bottom but can be centered.
[vitamins/springs.scad](vitamins/springs.scad) Object definitions.
@@ -2913,7 +2917,7 @@ Compression springs. Can be tapered, have open, closed or ground ends. Ground en
### Modules
| Module | Description |
|:--- |:--- |
| ```comp_spring(type, l = 0)``` | Draw specified spring, l can be set to specify the compressed length. |
| ```comp_spring(type, l = 0, center = false)``` | Draw specified spring, l can be set to specify the compressed length. |
![springs](tests/png/springs.png)

View File

@@ -43,7 +43,7 @@ module extrusion_cross_section(type, cornerHole) {
fillet = extrusion_fillet(type);
cornerSize = (width-channelWidth)/2;
cornerSquare = (width-extrusion_channel_width_internal(type))/2;
cornerHoleDiameter =extrusion_corner_hole(type);
cornerHoleDiameter = extrusion_corner_hole(type);
translate([-width/2,-width/2]) {
difference() {
@@ -57,7 +57,7 @@ module extrusion_cross_section(type, cornerHole) {
translate([fillet,fillet])
square([cornerSquare-fillet,cornerSquare-fillet]);
}
if(cornerHole)
if(cornerHole && cornerHoleDiameter > 0)
translate([cornerSquare/2,cornerSquare/2])
circle(d=cornerHoleDiameter);
}
@@ -117,12 +117,12 @@ module extrusion_cross_section(type, cornerHole) {
extrusion_center_section(type);
}
module extrusion(type, length, cornerHole = false) { //! Draw the specified extrusion
module extrusion(type, length, center = false, cornerHole = false) { //! Draw the specified extrusion
vitamin(str("extrusion(", type[0], ", ", length, "): Extrusion ", type[0], " x ", length, "mm"));
vitamin(str("extrusion(", type[0], ", ", length, ", ", center, "): Extrusion ", type[0], " x ", length, "mm"));
color(grey90)
linear_extrude(height = length)
linear_extrude(length, center = center)
extrusion_cross_section(type, cornerHole);
}

View File

@@ -20,10 +20,10 @@
// Extrusion
//
// W H d1 d2 s cw cwi t st f
E2020 = [ "E2020", 20, 20, 4.2, 0, 8, 6, 12.0, 2, 2, 1 ];
E2040 = [ "E2040", 20, 40, 4.2, 0, 8, 6, 12.0, 2, 2, 1 ];
E2060 = [ "E2060", 20, 60, 4.2, 0, 8, 6, 12.0, 2, 2, 1 ];
E2080 = [ "E2080", 20, 80, 4.2, 0, 8, 6, 12.0, 2, 2, 1 ];
E2020 = [ "E2020", 20, 20, 4.2, 3, 8, 6, 12.0, 2, 2, 1 ];
E2040 = [ "E2040", 20, 40, 4.2, 3, 8, 6, 12.0, 2, 2, 1 ];
E2060 = [ "E2060", 20, 60, 4.2, 3, 8, 6, 12.0, 2, 2, 1 ];
E2080 = [ "E2080", 20, 80, 4.2, 3, 8, 6, 12.0, 2, 2, 1 ];
E3030 = [ "E3030", 30, 30, 6.8, 4.2, 12, 8, 16.5, 2, 2, 1 ];
E3060 = [ "E3060", 30, 60, 6.8, 4.2, 12, 8, 16.5, 2, 2, 1 ];
E4040 = [ "E4040", 40, 40, 10.5, 6.0, 15, 10, 20.0, 5.5, 3, 1 ];

View File

@@ -19,6 +19,8 @@
//
//! Steel rods and studding with chamfered ends.
//!
//! These items are sysmtrical, so by default the origin is in the centre but it can be changed to the bottom.
//
include <../core.scad>
use <../utils/thread.scad>

View File

@@ -19,6 +19,8 @@
//
//! Compression springs. Can be tapered, have open, closed or ground ends. Ground ends will render a lot slower.
//!
//! By default springs have their origin at the bottom but can be centered.
//
include <../core.scad>
@@ -64,7 +66,7 @@ function comp_spring(type, l = 0) = //! Calculate the mesh for spring
profile = circle_points(wire_d / 2 - eps, $fn = 16)
) concat(type, [concat(sweep(path, profile), [l])]);
module comp_spring(type, l = 0) { //! Draw specified spring, l can be set to specify the compressed length.
module comp_spring(type, l = 0, center = false) { //! Draw specified spring, l can be set to specify the compressed length.
length = spring_length(type);
closed = spring_closed(type);
od = spring_od(type);
@@ -79,14 +81,17 @@ module comp_spring(type, l = 0) { //! Draw specified spring, l can be set to spe
mesh = len(type) > 9 ? spring_mesh(type) : spring_mesh(comp_spring(type, l));
assert(l == mesh[2], "can't change the length of a pre-generated spring");
color(spring_colour(type))
if(ground)
clip(zmin = 0, zmax = h)
len = l ? l : length;
translate_z(center ? - len / 2 : 0) {
color(spring_colour(type))
if(ground)
clip(zmin = 0, zmax = h)
polyhedron(mesh[0], mesh[1]);
else
polyhedron(mesh[0], mesh[1]);
else
polyhedron(mesh[0], mesh[1]);
if($children)
translate_z(l)
children();
if($children)
translate_z(len)
children();
}
}