Sunday, March 21, 2010

Stacking slices to make simple boolean unions



Art of Illusion is a pain in the neck to work with. On the other hand it has the shortest learning curve of any 3D modeling package I've ever encountered and is simple enough for an eight year old to operate.

When I say pain, the primary problem is the boolean ops module. AoI does boolean ops with triangular mesh defined solids. Doing boolean ops on mesh defined solids is a brass bound bastard of a problem. There is a tendency to condemn AoI because its boolean ops module isn't very good. When you go out and start looking at other 3D modeling packages, commercial and open source, you begin to notice that virtually none of them, or all of them for all I know, can import mesh defined solids formats like STL. When you look at how these apps do boolean ops you soon find that the objects you can define have to be very carefully defined out of shape primitives and that these primitives, suitably adjusted by size, orientation and position parameters are what go into the boolean ops module.

That's cheating.

Before I get off into a pointless rant about that, let's get back to the problem I was addressing. AoI is rather simple to write special purpose scripts for. Recently, I wrote one for generating herringbone racks. It was a pain in the neck to design that script, but once it was done it worked perfectly. The rack has a 5 mm flange on either side.

When I set about to design a beam into which that rack could slot, however, I discovered that it would be a very good idea to have some space between where the rack stopped and the beam started. To do that I needed to add a wider, somewhat thicker slab under the rack. I had two choices. I could either go back and rewrite the script {shudder} or I could glue that rack onto the heavier slab using a boolean union op, sort of like this.


While AoI would let me merge the slab and the rack, when I went to do a boolean union op, it simply wouldn't let me.  Not nice.  It was infuriating to be able to look at what I wanted on the AoI display and not be able to turn it into an STL.

That got me to thinking.  Basically, all I wanted to do was put the rack on top of the slab.  If I put the slab through Slice and Dice to create a set of slices and then repeated the game with the rack, keeping the same alignment, it would be a simple matter to just stack the rack slices on top of the slab slices.   Of course, when I set out to do that I unearthed several previously unsuspected bugs in the Slice and Dice code which took me most of Sunday to chase down and fix.

It works now, though.  Slice and Dice can do a simple boolean union between two objects by stacking slices.  I've tested the code and ran it through the whole exercise in the morning.

And there it is.


The slab is 80 x 25 x 2 mm.  The slab and flange are 100% fill.  I printed with 0.1 mm layers using a 0.3 mm extruder at 16 mm/sec.  There was no corner curling or warping at all.  This print is extremely strong.

10 comments:

Unknown said...

using openscad you could have done:

union() {
import_stl("rack.stl");
translate([0,0,-2]) cube(80,25,2,center=true);
}

:-)

Forrest Higgs said...

I have no doubt that you are right.

The Editor said...

So what did not work was
to put the rack on top of the octaeder
with a coplanar face?
(AoI can´t work with coplanar faces
in booleans.)

Unknown said...

do you have your stl files on thingiverse? i haven't been able to find them.

i am hoping to implement a rack like this onto my y-axis as one of my first real prints. i figure i need about 1 foot of rack and a small gear like you have pictured on your other posts.

Forrest Higgs said...

You can get the Art of Illusion scripts to generate your own stls at

http://www.bitsfrombytes.com/fora/user/index.php?action=dlattach;topic=549.0;attach=607
http://www.bitsfrombytes.com/fora/user/index.php?action=dlattach;topic=549.0;attach=608

Kai said...

I'm starting to like the idea of a voxel based solid modeling solution. A cube with a 100mm side at a resolution of 0.01mm is ~125GB of memory uncompressed. Given most meshes are highly non-uniform you could probably compress it pretty well. This would take care of a lot of the issues associated with triangle based representations. Plus you could run really nice plastic flow simulations to increase accuracy.

Forrest Higgs said...

The idea takes some getting used to. Once you get your head around the notion that memory and disk space are dirt cheap, however, the possibilities really open up. :-)

Forrest Higgs said...

Marcus: I'm aware of the fact that you can't do unions in AoI by simply sitting one object on top of another. I am always careful to have the two objects slightly overlap.

The problem is that if one of your objects is complex, even if Netfabb says that it is good, most times the union will still not happen even if you overlap the two objects properly.

Frank Davies said...

I have used AOI to make a lot of 3D reprap stuff. I have found that version 2.7 does the best job with booleans. You have to use the solid editor every two or three steps to stop the number of triangles from exploding exponentially, but it will do operations that look reasonable. The most up-to-date version of AOI will not do boolean operations that 2.7 will do nicely.

It is all a matter of taste, I suppose.

fdavies

Forrest Higgs said...

I just got tired of trying to make AoI do things. :-(