Monday, December 16, 2013

Day 112 - Tetris T's

I like the rounded and nicely-spaced design of 3DAndy's Pentominos on Thingiverse, but wanted to print some tetrominos instead, for math/puzzles (for example, polyomino packing problems) and for future Tetris-related art projects. Since 3DAndy was nice enough to post his OpenSCAD code, it was easy to modify his pentomino-T into a tetromino-T.

Settings: MakerWare .3mm/low, with 8 T's printing in 45 minutes and weighing only 16 grams. Tetris pieces is a great "stash-busting project" for those of you with lots of little scraps of filament that are too small for any normal print job.

// mathgrrl tetrominos - example with Tetris "T"// based directly on 3DAndy's pentominos////////////////////////////////////////////////////////////// PARAMETERS //////////////////////////////////////////////////////////////resolution$fn=32;//dimensionslength = 10;radius = 1;space = 0.2;///////////////////////////////////////////////////////////////// RENDERS /////////////////////////////////////////////////////////////////render an instance of the Tetris "T"tetromino_T();///////////////////////////////////////////////////////////////// MODULES /////////////////////////////////////////////////////////////////define the blocks and connectors that make the Tetris "T"module tetromino_T() {union() {// the blockstranslate([0,0,0]) myCube();translate([length,0,0]) myCube();translate([2*length,0,0]) myCube();translate([length,length,0]) myCube();// the connectorstranslate([(0.5)*length,0,0]) myConnect();translate([(1.5)*length,0,0]) myConnect();translate([length,(0.5)*length,0]) myConnect();}}//module for making the blocks//eight spheres translated to the corners of the desired cube//then convex hull of those spheres makes a rounded cubemodule myCube() {dist = length/2-radius-space;hull() {translate([dist,dist,dist]) sphere(r=radius);translate([-dist,dist,dist]) sphere(r=radius);translate([dist,-dist,dist])sphere(r=radius);translate([-dist,-dist,dist]) sphere(r=radius);translate([dist,dist,-dist])sphere(r=radius);translate([-dist,dist,-dist]) sphere(r=radius);translate([dist,-dist,-dist]) sphere(r=radius);translate([-dist,-dist,-dist]) sphere(r=radius);}}//smaller cubes used to connect adjacent blocks//space between blocks is small enough that no support is needed to bridge the gap//even though these hang in the air between the blocks they connectmodule myConnect() {translate([space+radius-length/2,space+radius-length/2,space+radius-length/2]) cube([length-2*space-2*radius,length-2*space-2*radius,length-2*space-2*radius]);}