diff --git a/libtest.png b/libtest.png index d44fcae..ed4e1da 100644 Binary files a/libtest.png and b/libtest.png differ diff --git a/readme.md b/readme.md index 52bfadb..64560d5 100644 --- a/readme.md +++ b/readme.md @@ -3652,6 +3652,7 @@ Tubing and sleeving. The internal diameter can be forced to stretch it over some ### Vitamins | Qty | Module call | BOM entry | | ---:|:--- |:---| +| 1 | ```tubing(CBNFIB10)``` | Carbon fiber OD 10mm ID 8mm x 15mm | | 1 | ```tubing(HSHRNK16)``` | Heatshrink sleeving ID 1.6mm x 15mm | | 1 | ```tubing(HSHRNK100)``` | Heatshrink sleeving ID 10mm x 15mm | | 1 | ```tubing(HSHRNK24)``` | Heatshrink sleeving ID 2.4mm x 15mm | @@ -5740,6 +5741,7 @@ Simple tube or ring |:--- |:--- | | ```ring(or, ir)``` | Create a ring with specified external and internal radii | | ```tube(or, ir, h, center = true)``` | Create a tube with specified external and internal radii and height ```h``` | +| ```woven_tube(or, ir, h, center= true, colour = grey(30)``` | Create a woven tube with specified external and internal radii, height ```h```, colours, warp and weft | ![tube](tests/png/tube.png) diff --git a/tests/png/tubings.png b/tests/png/tubings.png index 4231573..9443451 100644 Binary files a/tests/png/tubings.png and b/tests/png/tubings.png differ diff --git a/tests/tubings.scad b/tests/tubings.scad index faeec0b..be34a2e 100644 --- a/tests/tubings.scad +++ b/tests/tubings.scad @@ -22,7 +22,7 @@ use <../utils/layout.scad> include <../vitamins/tubings.scad> module tubings() - layout([for(t = tubings) tubing_od(t)], 10) + layout([for(t = tubings) tubing_od(t)], 8) tubing(tubings[$i]); if($preview) diff --git a/utils/tube.scad b/utils/tube.scad index bce4082..012a2e0 100644 --- a/utils/tube.scad +++ b/utils/tube.scad @@ -31,3 +31,41 @@ module ring(or, ir) //! Create a ring with specified external and internal radii module tube(or, ir, h, center = true) //! Create a tube with specified external and internal radii and height ```h``` linear_extrude(h, center = center, convexity = 5) ring(or, ir); + +module woven_tube(or, ir, h, center= true, colour = grey(30), colour2, warp = 2, weft) {//! Create a woven tube with specified external and internal radii, height ```h```, colours, warp and weft + colour2 = colour2 ? colour2 : colour * 0.8; + weft = weft ? weft : warp; + warp_count = max(floor(PI * or / warp), 0.5); + angle = 360 / (2 * warp_count); + + module layer(weft) { + points = [[ir, weft / 2], [or, weft / 2], [or, -weft / 2], [ir, -weft / 2]]; + color(colour) + for (i = [0 : warp_count]) + rotate(2 * i * angle) + rotate_extrude(angle = angle) + polygon(points); + color(colour2) + for (i = [0 : warp_count]) + rotate((2 * i + 1) * angle) + rotate_extrude(angle = angle) + polygon(points); + } + + translate_z(center ? -h / 2 : 0) { + weft_count = floor(h / weft); + if (weft_count > 0) + for (i = [0 : weft_count - 1]) { + translate_z(i * weft + weft / 2) + rotate(i * angle) + layer(weft); + } + remainder = h - weft * weft_count; + if (remainder) { + translate_z(weft_count * weft + remainder / 2) + rotate(weft_count * angle) + layer(remainder); + } + } +} + diff --git a/vitamins/tubing.scad b/vitamins/tubing.scad index 8088946..07ffe71 100644 --- a/vitamins/tubing.scad +++ b/vitamins/tubing.scad @@ -21,6 +21,7 @@ //! Tubing and sleeving. The internal diameter can be forced to stretch it over something. // include <../utils/core/core.scad> +include <../utils/tube.scad> function tubing_material(type) = type[1]; //! Material description function tubing_od(type) = type[2]; //! Outside diameter @@ -38,10 +39,15 @@ module tubing(type, length = 15, forced_id = 0, center = true) { //! Draw specif vitamin(str("tubing(", type[0], arg(length, 15), "): ", tubing_material(type), " ID ", original_id, "mm x ",length, "mm")); else vitamin(str("tubing(", type[0], arg(length, 15), "): ", tubing_material(type), " OD ", original_od, "mm ID ", original_id,"mm x ",length, "mm")); - color(tubing_colour(type)) - linear_extrude(length, center = center, convexity = 4) - difference() { - circle(d = od); - circle(d = id); - } + + if(tubing_material(type) == "Carbon fiber") + woven_tube(od / 2, id /2, length, colour = tubing_colour(type)); + else + color(tubing_colour(type)) + linear_extrude(length, center = center, convexity = 4) + difference() { + circle(d = od); + circle(d = id); + } } + diff --git a/vitamins/tubings.scad b/vitamins/tubings.scad index f6bbc3c..7e78797 100644 --- a/vitamins/tubings.scad +++ b/vitamins/tubings.scad @@ -19,22 +19,23 @@ // // Tubing and sleeving -// -PVC64 = ["PVC64", "PVC aquarium tubing", 6, 4, [0.8, 0.8, 0.8, 0.75 ]]; -PVC85 = ["PVC85", "PVC aquarium tubing", 8, 5, [0.8, 0.8, 0.8, 0.75 ]]; -NEOP85 = ["NEOP85", "Neoprene tubing", 8, 5, [0.2,0.2,0.2]]; -PTFE07 = ["PTFE07", "PTFE sleeving", 1.2, 0.71, [0.95, 0.95, 0.95, 0.9]]; -PTFE20 = ["PTFE20", "PTFE sleeving", 2.6, 2, [0.95, 0.95, 0.95, 0.9]]; -PTFE2_4 = ["PTFE2_4", "PTFE tubing", 4, 2, [0.95, 0.95, 0.95, 0.9]]; -PTFE2_3 = ["PTFE2_3", "PTFE tubing", 3, 2, [0.95, 0.95, 0.95, 0.9]]; -PTFE4_6 = ["PTFE4_6", "PTFE tubing", 6, 4, [0.95, 0.95, 0.95, 0.9]]; -PF7 = ["PF7", "PTFE tubing", 46/10, 3.84, [0.95, 0.95, 0.95, 0.9]]; -HSHRNK16 = ["HSHRNK16", "Heatshrink sleeving", 2.0, 1.6, "grey"]; -HSHRNK24 = ["HSHRNK24", "Heatshrink sleeving", 2.8, 2.4, "grey"]; -HSHRNK32 = ["HSHRNK32", "Heatshrink sleeving", 3.6, 3.2, "grey"]; -HSHRNK64 = ["HSHRNK64", "Heatshrink sleeving", 6.8, 6.4, "grey"]; -HSHRNK100 = ["HSHRNK100", "Heatshrink sleeving",10.4, 10.0, [0.2,0.2,0.2]]; +// Description OD ID Colour +PVC64 = ["PVC64", "PVC aquarium tubing", 6, 4, [0.8, 0.8, 0.8, 0.75 ]]; +PVC85 = ["PVC85", "PVC aquarium tubing", 8, 5, [0.8, 0.8, 0.8, 0.75 ]]; +NEOP85 = ["NEOP85", "Neoprene tubing", 8, 5, [0.2,0.2,0.2]]; +PTFE07 = ["PTFE07", "PTFE sleeving", 1.2, 0.71, [0.95, 0.95, 0.95, 0.9]]; +PTFE20 = ["PTFE20", "PTFE sleeving", 2.6, 2, [0.95, 0.95, 0.95, 0.9]]; +PTFE2_4 = ["PTFE2_4", "PTFE tubing", 4, 2, [0.95, 0.95, 0.95, 0.9]]; +PTFE2_3 = ["PTFE2_3", "PTFE tubing", 3, 2, [0.95, 0.95, 0.95, 0.9]]; +PTFE4_6 = ["PTFE4_6", "PTFE tubing", 6, 4, [0.95, 0.95, 0.95, 0.9]]; +PF7 = ["PF7", "PTFE tubing", 46/10, 3.84, [0.95, 0.95, 0.95, 0.9]]; +HSHRNK16 = ["HSHRNK16", "Heatshrink sleeving", 2.0, 1.6, "grey"]; +HSHRNK24 = ["HSHRNK24", "Heatshrink sleeving", 2.8, 2.4, "grey"]; +HSHRNK32 = ["HSHRNK32", "Heatshrink sleeving", 3.6, 3.2, "grey"]; +HSHRNK64 = ["HSHRNK64", "Heatshrink sleeving", 6.8, 6.4, "grey"]; +HSHRNK100 = ["HSHRNK100", "Heatshrink sleeving",10.4, 10.0, [0.2,0.2,0.2]]; +CARBONFIBER10 = ["CBNFIB10", "Carbon fiber", 10.0, 8.0, [0.3,0.3,0.3]]; -tubings = [PVC64, PVC85, NEOP85, PTFE07, PTFE20, PF7, PTFE2_3, PTFE2_4, PTFE4_6, HSHRNK16, HSHRNK24, HSHRNK64, HSHRNK100]; +tubings = [PVC64, PVC85, NEOP85, PTFE07, PTFE20, PF7, PTFE2_3, PTFE2_4, PTFE4_6, HSHRNK16, HSHRNK24, HSHRNK64, HSHRNK100, CARBONFIBER10]; use