From 9ed6aab6c8cfd1a647f5eae2eac8d74832328065 Mon Sep 17 00:00:00 2001 From: Jan Giebels Date: Sun, 6 Oct 2024 02:08:22 +0200 Subject: [PATCH] added test script and some more HT pipes --- tests/ht_pipes.scad | 38 ++++++++++++++++++++++++ vitamins/ht_pipe.scad | 66 +++++++++++++----------------------------- vitamins/ht_pipes.scad | 20 ++++++++++--- 3 files changed, 74 insertions(+), 50 deletions(-) create mode 100644 tests/ht_pipes.scad diff --git a/tests/ht_pipes.scad b/tests/ht_pipes.scad new file mode 100644 index 0000000..f5b5dec --- /dev/null +++ b/tests/ht_pipes.scad @@ -0,0 +1,38 @@ +// +// NopSCADlib Copyright Jan Giebels 2024 +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +include <../utils/core/core.scad> +use <../utils/layout.scad> + +include <../vitamins/ht_pipes.scad> + +module ht_pipes() + layout([for(p = ht_pipes) 100]) + translate([0, 0, 0]) { + rotate(180) { + if (ht_pipes[$i][4] <= 34) + translate([0, 0, ht_pipes[$i][4]]) + ht_cap(ht_pipes[$i]); + if (ht_pipes[$i][4] >= 101) + ht_pipe(ht_pipes[$i]); + if (ht_pipes[$i][4] == 100) + ht_tpipe(ht_pipes[$i]); + } + + } + +if($preview) + ht_pipes(); diff --git a/vitamins/ht_pipe.scad b/vitamins/ht_pipe.scad index c101cfc..4a855b4 100644 --- a/vitamins/ht_pipe.scad +++ b/vitamins/ht_pipe.scad @@ -20,6 +20,7 @@ include <../utils/core/core.scad> function pipe_od(type) = type[2]; //! Outside diameter function pipe_wall(type) = type[3]; //! Wall thickness function pipe_length(type) = type[4]; //! Pipe length +function pipe_td(type) = type[5]; //! T-Pipe diameter module ht_cap(type) { //! Draw specified cap vitamin(str("ht_cap(", type[0], "): PVC Waterpipe - ", type[1])); @@ -41,73 +42,46 @@ module ht_pipe(type) { //! Draw specified pipe difference() { union() { translate([0, 0, pipe_length(type) + tube_id - pipe_wall(type)]) - HTpipeFitting(type, 0); + HTpipeFitting(pipe_od(type)); cylinder(pipe_length(type), tube_id/2 + pipe_wall(type), tube_id/2 + pipe_wall(type)); } - cylinder(pipe_length(type), tube_id/2, tube_id/2); + cylinder(pipe_length(type)*2, tube_id/2, tube_id/2); } } module ht_tpipe(type) { //! Draw specified T-pipe vitamin(str("ht_tpipe(", type[0], "): PVC Waterpipe - ", type[1])); tube_id = pipe_od(type) - pipe_wall(type) * 2; + tube_t_id = pipe_td(type) - pipe_wall(type) * 2; difference() { union() { translate([0, 0, pipe_length(type) + tube_id - pipe_wall(type)]) - HTpipeFitting(type, 0); + HTpipeFitting(pipe_od(type)); cylinder(pipe_length(type), tube_id/2 + pipe_wall(type), tube_id/2 + pipe_wall(type)); - translate([0, -70, pipe_length(type) - 25]) { - rotate ([90, 0, 0]) { - HTpipeFitting(type, 0); - translate([0, 0, -60]) - cylinder(20, tube_id/2 + pipe_wall(type), tube_id/2 + pipe_wall(type)); - } - } + translate([0, -70, pipe_length(type) - 25]) + rotate ([90, 0, 0]) + HTpipeFitting(pipe_td(type)); } - cylinder(pipe_length(type), tube_id/2, tube_id/2); + cylinder(pipe_length(type)*2, tube_id/2, tube_id/2); translate([0, 0, 75]) rotate([90, 0, 0]) - cylinder(pipe_length(type), tube_id/2, tube_id/2); + cylinder(pipe_length(type), tube_t_id/2, tube_t_id/2); } } -module ht_t40pipe(type) { //! Draw specified T-pipe - vitamin(str("ht_tpipe(", type[0], "): PVC Waterpipe - ", type[1])); - tube_id = pipe_od(type) - pipe_wall(type) * 2; +module HTpipeFitting(fit_dia) { difference() { union() { - translate([0, 0, pipe_length(type) + tube_id - pipe_wall(type)]) - HTpipeFitting(type, 0); - cylinder(pipe_length(type), tube_id/2 + pipe_wall(type), tube_id/2 + pipe_wall(type)); - - translate([0, -60, pipe_length(type) - 25]) { - rotate ([90, 0, 0]) { - HTpipeFitting(type, 10); - translate([0, 0, -50]) - cylinder(20, (tube_id-10)/2 + pipe_wall(type), (tube_id-10)/2 + pipe_wall(type)); - } - } - } - cylinder(pipe_length(type), tube_id/2, tube_id/2); - translate([0, 0, 75]) - rotate([90, 0, 0]) - cylinder(pipe_length(type), (tube_id-10)/2, (tube_id-10)/2); - } -} - -module HTpipeFitting(type, side_reduction) { - tube_id = pipe_od(type) - side_reduction - pipe_wall(type) * 2; - difference() { - union() { - cylinder(12, tube_id/2 + pipe_wall(type) + 5, tube_id/2 + pipe_wall(type) + 5); + cylinder(12, fit_dia/2 + 5, fit_dia/2 + 5); translate([0, 0, 12]) - cylinder(3.7, tube_id/2 + pipe_wall(type), tube_id/2 + pipe_wall(type)); - translate([0, 0, -tube_id + 12]) - cylinder(tube_id, tube_id/2 + pipe_wall(type) + 2.6, tube_id/2 + pipe_wall(type) + 2.6); - translate([0, 0, -tube_id + 2]) - cylinder(10, tube_id/2 + pipe_wall(type), tube_id/2 + pipe_wall(type) + 2.6); + cylinder(3.7, fit_dia/2, fit_dia/2); + translate([0, 0, -fit_dia + 12]) + cylinder(fit_dia, fit_dia/2 + 2.6, fit_dia/2 + 2.6); + translate([0, 0, -fit_dia + 2]) + cylinder(10, fit_dia/2, fit_dia/2 + 2.6); + + translate([0, 0, -fit_dia - 15]) + cylinder(fit_dia, fit_dia/2, fit_dia/2); } - translate([0, 0, -50]) - cylinder(70, tube_id/2, tube_id/2); } } diff --git a/vitamins/ht_pipes.scad b/vitamins/ht_pipes.scad index 5cbc690..ada934f 100644 --- a/vitamins/ht_pipes.scad +++ b/vitamins/ht_pipes.scad @@ -15,16 +15,28 @@ // If not, see . // -// definition name diameter wall length +// definition name diameter wall length t-diameter +HT_40_cap = ["HT_40_cap", "HT 40 cap", 40, 2.1, 34]; HT_40_pipe_250 = ["HT_40_pipe_250", "HT 40 pipe 250 mm", 40, 2.1, 250]; +HT_40_pipe_500 = ["HT_40_pipe_500", "HT 40 pipe 500 mm", 40, 2.1, 500]; +HT_40_pipe_1000 = ["HT_40_pipe_1000", "HT 40 pipe 1000 mm", 40, 2.1, 1000]; +HT_40_pipe_2000 = ["HT_40_pipe_2000", "HT 40 pipe 2000 mm", 40, 2.1, 2000]; + HT_50_cap = ["HT_50_cap", "HT 50 cap", 50, 2.1, 34]; HT_50_pipe_250 = ["HT_50_pipe_250", "HT 50 pipe 250 mm", 50, 2.1, 250]; HT_50_pipe_500 = ["HT_50_pipe_500", "HT 50 pipe 500 mm", 50, 2.1, 500]; HT_50_pipe_1000 = ["HT_50_pipe_1000", "HT 50 pipe 1000 mm", 50, 2.1, 1000]; HT_50_pipe_2000 = ["HT_50_pipe_2000", "HT 50 pipe 2000 mm", 50, 2.1, 2000]; -HT_50_tpipe = ["HT_50_tpipe", "HT 50 T pipe", 50, 2.1, 100]; -HT_50_40_tpipe = ["HT_50_40_tpipe", "HT 50/40 T pipe", 50, 2.1, 100]; -ht_pipes = [HT_50_cap, HT_50_pipe_250, HT_50_pipe_500, HT_50_pipe_1000, HT_50_pipe_2000, HT_50_tpipe, HT_50_40_tpipe, HT_40_pipe_250]; +HT_50_tpipe = ["HT_50_tpipe", "HT 50 T pipe", 50, 2.1, 100, 50]; +HT_50_40_tpipe = ["HT_50_40_tpipe", "HT 50/40 T pipe", 50, 2.1, 100, 40]; + +HT_75_cap = ["HT_75_cap", "HT 75 cap", 75, 2.1, 34]; +HT_75_pipe_250 = ["HT_75_pipe_250", "HT 75 pipe 250 mm", 75, 2.1, 250]; +HT_75_pipe_500 = ["HT_75_pipe_500", "HT 75 pipe 500 mm", 75, 2.1, 500]; +HT_75_pipe_1000 = ["HT_75_pipe_1000", "HT 75 pipe 1000 mm", 75, 2.1, 1000]; +HT_75_pipe_2000 = ["HT_75_pipe_2000", "HT 75 pipe 2000 mm", 75, 2.1, 2000]; + +ht_pipes = [HT_40_cap, HT_40_pipe_250, HT_40_pipe_500, HT_40_pipe_1000, HT_40_pipe_2000, HT_50_cap, HT_50_pipe_250, HT_50_pipe_500, HT_50_pipe_1000, HT_50_pipe_2000, HT_50_tpipe, HT_50_40_tpipe, HT_75_cap, HT_75_pipe_250, HT_75_pipe_500, HT_75_pipe_1000, HT_75_pipe_2000]; use \ No newline at end of file