Merge branch 'carbon_fiber_tube' of https://github.com/martinbudden/NopSCADlib into martinbudden-carbon_fiber_tube

This commit is contained in:
Chris Palmer 2020-11-13 10:03:15 +00:00
commit ce6aec428d
3 changed files with 67 additions and 22 deletions

View File

@ -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);
}
}
}

View File

@ -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);
}
}

View File

@ -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 <tubing.scad>