3d-prints/remote_basket/Basket_with_hexgrid.scad

164 lines
4.4 KiB
OpenSCAD

diameter_top = 65;
diameter_throat = 36;
diameter_bottom = 10;
height_top = 95;
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/2;
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 hexgrid_center(hexsize, hexh, hexw, hexd, gridt) {
translate([-hexw/2,-hexd/2,-hexh/2]) hexgrid(hexsize, hexh, hexw, hexd, gridt);
}
module hexgrid(hexsize, hexh, hexw, hexd, gridt) {
intersection() {
hexgrid_only(hexsize, hexh, hexw, hexd, gridt);
cube([hexw, hexd, hexh]);
}
}
module hexgrid_only(hexsize, hexh, hexw, hexd, gridt) {
rotate([0,-90,-90])
for (Y = [0:(hexh/hexsize)+1]) {
for (X = [0:(hexw/hexsize)+2]) {
hexspaceY = (hexsize+gridt)*sin(60.1);
hexspaceX = (hexsize+gridt)*sin(48.6);
if (X % 2 == 0) {
translate([Y*hexspaceY,X*hexspaceX,0]) rotate([0,0,90])cylinder(h=hexd, d=hexsize, $fn=6);
} else {
translate([(Y+0.5)*hexspaceY,X*hexspaceX,0]) rotate([0,0,90]) cylinder(h=hexd, d=hexsize, $fn=6);
}
}
}
}
//color([0.5,0.5,1.0]) hexgrid_center(30, 200, 300, 400, 5);
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+1.2])
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() {
difference() {
union() {
difference() {
solidshape(wall_thickness, 0);
solidshape(0,-wall_thickness);
}
if (tab)
{
rotate([0,0,tabpos])
translate([0, radius_top, 0])
tabshape();
}
}
xs = 23;
translate([-xs+10,xs,height_top/2])
rotate([0,90,45])
hexgrid_center(5.7, 20, 68, 20, 1.1);
translate([-xs+10,-xs,height_top/2])
rotate([0,90,-45])
hexgrid_center(5.7, 20, 68, 20, 1.1);
translate([-xs-5,0,height_top/2])
rotate([0,90,90])
hexgrid_center(5.7, 20, 68, 20, 1.1);
}
}