mirror of
https://github.com/kennetek/gridfinity-rebuilt-openscad.git
synced 2024-12-30 10:39:39 +00:00
Fix lite bases
Use a completely different method to generate both the keep out zone and the base.
This commit is contained in:
parent
c7dce9f6d5
commit
3e4d8702c4
2 changed files with 80 additions and 63 deletions
|
@ -69,6 +69,7 @@ hole_options = bundle_hole_options(refined_holes, magnet_holes, screw_holes, cru
|
|||
|
||||
// Input all the cutter types in here
|
||||
color("tomato")
|
||||
render()
|
||||
gridfinityLite(gridx, gridy, gridz, gridz_define, style_lip, enable_zsnap, l_grid, hole_options, only_corners) {
|
||||
cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, scoop_weight = 0);
|
||||
}
|
||||
|
@ -77,70 +78,24 @@ gridfinityLite(gridx, gridy, gridz, gridz_define, style_lip, enable_zsnap, l_gri
|
|||
|
||||
module gridfinityLite(gridx, gridy, gridz, gridz_define, style_lip, enable_zsnap, length, style_hole, only_corners) {
|
||||
height_mm = height(gridz, gridz_define, style_lip, enable_zsnap);
|
||||
union() {
|
||||
|
||||
// Lower the bin start point by this amount.
|
||||
// Made up for in bin height.
|
||||
// Ensures divider walls smoothly transition to the bottom
|
||||
lower_by_mm = BASE_HEIGHT + bottom_layer;
|
||||
|
||||
difference() {
|
||||
translate([0, 0, -lower_by_mm])
|
||||
gridfinityInit(gridx, gridy, height_mm+lower_by_mm, 0, length, sl=style_lip)
|
||||
children();
|
||||
|
||||
// Underside of the base. Keep out zone.
|
||||
render()
|
||||
difference() {
|
||||
union() {
|
||||
gridfinityInit(gridx, gridy, height_mm, 0, length, sl=style_lip)
|
||||
children();
|
||||
gridfinityBase([gridx, gridy], [length, length], hole_options=style_hole, only_corners=only_corners);
|
||||
}
|
||||
|
||||
difference() {
|
||||
union() {
|
||||
intersection() {
|
||||
difference() {
|
||||
gridfinityBase([gridx, gridy], [length, length], hole_options=style_hole, -d_wall*2, false, only_corners=only_corners);
|
||||
translate([-gridx*length/2,-gridy*length/2,2*BASE_HEIGHT])
|
||||
cube([gridx*length,gridy*length,1000]);
|
||||
}
|
||||
translate([0,0,-1])
|
||||
rounded_rectangle(gridx*length-0.5005-d_wall*2, gridy*length-0.5005-d_wall*2, 1000, r_f2);
|
||||
translate([0,0,bottom_layer])
|
||||
rounded_rectangle(gridx*1000, gridy*1000, 1000, r_f2);
|
||||
}
|
||||
translate([0,0,BASE_HEIGHT+d_clear])
|
||||
rounded_rectangle(gridx*length-0.5005-d_wall*2, gridy*length-0.5005-d_wall*2, BASE_HEIGHT, r_f2);
|
||||
}
|
||||
|
||||
translate([0,0,-4*BASE_HEIGHT])
|
||||
gridfinityInit(gridx, gridy, height(20,0), 0, length, sl=style_lip)
|
||||
children();
|
||||
}
|
||||
cube([gridx*length, gridy*length, BASE_HEIGHT*2], center=true);
|
||||
gridfinityBase([gridx, gridy], hole_options=style_hole, only_corners=only_corners);
|
||||
}
|
||||
difference() {
|
||||
translate([0,0,-1.6])
|
||||
difference() {
|
||||
difference() {
|
||||
union() {
|
||||
gridfinityInit(gridx, gridy, height_mm, 0, length, sl=style_lip)
|
||||
children();
|
||||
}
|
||||
|
||||
difference() {
|
||||
intersection() {
|
||||
difference() {
|
||||
gridfinityBase([gridx, gridy], [length, length], hole_options=style_hole, -d_wall*2, false, only_corners=only_corners);
|
||||
translate([-gridx*length/2,-gridy*length/2,2*BASE_HEIGHT])
|
||||
cube([gridx*length,gridy*length,1000]);
|
||||
}
|
||||
translate([0,0,-1])
|
||||
rounded_rectangle(gridx*length-0.5005-d_wall*2, gridy*length-0.5005-d_wall*2, 1000, r_f2);
|
||||
translate([0,0,bottom_layer])
|
||||
rounded_rectangle(gridx*1000, gridy*1000, 1000, r_f2);
|
||||
}
|
||||
|
||||
translate([0,0,-4*BASE_HEIGHT])
|
||||
gridfinityInit(gridx, gridy, height(20,0), 0, length, sl=style_lip)
|
||||
children();
|
||||
}
|
||||
|
||||
}
|
||||
translate([0,0,9])
|
||||
rounded_rectangle(gridx*1000, gridy*1000, gridz*1000, gridz);
|
||||
}
|
||||
translate([0,0,0])
|
||||
rounded_rectangle(gridx*1000, gridy*1000, 5, r_f2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
gridfinity_base_lite([gridx, gridy], d_wall, bottom_layer, hole_options=style_hole, only_corners=only_corners);
|
||||
}
|
||||
|
|
|
@ -287,6 +287,68 @@ module gridfinityBase(grid_size, grid_dimensions=GRID_DIMENSIONS_MM, hole_option
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create the base of a gridfinity bin, or use it for a custom object.
|
||||
* @param length X,Y size of a single Gridfinity base.
|
||||
* @param grid_size Size in number of bases. [x, y]
|
||||
* @param wall_thickness How thick the walls, and holes (if enabled) are.
|
||||
* @param top_bottom_thickness How thick the top and bottom is.
|
||||
* @param hole_options @see block_base_hole.hole_options
|
||||
* @param only_corners Only put holes on each corner.
|
||||
*/
|
||||
module gridfinity_base_lite(grid_size, wall_thickness, top_bottom_thickness, hole_options=bundle_hole_options(), only_corners = false) {
|
||||
assert(is_list(grid_size) && len(grid_size) == 2 && grid_size.x > 0 && grid_size.y > 0);
|
||||
assert(is_num(wall_thickness) && wall_thickness > 0);
|
||||
assert(is_num(top_bottom_thickness) && top_bottom_thickness > 0);
|
||||
assert(is_bool(only_corners));
|
||||
|
||||
grid_dimensions = GRID_DIMENSIONS_MM;
|
||||
|
||||
// Per spec, there's a 0.5mm gap between each base.
|
||||
// This must be kept constant or half bins may not work correctly.
|
||||
gap_mm = GRID_DIMENSIONS_MM - BASE_TOP_DIMENSIONS;
|
||||
|
||||
// Final size of the base top. In mm.
|
||||
// Gap needs to be removed to prevent an unwanted overhang off the edges.
|
||||
grid_size_mm = [grid_dimensions.x * grid_size.x, grid_dimensions.y * grid_size.y] -gap_mm;
|
||||
|
||||
//Bridging structure to tie the bases together
|
||||
difference() {
|
||||
translate([0, 0, BASE_HEIGHT-top_bottom_thickness])
|
||||
rounded_square([grid_size_mm.x, grid_size_mm.y, top_bottom_thickness], BASE_TOP_RADIUS, center=true);
|
||||
|
||||
pattern_linear(grid_size.x, grid_size.y, grid_dimensions.x, grid_dimensions.y)
|
||||
translate([0, 0, top_bottom_thickness])
|
||||
base_solid();
|
||||
}
|
||||
|
||||
render()
|
||||
if(only_corners) {
|
||||
difference() {
|
||||
union() {
|
||||
pattern_linear(grid_size.x, grid_size.y, grid_dimensions.x, grid_dimensions.y)
|
||||
base_outer_shell(wall_thickness, top_bottom_thickness);
|
||||
_base_holes(hole_options, -wall_thickness, grid_size_mm);
|
||||
}
|
||||
|
||||
_base_holes(hole_options, 0, grid_size_mm);
|
||||
_base_preview_fix();
|
||||
}
|
||||
}
|
||||
else {
|
||||
pattern_linear(grid_size.x, grid_size.y, grid_dimensions.x, grid_dimensions.y) {
|
||||
difference() {
|
||||
union() {
|
||||
base_outer_shell(wall_thickness, top_bottom_thickness);
|
||||
_base_holes(hole_options, -wall_thickness);
|
||||
}
|
||||
_base_holes(hole_options, 0);
|
||||
_base_preview_fix();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Solid polygon of a gridfinity base.
|
||||
* @details Ready for use with `sweep_rounded(...)`.
|
||||
|
|
Loading…
Reference in a new issue