mirror of
https://github.com/kennetek/gridfinity-rebuilt-openscad.git
synced 2024-12-22 14:53:25 +00:00
move cylindrical cutouts to utility
This commit is contained in:
parent
2dc165911a
commit
6202c73b21
2 changed files with 35 additions and 21 deletions
|
@ -92,27 +92,8 @@ gridfinityInit(gridx, gridy, height(gridz, gridz_define, style_lip, enable_zsnap
|
|||
cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, scoop_weight = scoop);
|
||||
|
||||
} else if (cdivx > 0 && cdivy > 0) {
|
||||
rotation = (c_orientation == 0)
|
||||
? [0,90,0]
|
||||
: (c_orientation == 1)
|
||||
? [90,0,0]
|
||||
: [0,0,0];
|
||||
|
||||
gridx_mm = gridx*l_grid;
|
||||
gridy_mm = gridy*l_grid;
|
||||
padding = 2;
|
||||
cutout_x = [gridx_mm-d_wall*2];
|
||||
cutout_y = [gridy_mm-d_wall*2];
|
||||
|
||||
cut_move(x=0, y=0, w=gridx, h=gridy) {
|
||||
translate([0,0,-c_depth]) {
|
||||
rounded_rectangle(cutout_x, cutout_y, c_depth*2, r_base);
|
||||
|
||||
pattern_linear(x=cdivx, y=cdivy, sx=(gridx_mm - 2)/cdivx, sy=(gridy_mm - 2)/cdivy)
|
||||
rotate(rotation)
|
||||
cylinder(r=cd/2, h=ch*2, center=true);
|
||||
}
|
||||
}
|
||||
cutCylinders(n_divx=cdivx, n_divy=cdivy, cylinder_diameter=cd, cylinder_height=ch, coutout_depth=c_depth, orientation=c_orientation);
|
||||
}
|
||||
}
|
||||
gridfinityBase(gridx, gridy, l_grid, div_base_x, div_base_y, style_hole, only_corners=only_corners);
|
||||
|
|
|
@ -22,6 +22,39 @@ module cutEqual(n_divx=1, n_divy=1, style_tab=1, scoop_weight=1) {
|
|||
cut((i-1)*$gxx/n_divx,(j-1)*$gyy/n_divy, $gxx/n_divx, $gyy/n_divy, style_tab, scoop_weight);
|
||||
}
|
||||
|
||||
// Creates equally divided cylindrical cutouts
|
||||
//
|
||||
// n_divx: number of x cutouts
|
||||
// n_divy: number of y cutouts
|
||||
// set n_div values to 0 for a solid bin
|
||||
// cylinder_diameter: diameter of cutouts
|
||||
// cylinder_height: height of cutouts
|
||||
// coutout_depth: offset from top to solid part of container
|
||||
// orientation: orientation of cylinder cutouts (0 = x direction, 1 = y direction, 2 = z direction)
|
||||
module cutCylinders(n_divx=1, n_divy=1, cylinder_diameter=1, cylinder_height=1, coutout_depth=0, orientation=0) {
|
||||
rotation = (orientation == 0)
|
||||
? [0,90,0]
|
||||
: (orientation == 1)
|
||||
? [90,0,0]
|
||||
: [0,0,0];
|
||||
|
||||
gridx_mm = $gxx*l_grid;
|
||||
gridy_mm = $gyy*l_grid;
|
||||
padding = 2;
|
||||
cutout_x = gridx_mm - d_wall*2;
|
||||
cutout_y = gridy_mm - d_wall*2;
|
||||
|
||||
cut_move(x=0, y=0, w=$gxx, h=$gyy) {
|
||||
translate([0,0,-coutout_depth]) {
|
||||
rounded_rectangle(cutout_x, cutout_y, coutout_depth*2, r_base);
|
||||
|
||||
pattern_linear(x=n_divx, y=n_divy, sx=(gridx_mm - 2)/n_divx, sy=(gridy_mm - 2)/n_divy)
|
||||
rotate(rotation)
|
||||
cylinder(r=cylinder_diameter/2, h=cylinder_height*2, center=true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// initialize gridfinity
|
||||
module gridfinityInit(gx, gy, h, h0 = 0, l = l_grid) {
|
||||
$gxx = gx;
|
||||
|
@ -65,7 +98,7 @@ module cut_move(x, y, w, h) {
|
|||
translate([0,0,$dh0==0?$dh+h_base:$dh0+h_base])
|
||||
cut_move_unsafe(clp(x,0,$gxx), clp(y,0,$gyy), clp(w,0,$gxx-x), clp(h,0,$gyy-y))
|
||||
children();
|
||||
}
|
||||
}
|
||||
|
||||
// ===== Modules ===== //
|
||||
|
||||
|
|
Loading…
Reference in a new issue