diff --git a/printed/ribbon_clamp.scad b/printed/ribbon_clamp.scad index 42b8d74..3046e23 100644 --- a/printed/ribbon_clamp.scad +++ b/printed/ribbon_clamp.scad @@ -18,7 +18,10 @@ // // -//! Clamp for ribbon cable and polypropylene strip. +//! Clamp for ribbon cable and polypropylene strip or one or more ribbon cables. +//! +//! * When `ways` is a scalar number the slot is sized for one rubbon cable and a PP strip. +//! * When `ways` is a two element vector the second element indicates the number of cables and the slot is size for just the cables. // include <../core.scad> use <../vitamins/insert.scad> @@ -34,7 +37,8 @@ function ribbon_clamp_hole_pitch(ways, screw = screw) = function ribbon_clamp_width(screw = screw) = 2 * (insert_hole_radius(screw_insert(screw)) + wall); //! Width function ribbon_clamp_length(ways, screw = screw) = ribbon_clamp_hole_pitch(ways, screw) + ribbon_clamp_width(screw); //! Length given ways -function ribbon_clamp_height(screw = screw) = ribbon_clamp_screw_depth(screw) + 1; //! Height +function ribbon_clamp_height(screw = screw, ways = undef) = ribbon_clamp_screw_depth(screw) + 1 + //! Height + (!is_undef(ways) && is_list(ways) ? (ways[1] - 1) * inch(0.05) : 0); module ribbon_clamp_hole_positions(ways, screw = screw, side = undef) //! Place children at hole positions for(x = is_undef(side) ? [-1, 1] : side) @@ -45,16 +49,20 @@ module ribbon_clamp_holes(ways, h = 20, screw = screw) //! Drill screw holes ribbon_clamp_hole_positions(ways, screw) drill(screw_clearance_radius(screw), h); +function str_ways(ways) = is_list(ways) ? str(ways[0], "_", ways[1]) : str(ways); +function str_screw_d(screw_d) = screw_d != 3 ? str("_", screw_d) : ""; + module ribbon_clamp(ways, screw = screw) { //! Generate STL for given number of ways screw_d = screw_radius(screw) * 2; pitch = ribbon_clamp_hole_pitch(ways, screw); d = ribbon_clamp_width(screw); - h = ribbon_clamp_height(screw); - t = round_to_layer(ribbon_clamp_slot_depth() + wall); + h = ribbon_clamp_height(screw, ways); + slot_d = is_list(ways) ? ways[1] * inch(0.05) : ribbon_clamp_slot_depth(); + t = round_to_layer(slot_d + wall); insert = screw_insert(screw); - stl(str("ribbon_clamp_", ways, screw_d != 3 ? str("_", screw_d) : "")) + stl(str("ribbon_clamp_", str_ways(ways), str_screw_d(screw_d))) difference() { union() { hull() { @@ -72,7 +80,7 @@ module ribbon_clamp(ways, screw = screw) { //! Generate STL for given number of } translate_z(h) - cube([ribbon_clamp_slot(ways), d + 1, ribbon_clamp_slot_depth() * 2], center = true); + cube([ribbon_clamp_slot(ways), d + 1, slot_d * 2], center = true); ribbon_clamp_hole_positions(ways, screw) translate_z(h) @@ -83,8 +91,8 @@ module ribbon_clamp(ways, screw = screw) { //! Generate STL for given number of module ribbon_clamp_assembly(ways, screw = screw) //! Printed part with inserts in place pose([55, 180, 25]) -assembly(let(screw_d = screw_radius(screw) * 2)str("ribbon_clamp_", ways, screw_d != 3 ? str("_", screw_d) : ""), ngb = true) { - h = ribbon_clamp_height(screw); +assembly(let(screw_d = screw_radius(screw) * 2)str("ribbon_clamp_", str_ways(ways), str_screw_d(screw_d)), ngb = true) { + h = ribbon_clamp_height(screw, ways); insert = screw_insert(screw); stl_colour(pp1_colour) render() diff --git a/readme.md b/readme.md index f4a2c62..e542893 100644 --- a/readme.md +++ b/readme.md @@ -645,6 +645,9 @@ When the sides are constrained then a circular model is more accurate. |:--- |:--- | | `bezier_cable_length(depth, min_z, pos)` | Calculate a length that will achieve the desired minimum z | | `cable_strip_length(depth, travel, extra = 15)` | Calculate circular cable strip length | +| `ribbon_clamp_slot(ways)` | Width of the slot to accept a ribbon cable | +| `ribbon_clamp_slot_depth()` | Depth of slot to accept a ribbon cable and a cable strip | +| `ribbon_ways(ways)` | Allows ribbon clamps to accept multiple cables | ### Modules | Module | Description | @@ -5768,7 +5771,10 @@ The stl and assembly must be given a name and parameterless wrappers for the stl --- ## Ribbon_clamp -Clamp for ribbon cable and polypropylene strip. +Clamp for ribbon cable and polypropylene strip or one or more ribbon cables. + +* When `ways` is a scalar number the slot is sized for one rubbon cable and a PP strip. +* When `ways` is a two element vector the second element indicates the number of cables and the slot is size for just the cables. [printed/ribbon_clamp.scad](printed/ribbon_clamp.scad) Implementation. @@ -5777,7 +5783,7 @@ Clamp for ribbon cable and polypropylene strip. ### Functions | Function | Description | |:--- |:--- | -| `ribbon_clamp_height(screw = screw)` | Height | +| `ribbon_clamp_height(screw = screw, ways = undef)` | Height | | `ribbon_clamp_length(ways, screw = screw)` | Length given ways | | `ribbon_clamp_width(screw = screw)` | Width | diff --git a/vitamins/cable_strip.scad b/vitamins/cable_strip.scad index 0341f22..330f305 100644 --- a/vitamins/cable_strip.scad +++ b/vitamins/cable_strip.scad @@ -27,8 +27,9 @@ // include <../utils/core/core.scad> cable_strip_thickness = 0.8; -function ribbon_clamp_slot(ways) = ways * inch(0.05) + 1; -function ribbon_clamp_slot_depth() = cable_strip_thickness + inch(0.05); +function ribbon_ways(ways) = is_list(ways) ? ways : [ways, 1]; //! Allows ribbon clamps to accept multiple cables +function ribbon_clamp_slot(ways) = let(w = ribbon_ways(ways)) w[0] * inch(0.05) + 1; //! Width of the slot to accept a ribbon cable +function ribbon_clamp_slot_depth() = cable_strip_thickness + inch(0.05); //! Depth of slot to accept a ribbon cable and a cable strip function cable_strip_thickness() = cable_strip_thickness; use <../utils/bezier.scad>