diff --git a/readme.md b/readme.md index 31ed94c..acaaa18 100644 --- a/readme.md +++ b/readme.md @@ -4545,7 +4545,7 @@ Utilities for adding wires to the BOM and optionally drawing them and cable bund | `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, teardrop = false)` | A mouse hole to allow a panel to go over a wire bundle. | | `ribbon_cable(ways, length)` | Add ribbon cable to the BOM | -| `wire(colour, strands, length, strand = 0.2)` | Add stranded wire to the BOM | +| `wire(colour, strands, length, strand = 0.2, d = 0, path = [])` | Add stranded wire to the BOM and draw it if diameter and path specified | ![wire](tests/png/wire.png) diff --git a/vitamins/wire.scad b/vitamins/wire.scad index b413f3d..ae1e000 100644 --- a/vitamins/wire.scad +++ b/vitamins/wire.scad @@ -25,8 +25,12 @@ use <../utils/sweep.scad> use <../utils/maths.scad> include -module wire(colour, strands, length, strand = 0.2) //! Add stranded wire to the BOM - vitamin(str(": Wire ", colour, " ", strands, "/", strand, "mm strands, length ",length, "mm")); +module wire(colour, strands, length, strand = 0.2, d = 0, path = []) { //! Add stranded wire to the BOM and draw it if diameter and path specified + vitamin(str(": Wire ", colour, " ", strands, "/", strand, "mm strands, length ", ceil(length + path_length(path)), "mm")); + + if(path && d) + color(colour) sweep(path, circle_points(r = d / 2)); +} module ribbon_cable(ways, length) //! Add ribbon cable to the BOM vitamin(str(": Ribbon cable ", ways, " way ", length, "mm"));