Tuesday, August 26, 2014

First Thing on Thingiverse

My daughter has been reluctant to admit that the 3D printer is cool, but she finally made a request.  She wanted a basket to clip onto her bed, to keep stuff in.  To really understand this you need to know a bit about the bed.  It's an Ikea Kura reversible bed  with canopy.  She has it in the loft configuration (at left) with a canopy like the one shown at right, but blue and a bit larger.  The canopy is supported with what are effectively tent poles that slot into brackets that clip onto the bed railing.




Mana wanted a basket that would clip on in the same way as the canopy supports.  The first step was to recreate the bracket.  I did this by measuring out the dimensions of the bracket, drawing it out on graph paper, and then entering polygon coordinates into OpenSCAD.  I did the rounded edges using sines and cosines at 10 degree intervals.  With the basic clip shape defined, I could extrude into the 3rd dimension to make the clip.  A quick test-print verified that it worked as well as the original.  Then it was an easy matter to add a male hook onto the bracket that I could use to attach  the basket to the bracket.



Here's the code :

railHeight = 42;
lipHeight = 15;
thickness = 5;
railWidth = 42;
depth = 25;


RailClip(railWidth,railHeight,lipHeight,thickness,depth);

// Add hook

translate([10,-5,0])
cube([20,3,depth]);
translate([30,-5,0])
cube([3,5,depth]);

where RailClip is a module that just extrudes the polygon as described above.  I parameterized it so that it would work with arbitrarily-sized railings.

The basket was also pretty easy:




pi = 3.141592;

angle = 30; // Select in part based on overhang your printer can handle.
h = 100; // Height of basket cylinder wall
rad = 50; // Radius of basket
npts = 40; // Number of bands around the circle
bandWidth = 2; // Width of individual bands

// Calculate twist for linear extrusion based on overhang angle and cylinder height

twistangle = 180*tan(angle)*h/rad/pi;

// Cylindrical wall

for(i = [0:npts-1])
{
linear_extrude(height = h, convexity = 10, twist = twistangle, slices = 100, scale = 1.0)
translate([rad*cos(i/npts*360),rad*sin(i/npts*360)])
rotate([0,0,i/npts*360])
square([bandWidth,bandWidth],center=true);
linear_extrude(height = h, convexity = 10, twist = -twistangle, slices = 100, scale = 1.0)
translate([rad*cos(i/npts*360),rad*sin(i/npts*360)])
rotate([0,0,i/npts*360])
square([bandWidth,bandWidth],center=true);
}

// Bottom rail

translate([0,0,-2])
difference()
{
cylinder(h=2,r=rad+1,$fn=100);
cylinder(h=2,r=rad-1,$fn=100);
}


// Top rail
translate([0,0,h])
difference()
{
cylinder(h=2,r=rad+1,$fn=100);
cylinder(h=2,r=rad-1,$fn=100);
}

// Female part of clip

translate([0,-rad-2,89.5])
difference()
{
cube([27,10.9,25],center=true);
translate([0,-2,-1.5])
cube([24.7,3.5,22],center=true);
}

I kept the bottom separate as I wanted to print the thing upside-down to avoid the need for support material.  I considered doing something fancy to fasten the two pieces together, but ended up just making the bottom a disk that I super-glued onto the basket wall.





Finally, I uploaded the whole thing to Thingiverse.  It's now Thing #442097.  I saw that someone else had been thinking along similar lines and already created a hanger for the same bed.

Fun!