diff --git a/readme.md b/readme.md index 3005583..9f2b4bd 100644 --- a/readme.md +++ b/readme.md @@ -4391,12 +4391,14 @@ Just a BOM entry at the moment and cable bundle size functions for holes, plus c ### Functions | Function | Description | |:--- |:--- | +| `cable(wires, size, colours, ribbon = false)` | Cable constructor | | `cable_bundle(cable)` | Arrangement of a bundle in a flat cable clip | | `cable_bundle_positions(cable)` | Positions of wires in a bundle to go through a cable strip | | `cable_height(cable)` | Height in flat clip | | `cable_is_ribbon(cable)` | Is a ribbon cable? | | `cable_radius(cable)` | Radius of a bundle of wires, see . | | `cable_width(cable)` | Width in flat clip | +| `cable_wire_colours(cable)` | Individual wire colours | | `cable_wire_size(cable)` | Size of each wire in a bundle | | `cable_wires(cable)` | Number of wires in a bundle | | `wire_hole_radius(cable)` | Radius of a hole to accept a bundle of wires, rounded up to standard metric drill size | diff --git a/vitamins/wire.scad b/vitamins/wire.scad index 0cfaa6b..d14126d 100644 --- a/vitamins/wire.scad +++ b/vitamins/wire.scad @@ -35,6 +35,8 @@ module ribbon_cable(ways, length) //! Add ribbon cable to the function cable_wires(cable) = cable[0]; //! Number of wires in a bundle function cable_wire_size(cable) = cable[1]; //! Size of each wire in a bundle function cable_is_ribbon(cable) = len(cable) > 2 && cable[2]; //! Is a ribbon cable? +function cable_wire_colours(cable) = assert(len(cable[3]) == cable_wires(cable)) cable[3]; //! Individual wire colours +function cable(wires, size, colours, ribbon = false) = [wires, size, ribbon, colours]; //! Cable constructor // numbers from http://mathworld.wolfram.com/CirclePacking.html 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 .