module Piece(pattern){ //FF = Fudge Factor - amount by which to increase 'holes' FF = 0.3; SIZE = 5; difference(){ //Draw the main shape union(){ for(j=[0:4]){ for(i=[0:4]){ if(pattern[i][j] == 1){ translate([i*SIZE,j*SIZE,0]) cube([SIZE,SIZE,SIZE]); } } } } //Apply the fudge factor to the holes union(){ for(j=[0:4]){ for(i=[0:4]){ if(pattern[i][j] == 0){ translate([i*SIZE-FF,j*SIZE-FF,-1]) cube([SIZE + FF * 2,SIZE + FF * 2,7]); } } } } } } a = [ [0,0,1,0,0], [0,1,1,1,0], [1,1,1,1,1], [0,1,1,1,0], [0,0,1,0,0]]; b = [ [1,0,1,0,1], [1,1,1,1,1], [0,1,1,1,0], [1,1,1,1,1], [1,0,1,0,1]]; c = [ [0,0,1,0,0], [0,1,1,1,1], [1,1,1,1,0], [0,1,1,1,1], [0,0,1,0,0]]; d = [ [0,1,0,1,0], [1,1,1,1,0], [0,1,1,1,1], [1,1,1,1,0], [1,1,0,1,1]]; e = [ [0,1,0,1,0], [1,1,1,1,1], [0,1,1,1,0], [1,1,1,1,1], [0,0,1,0,1]]; f = [ [0,1,0,1,0], [0,1,1,1,1], [1,1,1,1,0], [0,1,1,1,1], [0,1,0,1,1]]; translate([0,0,0]) Piece(a); translate([30,0,0]) Piece(b); translate([60,0,0]) Piece(c); translate([0,30,0]) Piece(d); translate([30,30,0]) Piece(e); translate([60,30,0]) Piece(f);