63 lines
1.6 KiB
OpenSCAD
63 lines
1.6 KiB
OpenSCAD
$fa = $preview ? 5 : 1;
|
|
$fs = $preview ? 0.1 : 0.01;
|
|
|
|
volume_ml = 5; // .1
|
|
cross_section_mm2 = 100;
|
|
marks_small_ml = .2; // .1
|
|
marks_medium_ml = 0; // .1
|
|
marks_large_ml = 1; // .1
|
|
|
|
extra_height_mm = 5;
|
|
text_size_mm = 6; // .5
|
|
wall_thickness_mm = 0.8;
|
|
mark_depth_mm = 0.3;
|
|
mark_width_mm = 0.4;
|
|
|
|
marks_pre = [[marks_large_ml, 30], [marks_medium_ml, 22.5], [marks_small_ml, 15]];
|
|
marks = [for (m = marks_pre) if (m[0] > 0) m];
|
|
|
|
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;
|
|
|
|
text_z_mm = 10 * useful_height_cm - text_size_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]);
|
|
|
|
// text
|
|
if (text_size_mm > 0)
|
|
translate([0, 0, text_z_mm])
|
|
difference() {
|
|
rotate([0, 0, -90])
|
|
rotate([90, 0, 0])
|
|
render(convexity=10)
|
|
linear_extrude(outer_radius_mm + 1)
|
|
text(str(volume_ml, "ml"), size=text_size_mm, halign="center");
|
|
|
|
translate([0, 0, -1])
|
|
cylinder(h=text_size_mm+2, r=outer_radius_mm - mark_depth_mm);
|
|
}
|
|
}
|