Skip to main content

Overview

This module defines all standardized Gridfinity dimensions, tolerances, and feature parameters according to the official specification. It also includes presets for common printer bed sizes and bin configurations.

Import

import { GF, GRID_PRESETS, BIN_PRESETS, BIN_GROUPS, LAYOUT_TEMPLATES } from '@/gridfinity/constants';

GF Constants Object

The GF object contains all core Gridfinity specification values. It is defined as a const object for type safety.
const GF = {
  // Grid dimensions
  CELL_SIZE: 42,          // mm - Base grid cell size
  HEIGHT_UNIT: 7,         // mm - Vertical height increment
  TOLERANCE: 0.5,         // mm - Fit tolerance between parts

  // Corner radii
  BIN_CORNER_RADIUS: 3.75,  // mm
  BASE_CORNER_RADIUS: 4.0,  // mm

  // Base height
  BASE_TOTAL_HEIGHT: 4.75,  // mm - Total base height

  // Wall dimensions
  WALL_THICKNESS: 1.2,      // mm - Default wall thickness
  BOTTOM_THICKNESS: 0.8,    // mm - Default bottom thickness

  // Stacking lip
  STACKING_LIP_HEIGHT: 4.4, // mm

  // Magnet specifications
  MAGNET_DIAMETER: 6,       // mm
  MAGNET_DEPTH: 2,          // mm
  MAGNET_INSET: 4.8,        // mm - Inset from corner

  // Screw specifications
  SCREW_DIAMETER: 3,        // mm
  SCREW_HOLE_DIAMETER: 3.2, // mm - Clearance hole

  // Label shelf
  LABEL_ANGLE: 45,          // degrees
  LABEL_DEFAULT_WIDTH: 12,  // mm

  // Baseplate
  BASEPLATE_HEIGHT: 6.4,    // mm

  // Multi-cell spacing
  INTER_CELL_GAP: 0.5,      // mm
} as const;
Source: src/gridfinity/constants.ts:1-29

Core Dimensions

CELL_SIZE
42
required
Base grid cell size in millimeters. Each grid unit is 42mm × 42mm.
HEIGHT_UNIT
7
required
Vertical height increment in millimeters. Height units are multiples of 7mm.
TOLERANCE
0.5
required
Fit tolerance between parts. Bins are sized w * CELL_SIZE - TOLERANCE.

Corner Radii

BIN_CORNER_RADIUS
3.75
required
Default corner radius for bin bodies (mm)
BASE_CORNER_RADIUS
4.0
required
Corner radius for baseplate sockets (mm)

Base Configuration

BASE_TOTAL_HEIGHT
4.75
required
Total height of the bin base in millimeters. This is the Z-height from the build plate to where the bin walls start.

Wall Thickness

WALL_THICKNESS
1.2
required
Default wall thickness in millimeters. Ensures structural integrity while minimizing print time.
BOTTOM_THICKNESS
0.8
required
Default bottom thickness in millimeters.

Features

STACKING_LIP_HEIGHT
4.4
required
Height of the stacking lip feature (mm)
MAGNET_DIAMETER
6
required
Standard magnet diameter (mm) - typically 6mm × 2mm neodymium magnets
MAGNET_DEPTH
2
required
Magnet hole depth (mm)
MAGNET_INSET
4.8
required
Distance from corner to magnet hole center (mm)
SCREW_DIAMETER
3
required
Screw diameter for baseplate mounting (mm) - typically M3
SCREW_HOLE_DIAMETER
3.2
required
Clearance hole diameter for screws (mm)
LABEL_ANGLE
45
required
Label shelf angle in degrees (45° slope)
LABEL_DEFAULT_WIDTH
12
required
Default label shelf width (mm)
BASEPLATE_HEIGHT
6.4
required
Total baseplate height (mm)
INTER_CELL_GAP
0.5
required
Gap between cells in multi-cell bins (mm)

Usage Example

import { GF } from '@/gridfinity/constants';

// Calculate bin outer dimensions
const binWidth = 2 * GF.CELL_SIZE - GF.TOLERANCE;  // 83.5mm
const binHeight = 3 * GF.HEIGHT_UNIT;              // 21mm

// Calculate inner cavity
const innerWidth = binWidth - 2 * GF.WALL_THICKNESS;
const cavityHeight = binHeight - GF.BOTTOM_THICKNESS;

// Position magnet holes
const magnetRadius = (GF.MAGNET_DIAMETER + 0.5) / 2; // Add clearance
const magnetInset = GF.MAGNET_INSET;

GRID_PRESETS

Predefined grid sizes for common 3D printer build plates.
const GRID_PRESETS: {
  name: string;
  cols: number;
  rows: number;
  default?: boolean;
}[] = [
  { name: 'A1',        cols: 6, rows: 6, default: true },
  { name: 'A1 Mini',   cols: 4, rows: 4 },
  { name: 'P1S',       cols: 6, rows: 6 },
  { name: 'X1C',       cols: 6, rows: 6 },
  { name: 'X1E',       cols: 6, rows: 6 },
  { name: 'H2D',       cols: 6, rows: 6 },
  { name: '19" Rack',  cols: 10, rows: 8 },
  { name: 'Custom',    cols: 8, rows: 8 },
];
Source: src/gridfinity/constants.ts:31-40

Printer Profiles

PrinterGrid SizeBuild AreaNotes
Bambu Lab A16×6252×252mmDefault preset
Bambu Lab A1 Mini4×4168×168mm
Bambu Lab P1S/X1C/X1E6×6256×256mm
Creality H2D6×6256×256mm
19” Rack Tray10×8420×336mmFor rack mount
Custom8×8User-defined

BIN_PRESETS

Common bin configurations for quick creation.
const BIN_PRESETS = [
  { name: 'Small Parts',  w: 1, d: 1, h: 3, stackingLip: true,  labelShelf: false, magnets: false, screws: false, dividersX: 0, dividersY: 0 },
  { name: 'Screwdriver',  w: 1, d: 4, h: 6, stackingLip: false, labelShelf: false, magnets: false, screws: false, dividersX: 0, dividersY: 0 },
  { name: 'Socket Tray',  w: 2, d: 2, h: 2, stackingLip: false, labelShelf: false, magnets: false, screws: false, dividersX: 3, dividersY: 3 },
  { name: 'Deep Bin',     w: 2, d: 2, h: 6, stackingLip: true,  labelShelf: true,  magnets: false, screws: false, dividersX: 0, dividersY: 0 },
  { name: 'Wide Shallow', w: 3, d: 2, h: 2, stackingLip: true,  labelShelf: false, magnets: false, screws: false, dividersX: 0, dividersY: 0 },
  { name: 'SFP Tray',     w: 2, d: 1, h: 2, stackingLip: false, labelShelf: false, magnets: false, screws: false, dividersX: 5, dividersY: 0 },
  { name: 'Cable Mgmt',   w: 1, d: 6, h: 3, stackingLip: false, labelShelf: false, magnets: false, screws: false, dividersX: 0, dividersY: 0 },
];
Source: src/gridfinity/constants.ts:42-50

BIN_GROUPS

Category tags for organizing bins.
const BIN_GROUPS: { id: string; label: string; color: string }[] = [
  { id: '',            label: 'None',        color: '' },
  { id: 'screws',      label: 'Screws',      color: '#4488ff' },
  { id: 'tools',       label: 'Tools',       color: '#ff6644' },
  { id: 'cables',      label: 'Cables',      color: '#ffaa00' },
  { id: 'electronics', label: 'Electronics', color: '#aa44ff' },
  { id: 'parts',       label: 'Parts',       color: '#00d4aa' },
  { id: 'office',      label: 'Office',      color: '#ff44aa' },
  { id: 'network',     label: 'Network',     color: '#44ddff' },
];
Source: src/gridfinity/constants.ts:54-63

LAYOUT_TEMPLATES

Pre-configured multi-bin layouts for common use cases.
interface LayoutTemplate {
  name: string;
  description: string;
  gridCols: number;
  gridRows: number;
  bins: {
    x: number;
    y: number;
    w: number;
    d: number;
    h: number;
    label: string;
    group: string;
    dividersX: number;
    dividersY: number;
  }[];
}
Source: src/gridfinity/constants.ts:67-73

Available Templates

  • IKEA Alex Drawer (7×14) - Organizer for IKEA ALEX desk drawer
  • Electronics Bench (6×6) - Electronics workspace with component bins
  • Tool Wall (8×4) - Workshop tool organizer
  • Server Rack 1U (10×8) - 19” rack tray for network equipment
Source: src/gridfinity/constants.ts:75-145 Example:
import { LAYOUT_TEMPLATES } from '@/gridfinity/constants';

const electronicsLayout = LAYOUT_TEMPLATES.find(
  t => t.name === 'Electronics Bench'
);

console.log(electronicsLayout?.bins.length); // 11 bins

Dimension Calculations

Bin Outer Dimensions

const outerWidth = units * GF.CELL_SIZE - GF.TOLERANCE;
const outerDepth = units * GF.CELL_SIZE - GF.TOLERANCE;
const totalHeight = GF.BASE_TOTAL_HEIGHT + (heightUnits * GF.HEIGHT_UNIT);

Inner Cavity Dimensions

const innerWidth = outerWidth - 2 * GF.WALL_THICKNESS;
const innerDepth = outerDepth - 2 * GF.WALL_THICKNESS;
const cavityHeight = (heightUnits * GF.HEIGHT_UNIT) - GF.BOTTOM_THICKNESS;

Multi-Cell Bins

For bins spanning multiple cells, each cell maintains its own base profile with gaps between them:
// Individual cell dimensions
const cellSize = GF.CELL_SIZE - GF.TOLERANCE;

// Total span with inter-cell gaps
const totalWidth = (units * GF.CELL_SIZE) - GF.TOLERANCE;

// Gap handling: INTER_CELL_GAP is maintained between cell bases
Source: src/gridfinity/binGeometry.ts:89-113

Build docs developers (and LLMs) love