Gridfinity Baseplate
A baseplate compatible with the Gridfinity 42 mm grid system, in four styles. Plain is the bare 4.65 mm profile with open cells; magnet adds a solid base layer with four 6.5 x 2.4 mm pockets per cell for 6 x 2 mm magnets, matching the magnet holes in the bins; screw adds a countersunk hole in each cell centre for fixing the plate to a shelf or drawer; both combines them. Size the plate by grid count, or enter the inner width and depth of a drawer and the number of cells is calculated to fit, with the leftover spread as an even margin on each side. The default 4 x 3 magnet plate measures 168 x 126 x 8 mm. It prints flat with no supports, since every overhang in the cell profile is 45 degrees. Parameters: style, grid units in X and Y, drawer width and depth with clearance, base layer thickness, magnet pocket diameter and depth, and screw hole diameter.
# Gridfinity Baseplate - plain, magnet or screw-down, sized by grid count or to fit a drawer
#
# A Gridfinity-compatible baseplate: a grid of 42 mm cells, each with the standard stepped
# pocket (0.7 at 45 deg, 1.8 vertical, 2.15 at 45 deg = 4.65 mm) that the bin feet sit in.
# "plain" is the 4.65 mm profile only (open cells). "magnet" and "screw" add a solid base
# layer under the profile: magnet has four 6.5 x 2.4 mm pockets per cell (for 6 x 2 mm magnets,
# matching the holes in the bins), screw has a countersunk hole in each cell centre for
# mounting the plate to a shelf or drawer, and "both" has both.
# Give the inner width and depth of a drawer instead of a grid count and the number of
# cells is calculated so the plate fits, with the leftover spread as an even margin.
# Prints flat with no supports (every overhang is 45 deg).
@param choices:["plain", "magnet", "screw", "both"] desc:"Baseplate style"
$style = "magnet"
@param 1..12 desc:"Grid units along X (used when fit_w = 0)"
$units_x = 4
@param 1..12 desc:"Grid units along Y (used when fit_d = 0)"
$units_y = 3
@param 0..500 desc:"Inner width of the drawer to fill, X (mm, 0 = use units_x)"
$fit_w = 0
@param 0..500 desc:"Inner depth of the drawer to fill, Y (mm, 0 = use units_y)"
$fit_d = 0
@param 0..2 step:0.1 desc:"Clearance to the drawer walls, per side (mm)"
$fit_clear = 0.5
@param 2.4..5 step:0.2 desc:"Base layer thickness under the profile (magnet / screw styles, mm)"
$base_h = 3.4
@param 6..7 step:0.1 desc:"Magnet pocket diameter (mm)"
$mag_d = 6.5
@param 2..3 step:0.1 desc:"Magnet pocket depth (mm)"
$mag_h = 2.4
@param 3..5 step:0.1 desc:"Screw hole diameter (mm)"
$screw_d = 3.5
# --- Standard values ----------------------------------------------------
$pitch = 42
$profile_h = 4.65 # 0.7 + 1.8 + 2.15
$has_base = $style != "plain"
$magnets = $style == "magnet" or $style == "both"
$screws = $style == "screw" or $style == "both"
$base = if $has_base then $base_h else 0
def rr($w, $h, $r) = rect ($w - 2 * $r) ($h - 2 * $r) | offset $r
# --- Size: by grid count or to fit a drawer ------------------------------
$nx = if $fit_w > 0 then floor(($fit_w - 2 * $fit_clear) / $pitch) else $units_x
$ny = if $fit_d > 0 then floor(($fit_d - 2 * $fit_clear) / $pitch) else $units_y
$W = if $fit_w > 0 then $fit_w - 2 * $fit_clear else $nx * $pitch
$D = if $fit_d > 0 then $fit_d - 2 * $fit_clear else $ny * $pitch
assert $nx >= 1
assert $ny >= 1
# --- One cell pocket: 36.3 R1.15 at the bottom -> 42 R4 at the top, overshooting both ways
$pocket = rr(36.3, 36.3, 1.15)
| loft [rr(36.3, 36.3, 1.15), rr(37.7, 37.7, 1.85), rr(37.7, 37.7, 1.85), rr(42, 42, 4), rr(43, 43, 4.5)] [0.5, 1.2, 3.0, 5.15, 5.65] ruled:true
| translate 0 0 ($base - 0.5)
def cx($i) = ($i % $nx - ($nx - 1) / 2) * $pitch
def cy($i) = ($i // $nx - ($ny - 1) / 2) * $pitch
$n = $nx * $ny
$pockets = union [$pocket | translate cx(i) cy(i) 0 for i in range($n)]
$blank = rr($W, $D, 4) | extrude ($base + $profile_h)
$plate0 = $blank - $pockets
# --- Magnet pockets: four per cell at +-13 from the centre, open at the pocket floor -----
$mag = cylinder ($mag_d / 2) ($mag_h + 1) center:(true, true, false) | translate 0 0 ($base - $mag_h)
$mags = union [$mag | translate (cx(i // 4) + (if i % 2 == 0 then 13 else -13)) (cy(i // 4) + (if i // 2 % 2 == 0 then 13 else -13)) 0 for i in range($n * 4)]
$plate1 = if $magnets then $plate0 - $mags else $plate0
# --- Screw holes: countersunk, one per cell centre, through the base layer -------------
$cs_d = $screw_d * 2
$shank = cylinder ($screw_d / 2) ($base + 2) center:(true, true, false) | translate 0 0 -1
$screw = $shank + (cone ($screw_d / 2) ($cs_d / 2) ($cs_d / 2 - $screw_d / 2) center:(true, true, false) | translate 0 0 ($base - ($cs_d / 2 - $screw_d / 2) + 0.01))
$screws_cut = union [$screw | translate cx(i) cy(i) 0 for i in range($n)]
$plate = if $screws then $plate1 - $screws_cut else $plate1
# --- Checks --------------------------------------------------------------
assert $plate.solids == 1
assert $plate.bbox.x ~ $W
assert $plate.bbox.y ~ $D
assert $plate.bbox.z ~ ($base + $profile_h)
# the plain profile removes most of the blank; a base layer adds a solid slab
$blank_vol = $W * $D * ($base + $profile_h)
assert $plate.volume < $blank_vol
assert $plate.volume > $W * $D * $base * 0.7
print "cells" $n
print "volume (mm^3)" $plate.volume
$plate