[OpenSCAD] The multiplication table is being made as I type this...

Dan Zuras 3D threedee at nonabelian.com
Sun Nov 13 21:34:47 CET 2011



	Folks,

	I finally got OpenSCAD, skeinforge, & my machine
	to agree on a design that can be rendered, skeined,
	& extruded.

	The key insight as far as OpenSCAD was concerned
	was to build the objects as polygonal layer cakes
	rather than cut things out of a barrel shape.

	The key as far as skeinforge was concerned was to
	use a model that has fill turned off.  This creates
	Gcode that makes an object with no top, no bottom,
	& only one bead of plastic for each layer.  It also
	had the nice side effect of reducing the build time
	from 3 to 4 hours per object to half an hour each.
	Given that the entire project is 100 objects, that's
	a big deal.

	As for my machine, I still have an annoyng oozebane
	problem so rather than print them in plates of 10,
	I am reduced to building them one at a time.  I'm
	not absolutely certain that I will actually get
	through it all but I'm about 40% done now & I don't
	see anything in the way of finishing but time & PLA.

	Still, as you all know, I've been wrong before. :-)

	I include the source code below in case any of you
	have young'ins you want to multiply for you.

	I thank all of you for your help in completing what
	at first seemed merely an OpenSCAD/OpenCSG/CGAL bug
	finder.

	I particularly want to thank "M.Rule"
	<mrule7404 at gmail.com> who told me about the no-fill
	thing, Whosawhatsis <whosawhatsis at gmail.com> who
	seconded that suggesstion & helped with various
	approaches to making the shapes needed, nop head
	<nop.head at gmail.com> who was able to verify some of the
	bugs I found, William Adams <william_a_adams at msn.com>
	who took a personal interest in the project & sent me
	some code fragments that worked for him, Triffid Hunter
	<triffid.hunter at gmail.com> who was able to explain some
	of the CGAL problems, & Marius Kintel <marius at kintel.net>
	who was able to identify the bugs I found & is making
	sure they are fixed in future releases.

	Thanks all,

			   Dan


/*
	table - A collection of objects to aid in teaching
		the multiplication table to a 4-year old.

	    by

	Dan Zuras

	I have been having no end of difficulties trying to
	get this to work.  Some of the problems have been of
	my own design.  Some with OpenSCAD.  Some with CGAL.
	Some with Skeinforge.  And some with the extruded
	objects themselves.  Indeed, this entire effort has
	proved to be a most efficient bug finder.  This is my
	lastest effort to simplify the design to something
	that both works & does the job.  I have no reason to
	believe it will work.  That is my insanity.

	11/5/11	3 AM	Wrote this more or less from scratch.
	11/5/11	1 PM	Hmm.  Works so far.  Let me try the
			oneX & twoX cases as kind of an acid
			test.  So far so good.  Let me try a
			plate full of them.  Too much ooze.
			I'll have to do them one at a time.

	===

*/

module shape(m) translate([0,1/m,0]) polygon(points=[[0,-1/m],
	[1-2/m+2*cos(30)/m,-2*sin(30)/m],
	[1-2/m+2*cos(25)/m,-2*sin(25)/m],
	[1-2/m+2*cos(20)/m,-2*sin(20)/m],
	[1-2/m+2*cos(15)/m,-2*sin(15)/m],
	[1-2/m+2*cos(10)/m,-2*sin(10)/m],
	[1-2/m+2*cos(5)/m,-2*sin(5)/m],
	[1-2/m+2/m,0],
	[1-2/m+2*cos(5)/m,2*sin(5)/m],
	[1-2/m+2*cos(10)/m,2*sin(10)/m],
	[1-2/m+2*cos(15)/m,2*sin(15)/m],
	[1-2/m+2*cos(20)/m,2*sin(20)/m],
	[1-2/m+2*cos(25)/m,2*sin(25)/m],
	[1-2/m+2*cos(30)/m,2*sin(30)/m],
	[0,1/m]]);

// translate([-4, 1,0]) shape(1);
// translate([-2, 1,0]) shape(2);
// translate([ 0, 1,0]) shape(3);
// translate([ 2, 1,0]) shape(4);
// translate([ 4, 1,0]) shape(5);
// translate([-4,-1,0]) shape(6);
// translate([-2,-1,0]) shape(7);
// translate([ 0,-1,0]) shape(8);
// translate([ 2,-1,0]) shape(9);
// translate([ 4,-1,0]) shape(10);

module unit1x(m) for (i=[0:m-1]) translate([0,0,2*i/m])
	rotate_extrude(convexity=1,$fn=120) shape(m);

module unit2x(m) scale([2,2/sqrt(3),1]) intersection() {
	translate([-1/2,0,0]) unit1x(m);
	translate([1/2,0,0]) unit1x(m);
}

// scale([25,25,25]) unit2x(7);

module unitBarrel(n,m) if (n==1) { unit1x(m); } else if (n==2) { unit2x(m); }
	else { for (i=[0:m-1]) translate([0,0,2*i/m])
		rotate_extrude(convexity=1,$fn=n) shape(m); }

// scale([25,25,25]) {
// translate([-4,1,0]) unitBarrel(5,1);
// translate([-2,1,0]) unitBarrel(5,2);
// translate([0,1,0]) unitBarrel(5,3);
// translate([2,1,0]) unitBarrel(5,4);
// translate([4,1,0]) unitBarrel(5,5);
// translate([-4,-1,0]) unitBarrel(5,6);
// translate([-2,-1,0]) unitBarrel(5,7);
// translate([0,-1,0]) unitBarrel(5,8);
// translate([2,-1,0]) unitBarrel(5,9);
// translate([4,-1,0]) unitBarrel(5,10);
// }

// translate([0,-3,0]) cube(1);

// scale([25,25,25]) unitBarrel(1,5);
// scale([25,25,25]) unitBarrel(2,5);
// scale([25,25,25]) unitBarrel(3,5);

module entry(n,m) scale([25,25,25]) unitBarrel(n,m);

dx = 26*sqrt(3);
dy = 26;

module plate(n) union() {
	translate([-dx, 2*dy,0]) entry(n,1);
	translate([-dx,    0,0]) entry(n,2);
	translate([-dx,-2*dy,0]) entry(n,3);
	translate([  0, 3*dy,0]) entry(n,4);
	translate([  0,   dy,0]) entry(n,5);
	translate([  0,  -dy,0]) entry(n,6);
	translate([  0,-3*dy,0]) entry(n,7);
	translate([ dx, 2*dy,0]) entry(n,8);
	translate([ dx,    0,0]) entry(n,9);
	translate([ dx,-2*dy,0]) entry(n,10);
}

// plate(1);

// entry(10,10);


More information about the OpenSCAD mailing list