My Gridfinity models
at main 183 lines 5.3 kB view raw
1include <lib/gridfinity-rebuilt-openscad/src/core/standard.scad> 2include <lib/gridfinity-rebuilt-openscad/src/core/gridfinity-baseplate.scad> 3use <lib/gridfinity-rebuilt-openscad/src/core/gridfinity-rebuilt-holes.scad> 4use <lib/gridfinity-rebuilt-openscad/gridfinity-rebuilt-baseplate.scad> 5 6$fa = 4; 7$fs = 0.25; 8 9/* [Shelf Size] */ 10// Width in gridfinity units 11grid_x = 1; // [2:1:8] 12// Depth in gridfinity units 13grid_y = 1; // [1:1:3] 14 15/* [Pegboard (1" standard)] */ 16peg_spacing = 25.4; 17peg_hole_dia = 6.35; 18board_thickness = 4.76; 19 20/* [Construction] */ 21peg_dia = 5.6; 22peg_behind = 10; 23backplate_thick = 4; 24gusset_thick = 1.6; 25 26/* [Options] */ 27enable_magnets = false; 28// Tilt shelf forward for bin visibility 29shelf_angle = 10; // [0:5:20] 30 31// === DERIVED === 32 33shelf_width = grid_x * 42; 34shelf_depth = grid_y * 42; 35 36// Peg layout: 1" intervals centered across shelf width 37num_pegs = floor(shelf_width / peg_spacing) + 1; 38peg_array_width = (num_pegs - 1) * peg_spacing; 39peg_x_start = (shelf_width - peg_array_width) / 2; 40 41// Z positions (shelf bottom = 0, shelf top = BASEPLATE_HEIGHT) 42top_peg_z = BASEPLATE_HEIGHT / 2; 43bottom_peg_z = top_peg_z - peg_spacing; 44 45// Backplate covers both peg rows with margin 46bp_z_bottom = bottom_peg_z - peg_dia; 47 48// Gusset geometry 49gusset_depth = shelf_depth; 50num_gussets = grid_x + 1; 51 52bp_clearance = BASEPLATE_HEIGHT * sin(shelf_angle); 53 54hole_options = enable_magnets 55 ? bundle_hole_options(magnet_hole=true, crush_ribs=true, chamfer=true) 56 : bundle_hole_options(); 57 58echo(str("Shelf: ", grid_x, "x", grid_y, " (", shelf_width, "x", shelf_depth, "mm)")); 59echo(str("Total depth from wall: ", backplate_thick + shelf_depth, "mm")); 60echo(str("Pegs per row: ", num_pegs, ", gussets: ", num_gussets)); 61 62// === ASSEMBLY === 63 64color("SteelBlue") 65union() { 66 // Tilted shelf group: pivot at top-back edge of shelf 67 translate([0, backplate_thick, BASEPLATE_HEIGHT]) 68 rotate([-shelf_angle, 0, 0]) 69 translate([0, -backplate_thick, -BASEPLATE_HEIGHT]) 70 { 71 // Gridfinity baseplate surface 72 translate([shelf_width/2, backplate_thick + bp_clearance + shelf_depth/2, 0]) 73 gridfinityBaseplate( 74 [grid_x, grid_y], l_grid, [0, 0], 75 0, hole_options, 0 76 ); 77 78 // Fill the clearance gap behind the baseplate 79 translate([0, backplate_thick, 0]) 80 cube([shelf_width, bp_clearance, BASEPLATE_HEIGHT]); 81 } 82 83 // Gussets (in world coords, bridging tilted shelf to vertical backplate) 84 for (i = [0 : num_gussets - 1]) { 85 gx = gusset_thick/2 + 86 i * (shelf_width - gusset_thick) / max(1, num_gussets - 1); 87 difference() { 88 translate([gx, 0, 0]) 89 gusset(); 90 if (i == 0) 91 baseplate_corner_cut(left=true); 92 if (i == num_gussets - 1) 93 baseplate_corner_cut(left=false); 94 } 95 } 96 97 // Backplate wall 98 translate([0, 0, bp_z_bottom]) 99 cube([shelf_width, backplate_thick, BASEPLATE_HEIGHT - bp_z_bottom]); 100 101 // Top row pegs (J-hooks, weight-bearing) 102 for (i = [0 : num_pegs - 1]) 103 translate([peg_x_start + i * peg_spacing, 0, top_peg_z]) 104 j_hook(); 105 106 // Bottom row pegs (anti-rotation) 107 for (i = [0 : num_pegs - 1]) 108 translate([peg_x_start + i * peg_spacing, 0, bottom_peg_z]) 109 peg(board_thickness + 1); 110} 111 112// === MODULES === 113 114module peg(length) { 115 rotate([90, 0, 0]) 116 cylinder(d=peg_dia, h=length); 117 translate([0, -length, 0]) 118 sphere(d=peg_dia); 119} 120 121module j_hook() { 122 shaft_behind = 2; 123 shaft_length = board_thickness + shaft_behind; 124 tip_length = 4; 125 tip_angle = 20; 126 127 // Straight shaft through the board 128 peg(shaft_length); 129 130 // Upward-angled tip 131 translate([0, -shaft_length, 0]) 132 hull() { 133 sphere(d=peg_dia); 134 rotate([tip_angle, 0, 0]) 135 translate([0, 0, tip_length]) 136 sphere(d=peg_dia); 137 } 138} 139 140module gusset() { 141 // Triangle in the Y-Z plane bridging tilted shelf to vertical backplate 142 // rotate([0,90,0]) maps: polygon_x → -world_z, polygon_y → world_y 143 144 // Front-bottom of tilted shelf (after tilt transform) 145 by = backplate_thick 146 + (bp_clearance + shelf_depth) * cos(shelf_angle) 147 - BASEPLATE_HEIGHT * sin(shelf_angle); 148 bz = BASEPLATE_HEIGHT * (1 - cos(shelf_angle)) 149 - (bp_clearance + shelf_depth) * sin(shelf_angle); 150 151 // Shelf underside projected back to the backplate face 152 ay = backplate_thick; 153 az = bz + (by - backplate_thick) * tan(shelf_angle) 154 + BASEPLATE_OUTER_RADIUS + 0.1; 155 156 // Bottom of backplate 157 cy = backplate_thick; 158 cz = bp_z_bottom; 159 160 translate([-gusset_thick/2, 0, 0]) 161 rotate([0, 90, 0]) 162 linear_extrude(gusset_thick) 163 polygon([ 164 [-az, ay], 165 [-bz, by], 166 [-cz, cy] 167 ]); 168} 169 170module baseplate_corner_cut(left) { 171 R = BASEPLATE_OUTER_RADIUS; 172 translate([0, backplate_thick, BASEPLATE_HEIGHT]) 173 rotate([-shelf_angle, 0, 0]) 174 translate([0, -backplate_thick, -BASEPLATE_HEIGHT]) 175 translate([left ? 0 : shelf_width - R, 176 backplate_thick + bp_clearance + shelf_depth - R, 177 -1]) 178 difference() { 179 cube([R, R + 1, BASEPLATE_HEIGHT + 2]); 180 translate([left ? R : 0, 0, -1]) 181 cylinder(r=R, h=BASEPLATE_HEIGHT + 4); 182 } 183}