Merge pull request #107 from Ruudjhuu/fix/static_hole_location

fix dynamic hole location on grid length
This commit is contained in:
Daniel Manz 2023-05-31 18:46:48 +02:00 committed by GitHub
commit f43950bba8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 89 additions and 92 deletions

View file

@ -1,4 +1,5 @@
include <gridfinity-rebuilt-utility.scad> include <gridfinity-rebuilt-utility.scad>
include <standard.scad>
// ===== INFORMATION ===== // // ===== INFORMATION ===== //
/* /*
@ -18,9 +19,7 @@ $fs = 0.25;
// number of bases along x-axis // number of bases along x-axis
gridx = 5; gridx = 5;
// number of bases along y-axis // number of bases along y-axis
gridy = 5; gridy = 5;
// base unit
length = 42;
/* [Screw Together Settings - Defaults work for M3 and 4-40] */ /* [Screw Together Settings - Defaults work for M3 and 4-40] */
// screw diameter // screw diameter
@ -61,7 +60,7 @@ style_hole = 2; // [0:none, 1:contersink, 2:counterbore]
screw_together = (style_plate == 3 || style_plate == 4); screw_together = (style_plate == 3 || style_plate == 4);
color("tomato") color("tomato")
gridfinityBaseplate(gridx, gridy, length, distancex, distancey, style_plate, enable_magnet, style_hole, fitx, fity); gridfinityBaseplate(gridx, gridy, l_grid, distancex, distancey, style_plate, enable_magnet, style_hole, fitx, fity);
// ===== CONSTRUCTION ===== // // ===== CONSTRUCTION ===== //
@ -151,7 +150,7 @@ module cutter_weight() {
} }
module hole_pattern(){ module hole_pattern(){
pattern_circular(4) pattern_circular(4)
translate([d_hole/2, d_hole/2, 0]) { translate([l_grid/2-d_hole_from_side, l_grid/2-d_hole_from_side, 0]) {
render(); render();
children(); children();
} }
@ -179,12 +178,12 @@ module cutter_counterbore(){
} }
module profile_skeleton() { module profile_skeleton() {
l = length-2*r_c2-2*r_c1; l = l_grid-2*r_c2-2*r_c1;
minkowski() { minkowski() {
difference() { difference() {
square([l-2*r_skel+2*d_clear,l-2*r_skel+2*d_clear], center = true); square([l-2*r_skel+2*d_clear,l-2*r_skel+2*d_clear], center = true);
pattern_circular(4) pattern_circular(4)
translate([d_hole/2,d_hole/2,0]) translate([l_grid/2-d_hole_from_side,l_grid/2-d_hole_from_side,0])
minkowski() { minkowski() {
square([l,l]); square([l,l]);
circle(r_hole2+r_skel+2); circle(r_hole2+r_skel+2);
@ -202,10 +201,10 @@ module cutter_screw_together(gx, gy, off) {
module screw(a, b) { module screw(a, b) {
copy_mirror([1,0,0]) copy_mirror([1,0,0])
translate([a*length/2, 0, -off/2]) translate([a*l_grid/2, 0, -off/2])
pattern_linear(1, b, 1, length) pattern_linear(1, b, 1, l_grid)
pattern_linear(1, n_screws, 1, d_screw_head + screw_spacing) pattern_linear(1, n_screws, 1, d_screw_head + screw_spacing)
rotate([0,90,0]) rotate([0,90,0])
cylinder(h=length/2, d=d_screw, center = true); cylinder(h=l_grid/2, d=d_screw, center = true);
} }
} }

View file

@ -33,9 +33,7 @@ gridx = 5;
// number of bases along y-axis // number of bases along y-axis
gridy = 5; gridy = 5;
// bin height. See bin height information and "gridz_define" below. // bin height. See bin height information and "gridz_define" below.
gridz = 6; gridz = 6;
// base unit
length = 42;
/* [Compartments] */ /* [Compartments] */
// number of X Divisions (set to zero to have solid bin) // number of X Divisions (set to zero to have solid bin)
@ -73,12 +71,12 @@ div_base_y = 0;
// ===== IMPLEMENTATION ===== // // ===== IMPLEMENTATION ===== //
color("tomato") { color("tomato") {
gridfinityInit(gridx, gridy, height(gridz, gridz_define, style_lip, enable_zsnap), height_internal, length) { gridfinityInit(gridx, gridy, height(gridz, gridz_define, style_lip, enable_zsnap), height_internal) {
if (divx > 0 && divy > 0) if (divx > 0 && divy > 0)
cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, scoop_weight = scoop); cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, scoop_weight = scoop);
} }
gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole*(style_corners?p_corn:1)); gridfinityBase(gridx, gridy, l_grid, div_base_x, div_base_y, style_hole*(style_corners?p_corn:1));
} }

View file

@ -20,9 +20,7 @@ gridx = 3;
// number of bases along y-axis // number of bases along y-axis
gridy = 3; gridy = 3;
// bin height. See bin height information and "gridz_define" below. // bin height. See bin height information and "gridz_define" below.
gridz = 6; gridz = 6;
// base unit
length = 42;
/* [Compartments] */ /* [Compartments] */
// number of X Divisions // number of X Divisions
@ -58,7 +56,7 @@ bottom_layer = 1;
// Input all the cutter types in here // Input all the cutter types in here
color("tomato") color("tomato")
gridfinityLite(gridx, gridy, gridz, gridz_define, style_lip, enable_zsnap, length, div_base_x, div_base_y, style_hole) { gridfinityLite(gridx, gridy, gridz, gridz_define, style_lip, enable_zsnap, l_grid, div_base_x, div_base_y, style_hole) {
cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, scoop_weight = 0); cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, scoop_weight = 0);
} }

View file

@ -1,7 +1,7 @@
// UTILITY FILE, DO NOT EDIT // UTILITY FILE, DO NOT EDIT
// EDIT OTHER FILES IN REPO FOR RESULTS // EDIT OTHER FILES IN REPO FOR RESULTS
include <gridfinity-constants.scad> include <standard.scad>
// ===== User Modules ===== // // ===== User Modules ===== //
@ -23,7 +23,7 @@ module cutEqual(n_divx=1, n_divy=1, style_tab=1, scoop_weight=1) {
} }
// initialize gridfinity // initialize gridfinity
module gridfinityInit(gx, gy, h, h0 = 0, l) { module gridfinityInit(gx, gy, h, h0 = 0, l = l_grid) {
$gxx = gx; $gxx = gx;
$gyy = gy; $gyy = gy;
$dh = h; $dh = h;
@ -112,8 +112,8 @@ module block_base(gx, gy, l, dbnx, dbny, style_hole, off) {
pattern_linear(2, 2, (gx-1)*length+d_hole, (gy-1)*length+d_hole) pattern_linear(2, 2, (gx-1)*length+d_hole, (gy-1)*length+d_hole)
block_base_hole(style_hole / p_corn, off); block_base_hole(style_hole / p_corn, off);
else else
pattern_circular(abs(d_hole)<0.001?1:4) pattern_circular(abs(l-d_hole_from_side/2)<0.001?1:4)
translate([d_hole/2, d_hole/2, 0]) translate([l/2-d_hole_from_side, l/2-d_hole_from_side, 0])
block_base_hole(style_hole, off); block_base_hole(style_hole, off);
} }
} }
@ -191,7 +191,7 @@ module profile_wall() {
} }
// remove any negtive geometry in edge cases // remove any negtive geometry in edge cases
mirror([0,1,0]) mirror([0,1,0])
square(100*length); square(100*l_grid);
} }
} }
@ -214,8 +214,8 @@ module block_bottom( h = 2.2, gx, gy, l ) {
} }
module cut_move_unsafe(x, y, w, h) { module cut_move_unsafe(x, y, w, h) {
xx = ($gxx*length+d_magic); xx = ($gxx*l_grid+d_magic);
yy = ($gyy*length+d_magic); yy = ($gyy*l_grid+d_magic);
translate([(x)*xx/$gxx,(y)*yy/$gyy,0]) translate([(x)*xx/$gxx,(y)*yy/$gyy,0])
translate([(-xx+d_div)/2,(-yy+d_div)/2,0]) translate([(-xx+d_div)/2,(-yy+d_div)/2,0])
translate([(w*xx/$gxx-d_div)/2,(h*yy/$gyy-d_div)/2,0]) translate([(w*xx/$gxx-d_div)/2,(h*yy/$gyy-d_div)/2,0])
@ -237,8 +237,8 @@ module block_cutter(x,y,w,h,t,s) {
xcutlast = abs(x+w-$gxx)<0.001 && style_lip == 0; xcutlast = abs(x+w-$gxx)<0.001 && style_lip == 0;
zsmall = ($dh+h_base)/7 < 3; zsmall = ($dh+h_base)/7 < 3;
ylen = h*($gyy*length+d_magic)/$gyy-d_div; ylen = h*($gyy*l_grid+d_magic)/$gyy-d_div;
xlen = w*($gxx*length+d_magic)/$gxx-d_div; xlen = w*($gxx*l_grid+d_magic)/$gxx-d_div;
height = $dh; height = $dh;
extent = (abs(s) > 0 && ycutfirst ? d_wall2-d_wall-d_clear : 0); extent = (abs(s) > 0 && ycutfirst ? d_wall2-d_wall-d_clear : 0);

View file

@ -31,9 +31,7 @@ gridx = 1;
// number of bases along y-axis // number of bases along y-axis
gridy = 1; gridy = 1;
// bin height. See bin height information and "gridz_define" below. // bin height. See bin height information and "gridz_define" below.
gridz = 6; gridz = 6;
// base unit
length = 42;
// number of compartments along x-axis // number of compartments along x-axis
n_divx = 2; n_divx = 2;
@ -76,20 +74,20 @@ else gridfinityVase(); // Generate the bin
// ===== CONSTRUCTION ===== // // ===== CONSTRUCTION ===== //
d_bottom = layer*(max(bottom_layer,1)); d_bottom = layer*(max(bottom_layer,1));
x_l = length/2; x_l = l_grid/2;
dht = (gridz_define==0)?gridz*7 : (gridz_define==1)?h_bot+gridz+h_base : gridz-(enable_lip?3.8:0); dht = (gridz_define==0)?gridz*7 : (gridz_define==1)?h_bot+gridz+h_base : gridz-(enable_lip?3.8:0);
d_height = (enable_zsnap?((abs(dht)%7==0)?dht:dht+7-abs(dht)%7):dht)-h_base; d_height = (enable_zsnap?((abs(dht)%7==0)?dht:dht+7-abs(dht)%7):dht)-h_base;
f2c = sqrt(2)*(sqrt(2)-1); // fillet to chamfer ratio f2c = sqrt(2)*(sqrt(2)-1); // fillet to chamfer ratio
me = ((gridx*length-0.5)/n_divx)-nozzle*4-r_fo1-12.7-4; me = ((gridx*l_grid-0.5)/n_divx)-nozzle*4-r_fo1-12.7-4;
m = min(d_tabw/1.8 + max(0,me), d_tabw/1.25); m = min(d_tabw/1.8 + max(0,me), d_tabw/1.25);
d_ramp = f2c*(length*((d_height-2)/7+1)/12-r_f2)+d_wall2; d_ramp = f2c*(l_grid*((d_height-2)/7+1)/12-r_f2)+d_wall2;
d_edge = ((gridx*length-0.5)/n_divx-d_tabw-r_fo1)/2; d_edge = ((gridx*l_grid-0.5)/n_divx-d_tabw-r_fo1)/2;
n_st = gridz <= 3 ? 6 : d_edge < 2 && style_tab != 0 && style_tab != 6 ? 1 : style_tab == 1 && n_divx <= 1? 0 : style_tab; n_st = gridz <= 3 ? 6 : d_edge < 2 && style_tab != 0 && style_tab != 6 ? 1 : style_tab == 1 && n_divx <= 1? 0 : style_tab;
n_x = (n_st==0?1:n_divx); n_x = (n_st==0?1:n_divx);
spacing = (gridx*length-0.5)/(n_divx); spacing = (gridx*l_grid-0.5)/(n_divx);
shift = n_st==3?-1:n_st==5?1:0; shift = n_st==3?-1:n_st==5?1:0;
shiftauto = function (a,b) n_st!=2?0:a==1?-1:a==b?1:0; shiftauto = function (a,b) n_st!=2?0:a==1?-1:a==b?1:0;
@ -110,39 +108,39 @@ module gridfinityVase() {
if (n_st != 6) if (n_st != 6)
transform_style() transform_style()
transform_vtab_base((n_st<2?gridx*length/n_x-0.5-r_fo1:d_tabw)-nozzle*4) transform_vtab_base((n_st<2?gridx*l_grid/n_x-0.5-r_fo1:d_tabw)-nozzle*4)
block_tab_base(-nozzle*sqrt(2)); block_tab_base(-nozzle*sqrt(2));
} }
if (enable_scoop_chamfer) if (enable_scoop_chamfer)
intersection() { intersection() {
block_vase(); block_vase();
translate([0,gridy*length/2-0.25-d_wall2/2,d_height/2+0.1]) translate([0,gridy*l_grid/2-0.25-d_wall2/2,d_height/2+0.1])
cube([gridx*length,d_wall2,d_height-0.2],center=true); cube([gridx*l_grid,d_wall2,d_height-0.2],center=true);
} }
if (enable_funnel && gridz > 3) if (enable_funnel && gridz > 3)
pattern_linear((n_st==0?n_divx>1?n_divx:gridx:1), 1, (gridx*length-r_fo1)/(n_st==0?n_divx>1?n_divx:gridx:1)) pattern_linear((n_st==0?n_divx>1?n_divx:gridx:1), 1, (gridx*l_grid-r_fo1)/(n_st==0?n_divx>1?n_divx:gridx:1))
transform_funnel() transform_funnel()
block_funnel_outside(); block_funnel_outside();
if (n_divx > 1) if (n_divx > 1)
pattern_linear(n_divx-1,1,(gridx*length-0.5)/(n_divx)) pattern_linear(n_divx-1,1,(gridx*l_grid-0.5)/(n_divx))
block_divider(); block_divider();
if (n_divx < 1) if (n_divx < 1)
pattern_linear(n_st == 0 ? n_divx>1 ? n_divx-1 : gridx-1 : 1, 1, (gridx*length-r_fo1)/((n_divx>1 ? n_divx : gridx))) pattern_linear(n_st == 0 ? n_divx>1 ? n_divx-1 : gridx-1 : 1, 1, (gridx*l_grid-r_fo1)/((n_divx>1 ? n_divx : gridx)))
block_tabsupport(); block_tabsupport();
} }
if (enable_funnel && gridz > 3) if (enable_funnel && gridz > 3)
pattern_linear((n_st==0?n_divx>1?n_divx:gridx:1), 1, (gridx*length-r_fo1)/(n_st==0?n_divx>1?n_divx:gridx:1)) pattern_linear((n_st==0?n_divx>1?n_divx:gridx:1), 1, (gridx*l_grid-r_fo1)/(n_st==0?n_divx>1?n_divx:gridx:1))
transform_funnel() transform_funnel()
block_funnel_inside(); block_funnel_inside();
if (!enable_lip) if (!enable_lip)
translate([0,0,1.5*d_height]) translate([0,0,1.5*d_height])
cube([gridx*length,gridy*length,d_height], center=true); cube([gridx*l_grid,gridy*l_grid,d_height], center=true);
block_x(); block_x();
block_inset(); block_inset();
@ -151,7 +149,7 @@ module gridfinityVase() {
if (bottom_layer <= 0) if (bottom_layer <= 0)
translate([0,0,-50+layer+0.01]) translate([0,0,-50+layer+0.01])
cube([gridx*length*10,gridy*length*10,100], center=true); cube([gridx*l_grid*10,gridy*l_grid*10,100], center=true);
} }
} }
@ -162,18 +160,18 @@ module gridfinityBaseVase() {
intersection() { intersection() {
block_base_blank(0); block_base_blank(0);
translate([0,0,-h_base-1]) translate([0,0,-h_base-1])
rounded_rectangle(length-0.5-0.005, length-0.5-0.005, h_base*10, r_fo1/2+0.001); rounded_rectangle(l_grid-0.5-0.005, l_grid-0.5-0.005, h_base*10, r_fo1/2+0.001);
} }
translate([0,0,0.01]) translate([0,0,0.01])
difference() { difference() {
block_base_blank(nozzle*4); block_base_blank(nozzle*4);
translate([0,0,-h_base]) translate([0,0,-h_base])
cube([length*2,length*2,d_bottom*2],center=true); cube([l_grid*2,l_grid*2,d_bottom*2],center=true);
} }
// magic slice // magic slice
rotate([0,0,90]) rotate([0,0,90])
translate([0,0,-h_base+d_bottom+0.01]) translate([0,0,-h_base+d_bottom+0.01])
cube([0.001,length*gridx,d_height+d_bottom*2]); cube([0.001,l_grid*gridx,d_height+d_bottom*2]);
} }
@ -181,7 +179,7 @@ module gridfinityBaseVase() {
intersection() { intersection() {
rotate([0,0,45]) rotate([0,0,45])
translate([-nozzle,3,-h_base+d_bottom+0.01]) translate([-nozzle,3,-h_base+d_bottom+0.01])
cube([nozzle*2,length*gridx,d_height+d_bottom*2]); cube([nozzle*2,l_grid*gridx,d_height+d_bottom*2]);
block_base_blank(nozzle*4-0.1); block_base_blank(nozzle*4-0.1);
} }
@ -194,7 +192,7 @@ module gridfinityBaseVase() {
block_magnet_blank(0, false); block_magnet_blank(0, false);
translate([0,0,h_base/2]) translate([0,0,h_base/2])
cube([length*2, length*2, h_base], center = true); cube([l_grid*2, l_grid*2, h_base], center = true);
} }
if (style_base != 4) if (style_base != 4)
@ -218,19 +216,19 @@ module block_magnet_blank(o = 0, half = true) {
module block_base_blank(o = 0) { module block_base_blank(o = 0) {
mirror([0,0,1]) { mirror([0,0,1]) {
hull() { hull() {
rounded_square(length-o-0.05-2*r_c2-2*r_c1, h_base, r_fo3/2); rounded_square(l_grid-o-0.05-2*r_c2-2*r_c1, h_base, r_fo3/2);
rounded_square(length-o-0.05-2*r_c2, h_base-r_c1, r_fo2/2); rounded_square(l_grid-o-0.05-2*r_c2, h_base-r_c1, r_fo2/2);
} }
hull() { hull() {
rounded_square(length-o-0.05-2*r_c2, r_c2, r_fo2/2); rounded_square(l_grid-o-0.05-2*r_c2, r_c2, r_fo2/2);
mirror([0,0,1]) mirror([0,0,1])
rounded_square(length-o-0.05, d_bottom, r_fo1/2); rounded_square(l_grid-o-0.05, d_bottom, r_fo1/2);
} }
} }
} }
module block_pinch() { module block_pinch() {
sweep_rounded(gridx*length-2*r_base-0.5-0.001, gridy*length-2*r_base-0.5-0.001) sweep_rounded(gridx*l_grid-2*r_base-0.5-0.001, gridy*l_grid-2*r_base-0.5-0.001)
translate([r_base,0,0]) translate([r_base,0,0])
mirror([1,0,0]) mirror([1,0,0])
translate([0,-(-d_height-h_base/2+r_c1),0]) translate([0,-(-d_height-h_base/2+r_c1),0])
@ -257,9 +255,9 @@ module block_tabsupport() {
translate([0,0,0.1]) translate([0,0,0.1])
block_vase(d_height*4); block_vase(d_height*4);
cube([nozzle*2, gridy*length, d_height*3], center=true); cube([nozzle*2, gridy*l_grid, d_height*3], center=true);
transform_vtab_base(gridx*length*2) transform_vtab_base(gridx*l_grid*2)
block_tab_base(-nozzle*sqrt(2)); block_tab_base(-nozzle*sqrt(2));
} }
} }
@ -269,21 +267,21 @@ module block_divider() {
intersection() { intersection() {
translate([0,0,0.1]) translate([0,0,0.1])
block_vase(); block_vase();
cube([nozzle*2, gridy*length, d_height*2], center=true); cube([nozzle*2, gridy*l_grid, d_height*2], center=true);
} }
if (n_st == 0) block_tab(0.1); if (n_st == 0) block_tab(0.1);
else block_divider_edgecut(); else block_divider_edgecut();
// cut divider clearance on negative Y side // cut divider clearance on negative Y side
translate([-gridx*length/2,-(gridy*length/2-0.25),0]) translate([-gridx*l_grid/2,-(gridy*l_grid/2-0.25),0])
cube([gridx*length,nozzle*2+0.1,d_height*2]); cube([gridx*l_grid,nozzle*2+0.1,d_height*2]);
// cut divider clearance on positive Y side // cut divider clearance on positive Y side
mirror([0,1,0]) mirror([0,1,0])
if (enable_scoop_chamfer) if (enable_scoop_chamfer)
translate([-gridx*length/2,-(gridy*length/2-0.25),0]) translate([-gridx*l_grid/2,-(gridy*l_grid/2-0.25),0])
cube([gridx*length,d_wall2+0.1,d_height*2]); cube([gridx*l_grid,d_wall2+0.1,d_height*2]);
else block_divider_edgecut(); else block_divider_edgecut();
// cut divider to have clearance with scoop // cut divider to have clearance with scoop
@ -304,25 +302,25 @@ module block_divider() {
if (2*i*layer < d_height-layer/2-d_bottom-0.1) if (2*i*layer < d_height-layer/2-d_bottom-0.1)
mirror([0,1,0]) mirror([0,1,0])
translate([0,(gridy*length/2-0.25-nozzle)/2,layer/2+d_bottom+2*i*layer]) translate([0,(gridy*l_grid/2-0.25-nozzle)/2,layer/2+d_bottom+2*i*layer])
cube([nozzle*2-0.01,gridy*length/2-0.25-nozzle,layer],center=true); cube([nozzle*2-0.01,gridy*l_grid/2-0.25-nozzle,layer],center=true);
if ((2*i+1)*layer < d_height-layer/2-d_bottom-0.1) if ((2*i+1)*layer < d_height-layer/2-d_bottom-0.1)
translate([0,(gridy*length/2-0.25-nozzle)/2,layer/2+d_bottom+(2*i+1)*layer]) translate([0,(gridy*l_grid/2-0.25-nozzle)/2,layer/2+d_bottom+(2*i+1)*layer])
cube([nozzle*2-0.01,gridy*length/2-0.25-nozzle,layer],center=true); cube([nozzle*2-0.01,gridy*l_grid/2-0.25-nozzle,layer],center=true);
} }
// divider slices cut to tabs // divider slices cut to tabs
if (n_st == 0) if (n_st == 0)
transform_style() transform_style()
transform_vtab_base((n_st<2?gridx*length/n_x-0.5-r_fo1:d_tabw)-nozzle*4) transform_vtab_base((n_st<2?gridx*l_grid/n_x-0.5-r_fo1:d_tabw)-nozzle*4)
block_tab_base(-nozzle*sqrt(2)); block_tab_base(-nozzle*sqrt(2));
} }
} }
module block_divider_edgecut() { module block_divider_edgecut() {
translate([-50,-gridy*length/2+0.25,0]) translate([-50,-gridy*l_grid/2+0.25,0])
rotate([90,0,90]) rotate([90,0,90])
linear_extrude(100) linear_extrude(100)
offset(delta = 0.1) offset(delta = 0.1)
@ -359,9 +357,9 @@ module block_vase_base() {
translate([0,0,-h_base]) { translate([0,0,-h_base]) {
translate([0,0,-0.1]) translate([0,0,-0.1])
color("firebrick") color("firebrick")
block_bottom(d_bottom, gridx, gridy, length); block_bottom(d_bottom, gridx, gridy, l_grid);
color("royalblue") color("royalblue")
block_wall(gridx, gridy, length) { block_wall(gridx, gridy, l_grid) {
if (enable_lip) profile_wall(); if (enable_lip) profile_wall();
else profile_wall2(); else profile_wall2();
} }
@ -371,7 +369,7 @@ module block_vase_base() {
rotate([0,0,90]) rotate([0,0,90])
mirror([0,1,0]) mirror([0,1,0])
translate([0,0,d_bottom+0.001]) translate([0,0,d_bottom+0.001])
cube([0.001,length*gridx,d_height+d_bottom*2]); cube([0.001,l_grid*gridx,d_height+d_bottom*2]);
} }
// scoop piece // scoop piece
@ -392,7 +390,7 @@ module block_vase_base() {
translate([shiftauto(i,n_x)*d_edge + shift*d_edge,0,0]) translate([shiftauto(i,n_x)*d_edge + shift*d_edge,0,0])
intersection() { intersection() {
block_vase(); block_vase();
transform_vtab_base(n_st<2?gridx*length/n_x-0.5-r_fo1:d_tabw) transform_vtab_base(n_st<2?gridx*l_grid/n_x-0.5-r_fo1:d_tabw)
profile_tab(); profile_tab();
} }
} }
@ -409,7 +407,7 @@ module profile_wall_sub_sub() {
} }
module block_inset() { module block_inset() {
ixx = (gridx*length-0.5)/2; ixx = (gridx*l_grid-0.5)/2;
iyy = d_height/1.875; iyy = d_height/1.875;
izz = sqrt(ixx^2+iyy^2)*tan(40); izz = sqrt(ixx^2+iyy^2)*tan(40);
if (enable_scoop_chamfer && enable_inset) if (enable_scoop_chamfer && enable_inset)
@ -417,7 +415,7 @@ module block_inset() {
intersection() { intersection() {
rotate([0,90,0]) rotate([0,90,0])
translate([-iyy,0,0]) translate([-iyy,0,0])
block_inset_sub(iyy, gridx*length, 45); block_inset_sub(iyy, gridx*l_grid, 45);
rotate([0,90,0]) rotate([0,90,0])
translate([-iyy,0,0]) translate([-iyy,0,0])
@ -426,13 +424,13 @@ module block_inset() {
} }
mirror([0,1,0]) mirror([0,1,0])
translate([-gridx*length/2,-(gridy*length-0.5)/2+d_wall2-2*nozzle,0]) translate([-gridx*l_grid/2,-(gridy*l_grid-0.5)/2+d_wall2-2*nozzle,0])
cube([gridx*length,izz,d_height*2]); cube([gridx*l_grid,izz,d_height*2]);
} }
} }
module block_inset_sub(x, y, ang) { module block_inset_sub(x, y, ang) {
translate([0,(gridy*length-0.5)/2+r_fo1/2,0]) translate([0,(gridy*l_grid-0.5)/2+r_fo1/2,0])
mirror([0,1,0]) mirror([0,1,0])
linear_extrude(y,center=true) linear_extrude(y,center=true)
polygon([[-x,0],[x,0],[0,x*tan(ang)]]); polygon([[-x,0],[x,0],[0,x*tan(ang)]]);
@ -447,11 +445,11 @@ module transform_style() {
} }
module block_flushscoop() { module block_flushscoop() {
translate([0,gridy*length/2-d_wall2-nozzle/2-1,d_height/2]) translate([0,gridy*l_grid/2-d_wall2-nozzle/2-1,d_height/2])
linear_extrude(d_height) linear_extrude(d_height)
union() { union() {
copy_mirror([1,0,0]) copy_mirror([1,0,0])
polygon([[0,0],[gridx*length/2-r_fo1/2,0],[gridx*length/2-r_fo1/2,1],[gridx*length/2-r_fo1/2-r_c1*5,d_wall2-nozzle*2+1],[0,d_wall2-nozzle*2+1]]); polygon([[0,0],[gridx*l_grid/2-r_fo1/2,0],[gridx*l_grid/2-r_fo1/2,1],[gridx*l_grid/2-r_fo1/2-r_c1*5,d_wall2-nozzle*2+1],[0,d_wall2-nozzle*2+1]]);
} }
transform_scoop() transform_scoop()
@ -470,27 +468,27 @@ module profile_tabscoop(m) {
} }
module block_tabscoop(a=m, b=0, c=0, d=-1) { module block_tabscoop(a=m, b=0, c=0, d=-1) {
translate([0,d_tabh*cos(a_tab)-length*gridy/2+0.25+b,0]) translate([0,d_tabh*cos(a_tab)-l_grid*gridy/2+0.25+b,0])
difference() { difference() {
translate([0,0,-d_tabh*sin(a_tab)*2+d_height+2.1]) translate([0,0,-d_tabh*sin(a_tab)*2+d_height+2.1])
profile_tabscoop(a); profile_tabscoop(a);
translate([-gridx*length/2,-m,-m]) translate([-gridx*l_grid/2,-m,-m])
cube([gridx*length,m-d_tabh*cos(a_tab)+0.005+c,d_height*20]); cube([gridx*l_grid,m-d_tabh*cos(a_tab)+0.005+c,d_height*20]);
if (d >= 0) if (d >= 0)
translate([0,0,-d_tabh*sin(a_tab)+d_height+m/2+d+2.1]) translate([0,0,-d_tabh*sin(a_tab)+d_height+m/2+d+2.1])
cube([gridx*length,gridy*length,m],center=true); cube([gridx*l_grid,gridy*l_grid,m],center=true);
} }
} }
module transform_vtab(a=0,b=1) { module transform_vtab(a=0,b=1) {
transform_vtab_base(gridx*length/b-0.5-r_fo1+a) transform_vtab_base(gridx*l_grid/b-0.5-r_fo1+a)
children(); children();
} }
module transform_vtab_base(a) { module transform_vtab_base(a) {
translate([0,d_tabh*cos(a_tab)-length*gridy/2+0.25,-d_tabh*sin(a_tab)+d_height+2.1]) translate([0,d_tabh*cos(a_tab)-l_grid*gridy/2+0.25,-d_tabh*sin(a_tab)+d_height+2.1])
rotate([90,0,270]) rotate([90,0,270])
linear_extrude(a, center=true) linear_extrude(a, center=true)
children(); children();
@ -506,23 +504,23 @@ module block_tab_base(del) {
union() { union() {
profile_tab(); profile_tab();
translate([d_tabh*cos(a_tab),-d_tabh*sin(a_tab),0]) translate([d_tabh*cos(a_tab),-d_tabh*sin(a_tab),0])
square([length,d_tabh*sin(a_tab)*2]); square([l_grid,d_tabh*sin(a_tab)*2]);
} }
} }
module transform_scoop() { module transform_scoop() {
intersection() { intersection() {
block_vase(); block_vase();
translate([0,gridy*length/2-d_ramp,layer*max(bottom_layer*1)]) translate([0,gridy*l_grid/2-d_ramp,layer*max(bottom_layer*1)])
rotate([90,0,90]) rotate([90,0,90])
linear_extrude(2*length*gridx,center=true) linear_extrude(2*l_grid*gridx,center=true)
children(); children();
} }
} }
module block_vase(h = d_height*2) { module block_vase(h = d_height*2) {
translate([0,0,-0.1]) translate([0,0,-0.1])
rounded_rectangle(gridx*length-0.5-nozzle, gridy*length-0.5-nozzle, h, r_base+0.01-nozzle/2); rounded_rectangle(gridx*l_grid-0.5-nozzle, gridy*l_grid-0.5-nozzle, h, r_base+0.01-nozzle/2);
} }
module profile_x(x_f = 3) { module profile_x(x_f = 3) {
@ -541,11 +539,11 @@ module profile_x(x_f = 3) {
} }
module block_x() { module block_x() {
translate([-(gridx-1)*length/2,-(gridy-1)*length/2,0]) translate([-(gridx-1)*l_grid/2,-(gridy-1)*l_grid/2,0])
for (i = [1:gridx]) for (i = [1:gridx])
for (j = [1:gridy]) for (j = [1:gridy])
if (xFunc[style_base](i,j)) if (xFunc[style_base](i,j))
translate([(i-1)*length,(j-1)*length,0]) translate([(i-1)*l_grid,(j-1)*l_grid,0])
block_x_sub(); block_x_sub();
} }

View file

@ -15,13 +15,17 @@ r_fo1 = 8.5;
r_fo2 = 3.2; r_fo2 = 3.2;
// outside radii 3 // outside radii 3
r_fo3 = 1.6; r_fo3 = 1.6;
// length of a grid unit
l_grid = 42;
// screw hole radius // screw hole radius
r_hole1 = 1.5; r_hole1 = 1.5;
// magnet hole radius // magnet hole radius
r_hole2 = 3.25; r_hole2 = 3.25;
// center-to-center distance between holes // center-to-center distance between holes
d_hole = 26; d_hole = 26;
// distance of hole from side of bin
d_hole_from_side=8;
// magnet hole depth // magnet hole depth
h_hole = 2.4; h_hole = 2.4;
// slit depth (printer layer height) // slit depth (printer layer height)