Today I wanted to design and print a rack for poker chips, and I wanted it to hold three stacks of 20 poker chips. If you sew, or knit, or build, or pretty much do anything, then you know you that should measure carefully, and preferably at least twice. I measured the chips. I remembered to measure the chips in a stack in case that was somehow mysteriously different than 20 times the height of one chip. I measured it a few times to be sure and because I always forget the first measurement number while I am re-measuring and then have to measure again. I remembered to add a millimeter to account for tolerance. Everything is great; measure, measure. Except that then I wrote this code:
radius = 20+1; // radius of actual poker chip plus fudge
height = 67+1; // height of actual stack of 20 chips plus fudge
thickness = 2; // desired thickness of plastic
shift = 2; // to make clean holes and/or holes with edges
difference(){
// outside cylinder
translate([0,0,radius])
rotate(90,[0,1,0])
cylinder(h=height,r=radius+thickness);
// take away chip cylinder
translate([thickness,0,radius+thickness])
rotate(90,[0,1,0])
cylinder(h=height-2*thickness,r=radius);
// take away top
translate([-shift,-.5*(height+2*shift),radius+thickness])
cube(height+2*thickness+2*shift);
// take away thumb cylinder
translate([-shift,0,radius+thickness])
rotate(90,[0,1,0])
cylinder(h=height+2*thickness+2*shift,r=radius-3*thickness);
}
And no amount of good measuring can overcome stupid code. Yet another rookie mistake: I used the 20-chips-plus-tolerance dimension for the outside and then took a smaller hole out of that to put the chips in. The resulting fail is on the left in the picture below; it only holds 18 chips. There is also an earlier bonus fail on the right from when I thought it would be a smart idea to print the rack upside-down without a raft.
Luckily, stupid fails are usually easy to fix; here's the corrected 20-chip version, along with a suitably Friday-Fail poker hand:
The design is now on Customizer and you can use it to make poker chip racks with variable numbers of rows and chips. If you use different denominations of chips then you could make one of these for each player. We currently play with just one denomination of chips so we use the three-row rack to hold all the chips for a short family poker evening and store the two-row rack to use when guests join our game:
Thingiverse link: http://www.thingiverse.com/thing:350083?save=success
Settings: MakerBot Replicator 2 with .3mm/low, printed with no supports but with a raft, on a glass build platform with blue painters tape.
Technical notes, OpenSCAD Customizer edition: Below is the full code that was submitted to the Thingiverse Customizer. Notice that the parameters at the top are meant to be entered by the user. The comments above these parameters are used by Customizer as descriptions in the user interface. The last group of parameters will not be visible to Customizer users. Any parameter that is computed will be ignored by Customizer. If you want a parameter to be invisible but it doesn't require any computation then just multiply it by 1 when it is defined. In the final code I also added a line to flatten the bottom of the rack so that it would have better contact with the build platform and its eventual resting place on the table.
// mathgrrl customizable poker chip rack
/////////////////////////////////////////////////////////////
// parameters ///////////////////////////////////////////////
// Diameter of one poker chip (in millimeters)
Chip_Diameter = 20;
// Thickness of one poker chip (in millimeters)
Chip_Thickness = 3.35;
// Number of chips you want in each row of the rack
Number_of_Chips = 20;
// Number of rows you want in the rack
Number_of_Rows = 3;
// Thickness of the rack itself
Rack_Thickness = 2;
// Enter a tolerance (more if your chips are too tight, less if they are too loose)
Fudge = 1;
// Parameters invisible to the user
$fn = 96*1;
radius = Chip_Diameter/2 + Fudge;
height = Chip_Thickness*Number_of_Chips + Fudge;
thickness = Rack_Thickness*1;
rows = Number_of_Rows*1;
shift = 2*1; // to make clean holes and/or holes with edges
/////////////////////////////////////////////////////////////
// renders //////////////////////////////////////////////////
for (i = [1:1:rows]){
translate([0,(i-1)*(2*radius+thickness),0]) chipstack();
}
/////////////////////////////////////////////////////////////
// module for holding one stack of chips ////////////////////
module chipstack(){
// shift down to platform
translate([0,0,-.5])
difference(){
// outside cylinder
translate([0,0,radius+thickness])
rotate(90,[0,1,0])
cylinder(h=height+2*thickness,r=radius+thickness);
// take away chip cylinder
translate([thickness,0,radius+thickness])
rotate(90,[0,1,0])
cylinder(h=height,r=radius);
// take away thumb cylinder
translate([-shift,0,radius+thickness])
rotate(90,[0,1,0])
cylinder(h=height+2*thickness+2*shift,r=radius-1.5*thickness);
// take away top
translate([-shift,-.5*(height+2*shift),radius+thickness])
cube(height+2*thickness+2*shift);
// flatten bottom
translate([-shift,-5,-10+.5])
cube([height+2*thickness+2*shift,10,10]);
}
}