For this weeks project we’re going to learn a new modeling technique, have some fun with volumetric patterns and then apply these to make a toothbrush holder.

Last week we talked about using 2D imagery as way to create 3D data. We’re going to reuse that technique here but in a different way. In traditional 3D modeling one of the first modeling technique you learn is called a surface of revolution. If you’ve ever played on a pottery wheel or lathe then you’ve seen this technique. Basically you take a profile and turn it around a circle to make a solid. Here we’ll reuse the Image3D datasource to read in a user provided profile. We’ll then use the RingWrap transformation to revolve that profile around a circle.

Let’s take a look at an example. This is the profile we’ll use for the toothbrush holder. For my design I wanted a solid bottom with curved in sides. The profile you see here is basically one half of the object we want. In your mind just reflect the image to the left to imagine what the finished model will look like.

Here is the solid created from that profile:

One important concept in 3D printing is wall thickness. Depending on the strength of the material you may need thicker walls. The thickness of your lines(StrokeWidth in some software) determines how much material your walls will contain. For now we won’t go too deeply into wall thickness but I wanted you to realize that you could change this based on how thick you make your lines.

The ShapeJS code to create this profile looks like this:


function makeShell(profilePath, width, height, voxelSize, blend){
var radius = width/2;
var boxDepth = 2*Math.PI*radius + blend / 2 + 2 * voxelSize;
var boxWidth = radius;
var boxHeight = height;

var image = loadImage(profilePath);
var grid = image.getGrid();
var expandOp = new ExpandOp(0,3,3,3);
grid = expandOp.execute(grid);

var image = new Image3D(grid, boxWidth, boxHeight, boxDepth, voxelSize);
image.setBaseThickness(0.0);
image.setBaseThreshold(0.5);
image.setUseGrayscale(false);
image.setBlurWidth(2*voxelSize);

var ct = new CompositeTransform();
ct.add(new Rotation(0,1,0, -Math.PI/2));
// align side of the image box with xy plane
ct.add(new Translation(0, 0, -radius/2));
ct.add(new RingWrap(radius));
image.setTransform(ct);
return image;
}

This technique is good for making a bunch of different objects such as vases, candlesticks, and wine glasses. If you pair this with a simple sketching interface that exports an image, you could make a quick authoring tool for making some nice objects. We’ll return to this idea in some later postings.

The next concept to cover is a volume filling pattern. These are regular patterns that fill space infinitely in all directions. They have many uses, not the least of which is the ability to
turn something rather plain into something really interesting. Let’s look at what these patterns look like:

Volume Patterns

The top two patterns are called a Gyroid. The specific features of a Gyroid are interesting but too much detail for here. Wikipedia’s entry has more details if your interested: Gyroid. The two specific examples you see here are the same pattern but with the Period changed. The period parameter determines in what distance the pattern will repeat. So for a gyroid you roughly think of it as how large the holes are. The other parameter is the thickness. Most of these patterns are in theory thin sheets. By adding a thickness parameter we make it possible to give them volume and give you control over how much material is used. The second row of pictures contains the SchwarzP and SchwarzD patterns. Over time we’ll likely add some more interesting patterns.

It’s now time to combine both of these techniques to create a 3D printed object. We first take a user profile to make the basic shape of our object and then we intersect it with a Gyroid to make
the surface more interesting. I added parameters to help you control the volume pattern and move the object through the volume space. Another useful control is the Blend parameter. This affects
how round or flat things look like and really changes the feel of the object.

Here are some examples using different volume patterns and parameters:

Examples

Now that we have some good models being created from our script its time to start printing them. A common practice if you have a 3D printer is to prototype the print in the cheapest material you have available. I have a small FDM printer at home so I choose to print it out using that. Since i only have one printer extruder I had to use the same material for supports and the main item. After a long session of removing supports I got to hold my first version. Success! Sadly, the supports left some tool marks but all in all, I was happy with my first version.

FDM Print

In an ideal world, I would of designed my object to not require support material. But that can be a tough problem. Instead of doing that I decided to switch materials to the SLS Nylon material offered at Shapeways. The built object sits on a bed of powder while printing so it doesn’t require any support material. The second version of my print looks like this:

SLS Print

A few design notes from this project. After trying it out a bit as a real toothbrush holder I’ve decided that having a top lip would be a nice feature. Depending on how the pattern intersects at the top you can get some pretty big crevices which the brushes like to fall into. For the final script I added a top and bottom rim option which you can use to line the shapes. I decided not to use the bottom rim as I wanted the water from the brushes to flow out.

Top Rim

The last note is I would recommend sealing these prints with something to keep them clean. If the material you use is somewhat porous(most are) then eventually you’ll get toothpaste stuck too it. I applied a coating of Krylon Crystal Clear which is an acrylic coating to seal the material. I’m hoping this makes my holder last a long time and makes it easier to clean when needed.

That wraps this week’s Learn ShapeJS posting. We covered a lot of ground today, you learned a new modeling technique and delved into the fun world of volume patterns. If you make something cool with this script please share your experiences in the ShapeJS forums. I almost forgot! Here is the example script for you play with: ToothBrush Holder