chore: remove cutByRatio helper util (for now)

This commit is contained in:
pimlie 2024-12-09 23:36:19 +01:00
parent c0a34d6fce
commit 621b5ec128
2 changed files with 1 additions and 49 deletions

View file

@ -68,13 +68,6 @@ c_depth = 1;
// chamfer around the top rim of the holes // chamfer around the top rim of the holes
c_chamfer = 0.5; // .1 c_chamfer = 0.5; // .1
/* [Split Compartments] */
// divide into 2 compartments by this ratio
ratiox = 0; // [0:0.001:1]
// divide into 2 compartments by this ratio
ratioy = 0; // [0:0.001:1]
/* [Height] */ /* [Height] */
// determine what the variable "gridz" applies to based on your use case // determine what the variable "gridz" applies to based on your use case
gridz_define = 0; // [0:gridz is the height of bins in units of 7mm increments - Zack's method,1:gridz is the internal height in millimeters, 2:gridz is the overall external height of the bin in millimeters] gridz_define = 0; // [0:gridz is the height of bins in units of 7mm increments - Zack's method,1:gridz is the internal height in millimeters, 2:gridz is the overall external height of the bin in millimeters]
@ -120,11 +113,7 @@ hole_options = bundle_hole_options(refined_holes, magnet_holes, screw_holes, cru
color("tomato") { color("tomato") {
gridfinityInit(gridx, gridy, height(gridz, gridz_define, style_lip, enable_zsnap), height_internal, sl=style_lip, extra=[extrax,extray]) { gridfinityInit(gridx, gridy, height(gridz, gridz_define, style_lip, enable_zsnap), height_internal, sl=style_lip, extra=[extrax,extray]) {
if ((ratiox > 0 && ratiox < 1) || (ratioy > 0 && ratioy < 1)) { if (divx > 0 && divy > 0) {
cutByRatio(rx = ratiox, ry = ratioy, style_tab = style_tab, scoop_weight = scoop, place_tab = place_tab);
} else if (divx > 0 && divy > 0) {
cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, scoop_weight = scoop, place_tab = place_tab); cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, scoop_weight = scoop, place_tab = place_tab);

View file

@ -148,43 +148,6 @@ module cutCylinders(n_divx=1, n_divy=1, cylinder_diameter=1, cylinder_height=1,
} }
} }
// Create two or four cutters for the bin divided by the given ratio (max 4 cutouts per bin)
//
// rx: ratio to divide x-axis by
// ry: ratio to divide y-axis by
// style_tab: tab style for all compartments. see cut()
// scoop_weight: scoop toggle for all compartments. see cut()
// place_tab: tab suppression for all compartments. see "gridfinity-rebuilt-bins.scad"
module cutByRatio(rx=1, ry=1, style_tab=1, scoop_weight=1, place_tab=1) {
n_divx=rx > 0 && rx < 1 ? 2 : 1;
n_divy=ry > 0 && ry < 1 ? 2 : 1;
// opposite cut ratio
orx=1 - rx;
ory=1 - ry;
for (i = [1:n_divx])
for (j = [1:n_divy]) {
// disable style_tab if only Top-Left Division checked
tab_style=place_tab == 1 && (i != 1 || j != n_divy) ? 5 : style_tab;
cut(
(i - 1)*rx*$gxx,
(j - 1)*ry*$gyy,
(i == 1 ? rx : orx)*$gxx,
(j == 1 ? ry : ory)*$gyy,
tab_style,
scoop_weight,
offsets=[
($extrax < 0 ? (i == 1 ? 1 : orx) : (i-1)*rx)*$extrax,
($extray < 0 ? (j == 1 ? 1 : ory) : (j-1)*ry)*$extray,
(i == 1 ? rx : orx)*abs($extrax),
(j == 1 ? ry : ory)*abs($extray)
]
);
}
}
// initialize gridfinity // initialize gridfinity
// sl: lip style of this bin. // sl: lip style of this bin.
// 0:Regular lip, 1:Remove lip subtractively, 2:Remove lip and retain height // 0:Regular lip, 1:Remove lip subtractively, 2:Remove lip and retain height