From 7a76502453caa1d6ae3060ebd385d8588061fc9b Mon Sep 17 00:00:00 2001 From: numzero Date: Tue, 7 Apr 2026 00:40:29 +0300 Subject: [PATCH] make an equivalent OpenSCAD tube model --- mini-tube.scad | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 mini-tube.scad diff --git a/mini-tube.scad b/mini-tube.scad new file mode 100644 index 0000000..9b186c5 --- /dev/null +++ b/mini-tube.scad @@ -0,0 +1,40 @@ +$fa = $preview ? 5 : 1; +$fs = $preview ? 0.1 : 0.01; + +volume_ml = 5; +cross_section_mm2 = 100; +marks = [[1, 30], [.2, 15]]; + +extra_height_mm = 5; +wall_thickness_mm = 0.8; +mark_depth_mm = 0.3; +mark_width_mm = 0.4; + +bottom_thickness_mm = wall_thickness_mm; + +cross_section_cm2 = cross_section_mm2 / 100; +useful_height_cm = volume_ml / cross_section_cm2; + +inner_radius_mm = 10 * sqrt(cross_section_cm2 / PI); +outer_radius_mm = inner_radius_mm + wall_thickness_mm; + +inner_height_mm = 10 * useful_height_cm + extra_height_mm; +outer_height_mm = inner_height_mm + bottom_thickness_mm; + +difference() { + // outer shape + translate([0, 0, -bottom_thickness_mm]) + cylinder(h=outer_height_mm, r=outer_radius_mm); + + // inner shape + cylinder(h=inner_height_mm + 1, r=inner_radius_mm); + + // marks + for (m = marks) + let (step_ml = m[0], angle = m[1]) + rotate_extrude(angle=angle) + translate([outer_radius_mm - mark_depth_mm, 0, 0]) + for (v = [0:step_ml:volume_ml]) + translate([0, 10 * v / cross_section_cm2, 0]) + square([mark_depth_mm + 1, mark_width_mm]); +}