3d-prints/parametric_funnel/Funnel.scad

94 lines
No EOL
2.3 KiB
OpenSCAD

use <measurement.scad>
diameter_top = 80;
diameter_throat = 15;
diameter_bottom = 10;
height_top = 100;
height_bottom = 80;
wall_thickness = 2;
vent_pct = 10;
tab = true;
$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/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 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);
render() {
difference() {
union() {
translate([0,0,h+fuzz])
cylinder(ht+fuzz, t, ft);
translate([0,0,ht+h+h])
cylinder(hb, m, b);
}
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));
translate([m-vm, -m, ht+fuzz])
rotate([0,-ab,0])
#cube([m*2, m*2, hb*1.2]);
translate([t+t-m-vt-vt+vm+fuzz+fuzz, -t, -ht+fuzz])
rotate([0,-at,0])
cube([t*2, t*2, tcl*1.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,-fuzz);
}
if (tab)
{
rotate([0,0,tabpos])
translate([0, radius_top, 0])
tabshape();
}
}
}