mirror of
https://github.com/nophead/NopSCADlib.git
synced 2025-08-05 23:17:26 +02:00
Fixed ziptie bug for small wires and corners made sharper.
This commit is contained in:
Binary file not shown.
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
Binary file not shown.
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
@@ -16,14 +16,23 @@
|
|||||||
// You should have received a copy of the GNU General Public License along with NopSCADlib.
|
// You should have received a copy of the GNU General Public License along with NopSCADlib.
|
||||||
// If not, see <https://www.gnu.org/licenses/>.
|
// If not, see <https://www.gnu.org/licenses/>.
|
||||||
//
|
//
|
||||||
|
wire_r = 5; // [1 : 20]
|
||||||
|
t = 0; // [0 : 3]
|
||||||
|
|
||||||
include <../utils/core/core.scad>
|
include <../utils/core/core.scad>
|
||||||
use <../utils/layout.scad>
|
use <../utils/layout.scad>
|
||||||
|
|
||||||
include <../vitamins/zipties.scad>
|
include <../vitamins/zipties.scad>
|
||||||
|
|
||||||
module zipties()
|
module zipties()
|
||||||
layout([for(z = zipties) 9], 10)
|
layout([for(z = zipties) 9], 2 * wire_r) {
|
||||||
ziptie(zipties[$i], 5);
|
ziptie(zipties[$i], wire_r, t);
|
||||||
|
|
||||||
|
if(t)
|
||||||
|
color(grey(20))
|
||||||
|
cylinder(r = wire_r, h = 10, center = true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if($preview)
|
if($preview)
|
||||||
zipties();
|
zipties();
|
||||||
|
@@ -33,17 +33,16 @@ function ziptie_tail(type) = type[5]; //! The length without teeth
|
|||||||
module ziptie(type, r = 5, t = 0) //! Draw specified ziptie wrapped around radius `r` and optionally through panel thickness `t`
|
module ziptie(type, r = 5, t = 0) //! Draw specified ziptie wrapped around radius `r` and optionally through panel thickness `t`
|
||||||
{
|
{
|
||||||
latch = ziptie_latch(type);
|
latch = ziptie_latch(type);
|
||||||
lx = latch.x / 2;
|
|
||||||
zt = ziptie_thickness(type);
|
zt = ziptie_thickness(type);
|
||||||
cr = zt; // sharp corner radius
|
lx = min(latch.x / 2, r + zt / 2);
|
||||||
|
right_bulge = (r > lx - zt / 2) || !t;
|
||||||
|
cr = zt / 2; // sharp corner radius
|
||||||
z = r + t - cr;
|
z = r + t - cr;
|
||||||
x = r - cr;
|
x = r - cr;
|
||||||
inside_corners = t ? [ [0, 0, r], [-x, z, cr], [x, z, cr] ] : [];
|
|
||||||
outside_corners = t ? [ [0, 0, r + zt], [-x, z, cr + zt], [x, z, cr + zt] ] : [];
|
outside_corners = t ? [ [0, 0, r + zt], [-x, z, cr + zt], [x, z, cr + zt] ] : [];
|
||||||
x1 = lx - zt / 2;
|
x1 = lx - zt / 2;
|
||||||
x2 = x1 + x1 * zt / r;
|
x2 = x1 + x1 * zt / r;
|
||||||
inside_path = concat([ [0, 0, r], [x1, -r, eps] ], inside_corners);
|
outside_path = concat([ if(right_bulge) [0, 0, r + zt], [x2, -r - zt, eps] ], outside_corners);
|
||||||
outside_path = concat([ [0, 0, r + zt], [x2, -r - zt, eps] ], outside_corners);
|
|
||||||
|
|
||||||
tangents = rounded_polygon_tangents(outside_path);
|
tangents = rounded_polygon_tangents(outside_path);
|
||||||
length = ceil(rounded_polygon_length(outside_path, tangents) + ziptie_tail(type) + latch.z + 1);
|
length = ceil(rounded_polygon_length(outside_path, tangents) + ziptie_tail(type) + latch.z + 1);
|
||||||
@@ -56,7 +55,9 @@ module ziptie(type, r = 5, t = 0) //! Draw specified ziptie wrapped around radiu
|
|||||||
linear_extrude(width, center = true)
|
linear_extrude(width, center = true)
|
||||||
difference() {
|
difference() {
|
||||||
rounded_polygon(outside_path, tangents);
|
rounded_polygon(outside_path, tangents);
|
||||||
rounded_polygon(inside_path);
|
|
||||||
|
offset(-zt)
|
||||||
|
rounded_polygon(outside_path, tangents);
|
||||||
}
|
}
|
||||||
|
|
||||||
translate([lx, -r])
|
translate([lx, -r])
|
||||||
|
Reference in New Issue
Block a user