Refactore code: global and geometry variables now more clear, stacking function easier to read
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
// ======== Global Parameters ======== //
|
||||
$fn = 75;
|
||||
inlet_segments = 60;
|
||||
outlet_segments = 20;
|
||||
|
||||
// ======== Venturi Geometry ======== //
|
||||
inlet_length = 250;
|
||||
outlet_length = 350;
|
||||
inlet_radius = 300;
|
||||
throat_radius = 80;
|
||||
outlet_radius = 110;
|
||||
wall_thickness = 5;
|
||||
|
||||
inlet_curve_factor = 2;
|
||||
outlet_curve_factor = 1.5;
|
||||
|
||||
// ======== Stacking Function ======== //
|
||||
module stacked_shell(length, r_end, thickness, segments, curve_factor, is_outer = true) {
|
||||
for (i = [0:segments - 1]) {
|
||||
h = length / segments;
|
||||
t0 = i / (segments - 1);
|
||||
t1 = (i + 1) / (segments - 1);
|
||||
|
||||
r1 = throat_radius + (r_end - throat_radius) * pow(t0, curve_factor);
|
||||
r2 = throat_radius + (r_end - throat_radius) * pow(t1, curve_factor);
|
||||
|
||||
if (!is_outer) {
|
||||
r1 = r1 - thickness;
|
||||
r2 = r2 - thickness;
|
||||
}
|
||||
|
||||
translate([0, 0, i * h])
|
||||
cylinder(h = h, r1 = r1, r2 = r2);
|
||||
}
|
||||
}
|
||||
|
||||
// ======== Inlet Module ======== //
|
||||
module inlet() {
|
||||
difference() {
|
||||
union()
|
||||
stacked_shell(inlet_length, inlet_radius, wall_thickness, inlet_segments, inlet_curve_factor, true);
|
||||
union()
|
||||
stacked_shell(inlet_length, inlet_radius, wall_thickness, inlet_segments, inlet_curve_factor, false);
|
||||
}
|
||||
}
|
||||
|
||||
rotate([0, -90, 0]) inlet();
|
||||
|
||||
// ======== Outlet Module ======== //
|
||||
module outlet() {
|
||||
difference() {
|
||||
union()
|
||||
stacked_shell(outlet_length, outlet_radius, wall_thickness, outlet_segments, outlet_curve_factor, true);
|
||||
union()
|
||||
stacked_shell(outlet_length, outlet_radius, wall_thickness, outlet_segments, outlet_curve_factor, false);
|
||||
}
|
||||
}
|
||||
|
||||
rotate([0, 90, 0]) outlet();
|
||||
Reference in New Issue
Block a user