$fn = 64; /* [Configuration] */ // Select the accessory to generate: 1 = Hook, 2 = Tool Ring, 3 = Small Bin accessory_type = 1; /* [Pegboard Dimensions] */ hole_spacing = 25.4; peg_diameter = 5.8; board_thickness = 5.0; plate_thickness = 4.0; module peg_set(x_offset) { translate([x_offset, 0, 0]) { // Top locking peg translate([0, 0.1, 0]) rotate([90, 0, 0]) cylinder(h=board_thickness + 3.1, d=peg_diameter); translate([0, -(board_thickness + 3), 0]) sphere(d=peg_diameter); translate([0, -(board_thickness + 3), 0]) cylinder(h=5, d=peg_diameter); translate([0, -(board_thickness + 3), 5]) sphere(d=peg_diameter); // Bottom stabilizing peg translate([0, 0, -hole_spacing]) { translate([0, 0.1, 0]) rotate([90, 0, 0]) cylinder(h=board_thickness + 0.1, d=peg_diameter); translate([0, -board_thickness, 0]) sphere(d=peg_diameter); } } } module pegboard_mount(width=15, columns=1) { // Base plate translate([-width/2, 0, -hole_spacing - 10]) cube([width, plate_thickness, hole_spacing + 20]); // Pegs if (columns == 1) { peg_set(0); } else { for (i = [0 : columns-1]) { offset_x = (i - (columns-1)/2) * hole_spacing; peg_set(offset_x); } } } module accessory_hook() { union() { pegboard_mount(width=15, columns=1); // Hook geometry translate([0, plate_thickness - 0.1, -hole_spacing/2]) { rotate([-90, 0, 0]) cylinder(h=35.1, d=8); translate([0, 35, 0]) sphere(d=8); translate([0, 35, 0]) cylinder(h=15, d=8); translate([0, 35, 15]) sphere(d=8); } } } module accessory_ring() { union() { pegboard_mount(width=25, columns=1); // Tool ring geometry translate([0, plate_thickness - 0.1, -hole_spacing/2]) { difference() { hull() { translate([-12.5, 0, -10]) cube([25, 2, 20]); translate([0, 35, 0]) cylinder(h=20, d=25, center=true); } // Inner tool hole translate([0, 35, 0]) cylinder(h=22, d=16, center=true); } } } } module accessory_bin() { cols = 2; width = hole_spacing * (cols - 1) + 20; union() { pegboard_mount(width=width, columns=cols); // Bin geometry translate([0, plate_thickness - 0.1, -hole_spacing/2]) { difference() { // Outer box translate([-width/2, 0, -20]) cube([width, 40.1, 40]); // Inner cavity translate([-width/2 + 2, 2, -18]) cube([width - 4, 36.1, 40]); } } } } // Generate the selected accessory if (accessory_type == 1) { accessory_hook(); } else if (accessory_type == 2) { accessory_ring(); } else if (accessory_type == 3) { accessory_bin(); }