Fixed 0.5mm gap between grids.

This fixes a compatibility issue when using fractional grid sizes.
This commit is contained in:
Arthur Moore 2024-10-08 00:15:45 -04:00
parent 728fff110a
commit 1b70c40186

View file

@ -224,18 +224,21 @@ module gridfinityBase(gx, gy, length, dx, dy, hole_options=bundle_hole_options()
// Final size in number of bases // Final size in number of bases
grid_size = [gx/dbnx, gy/dbny]; grid_size = [gx/dbnx, gy/dbny];
// Per spec, there's a 0.5mm gap between each base, // Per spec, there's a 0.5mm gap between each base.
// But that needs to be scaled based on everything else. // This must be kept constant or half bins may not work correctly.
individual_base_size_mm = [dbnx, dbny] * BASE_SIZE; gap_mm = l_grid - BASE_SIZE;
base_center_distance_mm = [dbnx, dbny] * length;
gap_mm = base_center_distance_mm - individual_base_size_mm; base_center_distance_mm = [dbnx, dbny] * length; // Per spec this should be 42.
individual_base_size_mm = [base_center_distance_mm.x - gap_mm, base_center_distance_mm.y - gap_mm];
// Final size of the base top. In mm. // Final size of the base top. In mm.
// subtracting gap_mm here to remove an outer lip along the peremiter.
grid_size_mm = [ grid_size_mm = [
base_center_distance_mm.x * grid_size.x, base_center_distance_mm.x * grid_size.x - gap_mm,
base_center_distance_mm.y * grid_size.y, base_center_distance_mm.y * grid_size.y - gap_mm
] - gap_mm; ];
// Top which ties all bases together
if (final_cut) { if (final_cut) {
translate([0, 0, h_base-TOLLERANCE]) translate([0, 0, h_base-TOLLERANCE])
rounded_square([grid_size_mm.x, grid_size_mm.y, h_bot], BASE_OUTSIDE_RADIUS, center=true); rounded_square([grid_size_mm.x, grid_size_mm.y, h_bot], BASE_OUTSIDE_RADIUS, center=true);