make an equivalent OpenSCAD tube model

This commit is contained in:
numzero 2026-04-07 00:40:29 +03:00
parent 8a76c8fe01
commit 7a76502453

40
mini-tube.scad Normal file
View File

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