Better ziptie model.

Better cable_tie using zipties.
Added cable ties to ssr_shroud_fastened_assembly().
Added test and documentation for wire.scad.
This commit is contained in:
Chris Palmer 2019-06-25 17:41:59 +01:00
parent 9cb0b78bb7
commit 0ccda3378e
10 changed files with 220 additions and 42 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 660 KiB

After

Width:  |  Height:  |  Size: 660 KiB

View File

@ -24,13 +24,14 @@
include <../core.scad>
include <../vitamins/screws.scad>
include <../vitamins/inserts.scad>
use <../vitamins/wire.scad>
use <../vitamins/ssr.scad>
use <../utils/round.scad>
wall = 1.8;
top = 1.5;
screw = M3_cap_screw;
screw_length = 10;
insert = screw_insert(screw);
boss_r = wall + corrected_radius(insert_hole_radius(insert));
boss_h = insert_hole_length(insert);
@ -44,6 +45,7 @@ function ssr_shroud_screw(type) = screw; //!
function ssr_shroud_extent(type, cable_d) = 2 * boss_r + 1 + cable_d + rad; //! How far it extends beyond the SSR
function ssr_shroud_width(type) = ssr_width(type) + 2 * wall + clearance; //! Outside width of shroud
function ssr_shroud_height(type) = ssr_height(type) + top + clearance; //! Outside height
function ssr_shroud_cable_x(type, cable_d) = -ssr_length(type) / 2 - 2 * boss_r - 1 - cable_d / 2; //! Position of cable entry holes
module ssr_shroud_hole_positions(type) //! Place children at the screw hole positions
for($side = [-1, 1])
@ -51,19 +53,27 @@ module ssr_shroud_hole_positions(type) //!
vflip()
children();
module ssr_shroud_holes(type) //: Drill the screw holes
module ssr_shroud_holes(type, cable_d) { //! Drill the screw and ziptie holes
ssr_shroud_hole_positions(type)
drill(screw_clearance_radius(screw), 0);
for(side = [-1, 1])
translate([ssr_shroud_cable_x(type, cable_d), side * (ssr_width(type) / 2 - 2 * boss_r)])
rotate(-90)
cable_tie_holes(cable_d / 2, h = 0);
}
module ssr_shroud(type, cable_d, name) { //! Generate the STL file for a specified ssr and cable
stl(str("ssr_shroud_", name));
width = ssr_shroud_width(type);
depth = ssr_length(type) / 3 + ssr_shroud_extent(type, cable_d);
height = ssr_shroud_height(type);
cable_x = -ssr_length(type) / 2 - 2 * boss_r - 1 - cable_d / 2;
cable_x = ssr_shroud_cable_x(type, cable_d);
center_x = -ssr_length(type) / 6 - depth / 2;
// base and sides
translate([center_x, 0]) {
rounded_rectangle([depth - eps, width - eps, top], rad, center = false);
@ -81,6 +91,7 @@ module ssr_shroud(type, cable_d, name) { //! Generate the STL file for a spec
square([cable_d, width + 1], center = true);
}
}
// cable slots
for(side = [-1, 1])
translate([cable_x, side * (width / 2 - wall / 2), height / 2])
rotate([90, 0, 0])
@ -91,7 +102,7 @@ module ssr_shroud(type, cable_d, name) { //! Generate the STL file for a spec
translate([0, height / 2])
vertical_tearslot(h = 0, r = cable_d / 2, l = cable_d);
}
// insert boss
translate_z(height - boss_h)
linear_extrude(height = boss_h)
ssr_shroud_hole_positions(type)
@ -105,6 +116,7 @@ module ssr_shroud(type, cable_d, name) { //! Generate the STL file for a spec
poly_circle(insert_hole_radius(insert));
}
// insert boss counter_bore
translate_z(height - boss_h2)
linear_extrude(height = counter_bore + eps)
ssr_shroud_hole_positions(type)
@ -117,7 +129,7 @@ module ssr_shroud(type, cable_d, name) { //! Generate the STL file for a spec
}
poly_circle(insert_screw_diameter(insert) / 2 + 0.1);
}
// support cones
ssr_shroud_hole_positions(type)
hull() {
translate_z(-height + boss_h2) {
@ -146,9 +158,25 @@ assembly(str("ssr_shroud_", name)) {
module ssr_shroud_fastened_assembly(type, cable_d, thickness, name) //! Assembly with screws in place
{
washer = screw_washer(screw);
screw_length = screw_shorter_than(2 * washer_thickness(washer) + thickness + insert_length(insert) + counter_bore);
ssr_shroud_assembly(type, cable_d, name);
translate_z(-thickness)
ssr_shroud_hole_positions(type)
screw_and_washer(screw, screw_length, true);
for(side = [-1, 1])
translate([ssr_shroud_cable_x(type, cable_d), side * (ssr_width(type) / 2 - 2 * boss_r)]) {
rotate(-90)
cable_tie(cable_d / 2, thickness);
*translate_z(cable_d / 2)
rotate([90, 0, 0])
color(grey20)
cylinder(d = cable_d, h = 20, center = true);
}
}

View File

@ -42,8 +42,8 @@ See [usage](docs/usage.md) for requirements, installation instructions and a usa
<tr><td> <a href = "#Meter">Meter</a> </td><td> <a href = "#Variacs">Variacs</a> </td><td></td><td></td><td></td></tr>
<tr><td> <a href = "#Microswitches">Microswitches</a> </td><td> <a href = "#Veroboard">Veroboard</a> </td><td></td><td></td><td></td></tr>
<tr><td> <a href = "#Microview">Microview</a> </td><td> <a href = "#Washers">Washers</a> </td><td></td><td></td><td></td></tr>
<tr><td> <a href = "#Modules">Modules</a> </td><td> <a href = "#Zipties">Zipties</a> </td><td></td><td></td><td></td></tr>
<tr><td> <a href = "#Nuts">Nuts</a> </td><td></td><td></td><td></td><td></td></tr>
<tr><td> <a href = "#Modules">Modules</a> </td><td> <a href = "#Wire">Wire</a> </td><td></td><td></td><td></td></tr>
<tr><td> <a href = "#Nuts">Nuts</a> </td><td> <a href = "#Zipties">Zipties</a> </td><td></td><td></td><td></td></tr>
</table>
---
@ -2750,6 +2750,53 @@ If a washer is given a child, usually a screw or a nut, then it is placed on its
| 1 | M80_washer.stl |
<a href="#top">Top</a>
---
<a name="Wire"></a>
## Wire
Just a BOM entry at the moment and cable bundle size functions for holes, plus cable ties.
[vitamins/wire.scad](vitamins/wire.scad) Implementation.
[tests/wire.scad](tests/wire.scad) Code for this example.
### Functions
| Function | Description |
|:--- |:--- |
| ```cable_bundle(cable)``` | Arrangement of a bundle in a flat cable clip |
| ```cable_height(cable)``` | Height in flat clip |
| ```cable_radius(cable)``` | Radius of a bundle of wires, see <http://mathworld.wolfram.com/CirclePacking.html>. |
| ```cable_width(cable)``` | Width in flat clip |
| ```cable_wire_size(cable)``` | Size of each wire in a bundle |
| ```cable_wires(cable)``` | Number of wires in a bindle |
| ```wire_hole_radius(cable)``` | Radius of a hole to accept a bundle of wires |
### Modules
| Module | Description |
|:--- |:--- |
| ```cable_tie(cable_r, thickness)``` | A ziptie threaded around cable radius ```cable_r``` and through a panel with specified ```thickness```. |
| ```cable_tie_holes(cable_r, h = 100)``` | Holes to thread a ziptie through a panel to make a cable tie. |
| ```mouse_hole(cable, h = 100)``` | A mouse hole to allow a panel to go over a wire bundle. |
| ```ribbon_cable(ways, length)``` | Add ribbon cable to the BOM |
| ```wire(color, strands, length, strand = 0.2)``` | Add stranded wire to the BOM |
![wire](tests/png/wire.png)
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 1 | | Wire black 7/0.2mm strands, length 90mm |
| 1 | | Wire blue 7/0.2mm strands, length 90mm |
| 1 | | Wire brown 7/0.2mm strands, length 90mm |
| 1 | | Wire green 7/0.2mm strands, length 90mm |
| 1 | | Wire orange 7/0.2mm strands, length 90mm |
| 1 | | Wire red 7/0.2mm strands, length 90mm |
| 1 | | Wire yellow 7/0.2mm strands, length 90mm |
| 1 | ```ziptie(small_ziptie, 2.1)``` | Ziptie 100mm min length |
<a href="#top">Top</a>
---
@ -2773,6 +2820,11 @@ Cable zipties.
| ```ziptie_thickness(type)``` | Thickness |
| ```ziptie_width(type)``` | Width |
### Modules
| Module | Description |
|:--- |:--- |
| ```ziptie(type, r, t = 0)``` | Draw specified ziptie wrapped around radius ```r``` and optionally through panel thickness ```t``` |
![zipties](tests/png/zipties.png)
### Vitamins
@ -3603,6 +3655,7 @@ The stl and assembly must be given a name and parameterless wrappers for the stl
### Functions
| Function | Description |
|:--- |:--- |
| ```ssr_shroud_cable_x(type, cable_d)``` | Position of cable entry holes |
| ```ssr_shroud_extent(type, cable_d)``` | How far it extends beyond the SSR |
| ```ssr_shroud_height(type)``` | Outside height |
| ```ssr_shroud_screw(type)``` | Screw used to fasten |
@ -3615,6 +3668,7 @@ The stl and assembly must be given a name and parameterless wrappers for the stl
| ```ssr_shroud_assembly(type, cable_d, name)``` | The printed parts with inserts fitted |
| ```ssr_shroud_fastened_assembly(type, cable_d, thickness, name)``` | Assembly with screws in place |
| ```ssr_shroud_hole_positions(type)``` | Place children at the screw hole positions |
| ```ssr_shroud_holes(type, cable_d)``` | Drill the screw and ziptie holes |
![ssr_shroud](tests/png/ssr_shroud.png)
@ -3625,6 +3679,7 @@ The stl and assembly must be given a name and parameterless wrappers for the stl
| 4 | ```screw(M3_cap_screw, 10)``` | Screw M3 cap x 10mm |
| 4 | ```washer(M3_washer)``` | Washer M3 x 7mm x 0.5mm |
| 4 | ```star_washer(M3_washer)``` | Washer star M3 x 0.5mm |
| 4 | ```ziptie(small_ziptie, 3)``` | Ziptie 100mm min length |
### Printed
| Qty | Filename |

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 50 KiB

BIN
tests/png/wire.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 29 KiB

82
tests/wire.scad Normal file
View File

@ -0,0 +1,82 @@
//
// NopSCADlib Copyright Chris Palmer 2018
// nop.head@gmail.com
// hydraraptor.blogspot.com
//
// This file is part of NopSCADlib.
//
// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with NopSCADlib.
// If not, see <https://www.gnu.org/licenses/>.
//
include <../core.scad>
include <../vitamins/wire.scad>
bundle = [7, 1.4];
bundle_r = cable_radius(bundle);
thickness = 2;
w = 50;
d = 20;
h = 40;
wire_l = 90;
module wires() {
translate_z(bundle_r)
rotate([0, 90, 0]) {
n = cable_wires(bundle);
d = cable_wire_size(bundle);
if(n > 6)
color("green") {
cylinder(d = d, h = wire_l, center = true);
wire("green", 7, wire_l);
}
m = n > 6 ? n - 1 : n;
for(i = [0 : m - 1])
rotate(i * 360 / m)
translate([bundle_r - d / 2, 0]) {
colour = ["black", "brown", "red", "orange", "yellow", "blue", "purple"][i];
wire(colour, 7, wire_l);
color(colour)
cylinder(d = d, h = wire_l, center = true);
}
%cylinder(r = bundle_r, h = wire_l - 10, center = true);
}
color(pp1_colour) {
rotate([90, 0, 90])
linear_extrude(height = thickness)
difference() {
translate([-w / 2, 0])
square([w, h]);
mouse_hole(bundle, 0);
}
translate_z(-thickness)
linear_extrude(height = thickness)
difference() {
translate([thickness -d, -w / 2])
square([d, w]);
translate([-15, 0])
cable_tie_holes(bundle_r, 0);
}
}
translate([-15, 0])
cable_tie(bundle_r, thickness);
}
if($preview)
wires();

View File

@ -18,59 +18,55 @@
//
//
//! Wires. Just a BOM entry at the moment and cable bundle size fuctions for holes. See
//! <http://mathworld.wolfram.com/CirclePacking.html>.
//! Just a BOM entry at the moment and cable bundle size functions for holes, plus cable ties.
//
include <../core.scad>
include <zipties.scad>
module wire(color, strands, length, strand = 0.2)
module wire(color, strands, length, strand = 0.2) //! Add stranded wire to the BOM
vitamin(str(": Wire ", color, " ", strands, "/", strand, "mm strands, length ",length, "mm"));
module ribbon_cable(ways, length)
module ribbon_cable(ways, length) //! Add ribbon cable to the BOM
vitamin(str(": Ribbon cable ", ways, " way ", length, "mm"));
//
// Cable sizes
//
function cable_wires(cable) = cable[0];
function cable_wire_size(cable) = cable[1];
function cable_wires(cable) = cable[0]; //! Number of wires in a bindle
function cable_wire_size(cable) = cable[1]; //! Size of each wire in a bundle
// numbers from http://mathworld.wolfram.com/CirclePacking.html
function cable_radius(cable) = ceil([0, 1, 2, 2.15, 2.41, 2.7, 3, 3, 3.3][cable_wires(cable)] * cable_wire_size(cable)) / 2; // radius of a bundle
function cable_radius(cable) = [0, 1, 2, 2.15, 2.41, 2.7, 3, 3, 3.3][cable_wires(cable)] * cable_wire_size(cable) / 2; //! Radius of a bundle of wires, see <http://mathworld.wolfram.com/CirclePacking.html>.
function wire_hole_radius(cable) = cable_radius(cable) + 0.5;
function wire_hole_radius(cable) = cable_radius(cable) + 0.5; //! Radius of a hole to accept a bundle of wires
// arrangement of bundle in flat cable clip
function cable_bundle(cable) = [[0,0], [1,1], [2,1], [2, 0.5 + sin(60)], [2,2], [3, 0.5 + sin(60)], [3,2]][cable_wires(cable)];
function cable_width(cable) = cable_bundle(cable)[0] * cable_wire_size(cable); // width in flat clip
function cable_height(cable) = cable_bundle(cable)[1] * cable_wire_size(cable); // height in flat clip
function cable_bundle(cable) = //! Arrangement of a bundle in a flat cable clip
[[0,0], [1,1], [2,1], [2, 0.5 + sin(60)], [2,2], [3, 0.5 + sin(60)], [3,2]][cable_wires(cable)];
module mouse_hole(cable, h = 100) {
function cable_width(cable) = cable_bundle(cable)[0] * cable_wire_size(cable); //! Width in flat clip
function cable_height(cable) = cable_bundle(cable)[1] * cable_wire_size(cable); //! Height in flat clip
module mouse_hole(cable, h = 100) { //! A mouse hole to allow a panel to go over a wire bundle.
r = wire_hole_radius(cable);
rotate(90) slot(r, 2 * r, h = h);
}
module cable_tie_holes(cable_r, h = 100) {
module cable_tie_holes(cable_r, h = 100) { //! Holes to thread a ziptie through a panel to make a cable tie.
r = cnc_bit_r;
l = 3;
extrude_if(h)
for(side = [-1, 1])
translate([0, side * (cable_r + r)])
translate([0, side * (cable_r + ziptie_thickness(small_ziptie) / 2)])
hull()
for(end = [-1, 1])
translate([end * (l / 2 - r), 0])
drill(r, 0);
}
module cable_tie(cable_r, thickness) {
w = 2 * (cable_r + cnc_bit_r);
translate_z(thickness / 2)
module cable_tie(cable_r, thickness) { //! A ziptie threaded around cable radius ```cable_r``` and through a panel with specified ```thickness```.
translate_z(cable_r)
rotate([-90, 0, 90])
ziptie(small_ziptie, w / 2);
ziptie(small_ziptie, cable_r, thickness);
}
//cable_tie_holes(6 / 2);
//cable_tie(6 / 2, 3);

View File

@ -22,7 +22,7 @@
//
include <../core.scad>
use <../utils/tube.scad>
use <../utils/rounded_polygon.scad>
function ziptie_width(type) = type[1]; //! Width
function ziptie_thickness(type) = type[2]; //! Thickness
@ -30,24 +30,41 @@ function ziptie_latch(type) = type[3]; //! Latch dimensions
function ziptie_colour(type) = type[4]; //! Colour
function ziptie_tail(type) = type[5]; //! The length without teeth
module ziptie(type, r)
module ziptie(type, r, t = 0) //! Draw specified ziptie wrapped around radius ```r``` and optionally through panel thickness ```t```
{
latch = ziptie_latch(type);
length = ceil(2 * PI * r + ziptie_tail(type) + latch.z + 1);
lx = latch.x / 2;
zt = ziptie_thickness(type);
cr = zt; // sharp corner raduus
z = r + t - 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] ] : [];
x1 = lx - zt / 2;
x2 = x1 + x1 * zt / r;
inside_path = concat([ [0, 0, r], [x1, -r, eps] ], inside_corners);
outside_path = concat([ [0, 0, r + zt], [x2, -r - zt, eps] ], outside_corners);
tangents = rounded_polygon_tangents(outside_path);
length = ceil(rounded_polygon_length(outside_path, tangents) + ziptie_tail(type) + latch.z + 1);
len = length <= 100 ? 100 : length;
vitamin(str("ziptie(", type[0], ", ", r, "): Ziptie ", len, "mm min length"));
angle = (r > latch.x / 2) ? asin((latch.x / 2) / r) - asin(ziptie_thickness(type) / latch.x) : 0;
color(ziptie_colour(type)) union() {
tube(ir = r, or = r + ziptie_thickness(type), h = ziptie_width(type));
translate([0, -r, - latch.y / 2])
rotate([90, 0, angle]) {
union() {
cube(latch);
color(ziptie_colour(type)){
linear_extrude(height = ziptie_width(type), center = true)
difference() {
rounded_polygon(outside_path, tangents);
rounded_polygon(inside_path);
}
translate([latch.x / 2, latch.y / 2, (latch.z + 1) / 2])
translate([lx, -r])
rotate([90, 0, 0])
union() {
rounded_rectangle(latch, 0.5, center = false);
translate_z((latch.z + 1) / 2)
cube([ziptie_thickness(type), ziptie_width(type), latch.z + 1], center = true);
}
}
}
}