Welcome to MakerHome

We've completed our yearlong print-a-day project! New projects will be posted at www.mathgrrl.com/hacktastic.

All mathgrrl designs and associated images and files on MakerHome are licensed under the Creative Commons Attribution Non-Commercial Share Alike license. If you want to use designs, images, or files outside of the terms of this license, please email request@mathgrrl.com.

Monday, April 21, 2014

Day 238 - Shellmaker 2

More shells! This time we printed a model to match an example from the Khan Academy, so that you can go there and learn how to set up the definite integral for this volume with shells if you have a mind to. The volume is obtained by rotating the region between y=(x-1)(x-3)^2 and the x-axis on [1,3] around the y-axis. We made an 8-shell version and a 16-shell version, plus an "exact" version made by using 100 shells and zero clearance between shells.


Here are all the pieces; I thought the 16-shell model would be difficult to reassemble after taking apart, but everything drops easily back into place without any fuss:


Thingiverse link: http://www.thingiverse.com/thing:306052

Settings: Printed on a Replicator 2 with .3mm/low settings.

Technical notes, OpenSCAD flavor: The code for the 8-shell model is below.

// mathgrrl shellmaker

// shell approximation of a solid of revolution

////////////////////////////////////////////////////////////
// parameters //////////////////////////////////////////////

// facet resolution
$fn = 48;

////////////////////////////////////////////////////////////
// function and renders ////////////////////////////////////

// define the function
function thefunction(x) = (x-3)*(x-3)*(x-1); 

// make the shell model
shellmaker(a=1,b=3,n=8,clearance=.8,width=60); 

////////////////////////////////////////////////////////////
// module for midpoint shells //////////////////////////////

module shellmaker(a,b,n,clearance,width){
// delta x depends on a, b, n, and clearance
delta = (b-a)/n;

// scale depends on a, b, and width
scale = .5*(width/(b-a)); 

// shift for making clean holes
shift = .5*1;

// innermost shell does not have clearance on inside
difference(){
// large function cylinder to outside of interval
cylinder(
r = scale*(a + 1*delta) - clearance/2,
h = scale*thefunction(((a + 0*delta)+(a + 1*delta))/2)
);
// small function cylinder to inside of interval
// when a=0 this cylinder is degenerate
// when a>0 we take out the whole center piece with max height
translate([0,0,-shift/2]) 
cylinder(
r = scale*(a + 0*delta),
h = 2*scale + shift
);
}
// middle shells have clearance on both sides
for (k = [2 : n-1]){
// construct the shell with a difference of cylinders
difference(){
// large function cylinder to outside of interval
cylinder(
r = scale*(a + k*delta) - clearance/2,
h = scale*thefunction(((a + (k-1)*delta)+(a + k*delta))/2)
);
// small function cylinder to inside of interval
translate([0,0,-shift/2]) 
cylinder(
r = scale*(a + (k-1)*delta) + clearance/2,
h = scale*thefunction(((a + (k-1)*delta)+(a + k*delta))/2) + shift
);
}
}
// outermost shell does not have clearance on outside
difference(){
// large function cylinder to outside of interval
cylinder(
r = scale*(a + n*delta),
h = scale*thefunction(((a + (n-1)*delta)+(a + n*delta))/2)
);
// small function cylinder to inside of interval
translate([0,0,-shift/2]) 
cylinder(
r = scale*(a + (n-1)*delta) + clearance/2,
h = scale*thefunction(((a + (n-1)*delta)+(a + n*delta))/2) + shift
);
}
}

The 16-shell model and "exact" model from today can also be rendered from this code, with:

shellmaker(a=1,b=3,n=16,clearance=1,width=60);
shellmaker(a=1,b=3,n=100,clearance=0,width=60);

Yesterdays' 8-shell model and its "exact" counterpart were made with the same code applied to a different function:

function thefunction(x) = 4-x*x;
shellmaker(a=0,b=2,n=8,clearance=.8,width=50); 
shellmaker(a=0,b=2,n=100,clearance=0,width=50);

Stuff to change: The increase in clearance to 1mm on the 16-shell model was too much, and the model is too loose. But with less clearance the model tended to run together and adjacent shells got stuck. Next time I would reduce the clearance and print the odd shells separately from the even ones to fix the sticking problem.

No comments:

Post a Comment