3d-prints/parametric_funnel/Funnel3.scad

110 lines
No EOL
3 KiB
OpenSCAD

module funnel(
diameter_top = 120,
diameter_throat = 15,
diameter_bottom = 10,
height_top = 100,
height_bottom = 80,
wall_thickness = 1.2,
vent_pct = 25,
tab = false)
{
$fn = 50;
fuzz = 0.1;
radius_top = diameter_top/2;
radius_throat = diameter_throat/2;
radius_bottom = diameter_bottom/2;
// y = mx + b
// mx = y - b
// m = (y - b) / x
// m = (y2 - y1) / (x2 - x1)
// (-radius_top,0) - (-radius_throat,height_top)
top_invslope = (radius_throat-radius_top) / -height_top;
bottom_invslope = (radius_bottom-radius_throat) / -height_bottom;
top_thickening = wall_thickness * top_invslope;
bottom_thickening = wall_thickness * bottom_invslope;
top_vent_pct = vent_pct/10;
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_topx(throat_vent, throat, angle, throat_h, hyp_b)
{
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_bottomx(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 ventblock_top(rt, rm, h1)
{
tsub = rt - (
angle = atan(() / ());
translate([rm, 0, 0])
rotate([0,0,180])
translate([0, -rm, h1-fuzz])
rotate([0,180+angle,0])
#cube([rt*2, rt*2, h1*2]);
}
module ventblock_bottom(rm, rb, h1, h2)
{
translate([throat_vent, -throat, throat_h-fuzz])
rotate([0,-angle,0])
#cube([rm*2, rm*2, h2*2]);
}
module p_solidfunnelshape(rt, rm, rb, h1, h2)
{
union() {
cylinder(h1+wall_thickness,rt,rm-top_thickening);
translate([0,0,h1])
cylinder(h2+wall_thickness,rm,rb-bottom_thickening);
}
}
module p_ventedfunnelshape(rt, rm, rb, h1, h2)
{
difference() {
p_solidfunnelshape(rt, rm, rb, h1, h2);
union() {
//ventblock_top(rm, rm, atan(top_invslope), h1, h1 + h2);
//ventblock_bottom(rm, rm, atan(bottom_invslope), h1, h1 + h2);
ventblock_top(rt, rm, h1);
ventblock_bottom(rm, rb, h1, h2);
}
}
}
module p_hollowfunnelshape(rt, rm, rb, h1, h2)
{
difference() {
//p_ventedfunnelshape(rt, rm, rb, h1, h2);
translate([0,0,-wall_thickness])
p_ventedfunnelshape(rt-wall_thickness, rm-wall_thickness, rb-wall_thickness, h1+wall_thickness, h2+wall_thickness);
}
}
module demofunnel()
{
render() p_hollowfunnelshape(radius_top, radius_throat, radius_bottom, height_top, height_bottom);
}
demofunnel();
}
funnel(150,50,40);