3d-prints/parametric_funnel/Funnel2.scad

124 lines
No EOL
3.1 KiB
OpenSCAD

diameter_top = 120;
diameter_throat = 15;
diameter_bottom = 10;
height_top = 100;
height_bottom = 80;
wall_thickness = 1.2;
vent_pct = 100;
tab = false;
$fn = 50;
fuzz = 0.1;
radius_top = diameter_top/2;
radius_throat = diameter_throat/2;
radius_bottom = diameter_bottom/2;
top_vent_pct = vent_pct/1;
throat_vent_pct = vent_pct;
bottom_vent_pct = vent_pct;
tabsize=wall_thickness * 6;
tablength=0.75; // reasonable sizes range from 0.5 - 2.0
tabpos=90;
module ventblock_top(throat_vent, throat, angle, throat_h, hyp_b)
{
// vent for top
translate([throat_vent, 0, 0])
rotate([0,0,180])
translate([0, -throat, throat_h-fuzz])
rotate([0,180+angle,0])
cube([throat*2, throat*2, hyp_b*1.2]);
}
module ventblock_bottom(throat_vent, throat, angle, throat_h, hyp_b)
{
// vent for bottom
translate([throat_vent, -throat, throat_h-fuzz])
rotate([0,-angle,0])
cube([throat*2, throat*2, hyp_b*1.2]);
}
module solidshape(w, h) {
t = radius_top + w;
m = radius_throat + w;
b = radius_bottom + w;
ht = height_top - h + w;
hb = height_bottom - h - h - w;
ft=m-((2*fuzz*(t-m))/ht);
vt=(t - w) * (top_vent_pct/100);
vm=(m - w) * (throat_vent_pct/100);
vb=(b - w) * (bottom_vent_pct/100);
mw = (t-vt-m+vm+fuzz);
//mw = t-vt-vm;
ab = atan((m-vm-b+vb) / hb);
at = atan((mw) / ht);
tcl = sqrt((mw^2)+((ht)^2))-fuzz;
render() {
difference() {
union() {
translate([0,0,h+fuzz])
cylinder(ht+wall_thickness, t, ft);
translate([0,0,ht+h+h])
cylinder(hb, m, b);
}
// vent for bottom
ventblock_bottom(m-vm, m, ab, ht+h, hb);
ventblock_top(m-vm, t, at, ht+h, tcl);
//translate([0,-m,0])
//translate([0,0,ht])
//rotate([0,180+at,180])
//translate([m-vm, -m, 0])
//rotate([0,180+at,0])
//#cube([m*2, m*2, hb*2]);
// vent for top
//translate([t+t-m-vt-vt+vm, -t, -ht])
//rotate([0,-at,0])
//#cube([t*2, t*2, tcl*2]);
}
//color("red") x_measurement(0, [m-vm, 0, ht+fuzz-0.2]);
}
}
module tabshape() {
translate([-tabsize/2,0,fuzz])
difference() {
intersection() {
cube([tabsize,tabsize*tablength*2,wall_thickness]);
union() {
cube([tabsize,tabsize*tablength,wall_thickness]);
translate([tabsize/2, tabsize*tablength, 0])
linear_extrude(wall_thickness)
circle(d = tabsize);
};
}
translate([tabsize/2, tabsize*tablength*0.9, 0])
linear_extrude(wall_thickness)
circle(d = tabsize/2);
}
}
render() {
union() {
difference() {
solidshape(wall_thickness, 0);
solidshape(0,-wall_thickness);
}
if (tab)
{
rotate([0,0,tabpos])
translate([0, radius_top, 0])
tabshape();
}
}
}