From 62372a049b9ac7a0fecebfd3618df91ff6ffa87a Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 10 Mar 2023 20:40:57 +0000 Subject: [PATCH] The wire() module can now draw wires if a path is specified. --- readme.md | 2 +- vitamins/wire.scad | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) 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"));