From 02211c20348ef4f134c0d3c734a5d922fe9a9a3c Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Thu, 13 Aug 2020 11:56:53 +0100 Subject: [PATCH] Added tubing_or() and center option. --- readme.md | 7 ++++++- vitamins/tubing.scad | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index 0a97c83..395f798 100644 --- a/readme.md +++ b/readme.md @@ -3586,10 +3586,15 @@ Tubing and sleeving. The internal diameter can be forced to stretch it over some | ```tubing_material(type)``` | Material description | | ```tubing_od(type)``` | Outside diameter | +### Functions +| Function | Description | +|:--- |:--- | +| ```tubing_or(type)``` | Outside radius | + ### Modules | Module | Description | |:--- |:--- | -| ```tubing(type, length = 15, forced_id = 0)``` | Draw specified tubing with optional forced internal diameter | +| ```tubing(type, length = 15, forced_id = 0, center = true)``` | Draw specified tubing with optional forced internal diameter | ![tubings](tests/png/tubings.png) diff --git a/vitamins/tubing.scad b/vitamins/tubing.scad index 864a876..8088946 100644 --- a/vitamins/tubing.scad +++ b/vitamins/tubing.scad @@ -27,7 +27,9 @@ function tubing_od(type) = type[2]; //! Outside diameter function tubing_id(type) = type[3]; //! Inside diameter function tubing_colour(type) = type[4]; //! Colour -module tubing(type, length = 15, forced_id = 0) { //! Draw specified tubing with optional forced internal diameter +function tubing_or(type) = tubing_od(type) / 2; //! Outside radius + +module tubing(type, length = 15, forced_id = 0, center = true) { //! Draw specified tubing with optional forced internal diameter original_od = tubing_od(type); original_id = tubing_id(type); id = forced_id ? forced_id : original_id; @@ -37,7 +39,7 @@ module tubing(type, length = 15, forced_id = 0) { //! Draw specified tubing with 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 = true, convexity = 4) + linear_extrude(length, center = center, convexity = 4) difference() { circle(d = od); circle(d = id);