Uncategorized

Learn ShapeJS: Volume Pattern Ring

Volume Pattern Rings

For this week’s post we’ll create a ring based on volumetric patterns. In the process we’ll learn about blending in boolean operations and how to make wearable 3D jewelry. So first up, a photo to get you inspired!

The basic idea of this script is to cut a ring out of a volume containing an interesting 3D pattern. We learned about VolumePatterns in our ToothBrush Holder posting. These patterns fill the design space with a controllable pattern generator. We can then use some simple boolean operations to make a ring. We’ll cut the space with two cylinders. The first cylinder is the outer edge of the ring. The second will be the inner edge of the ring. Using a Gyroid pattern we get the following starting pattern:

Here is the code, the cylinder ocutter cuts the space for the outer ring, the icutter cuts it for the inner ring. The sides are then cut using 2 cutting planes.

  var ocutter = new Cylinder(new Vector3d(0,-10*CM,0), 
                             new Vector3d(0,10*CM,0),size+pattern_thick);  
  var icutter = new Cylinder(new Vector3d(0,-10*CM,0), 
                             new Vector3d(0,10*CM,0),size);
  var cutter = new Subtraction(ocutter,icutter);
  
  var body = Intersection(gyroid, cutter);    
  
  result = body;
  
  var fplane = new Plane(new Vector3d(0,-1,0),new Vector3d(0,width/2,0));
  var bplane = new Plane(new Vector3d(0,1,0),new Vector3d(0,-width/2,0));


  result = new Subtraction(result,fplane);
  result = new Subtraction(result,bplane);

  s = ringSizeToRadius(16) + 6*MM; 
  var scene = Scene(result, new Bounds(-s,s,-s,s,-s,s));
  return scene;

 

One thing you might notice is the pattern has some sharp edges. An issue with jewelry and rings in particular is they need to wear well. No-one is going to like wearing a metal ring with sharp edges. In this example we use two techniques to make the rings more comfortable. The first is to provide a liner in the ring that separates the potentially sharp pattern edges from your finger. By using a cylinder as a liner we a get a known pleasing shape that is easy to match with the requested ring size. This code shows the addition of the liner by adding another cylinder inside. The thickness of the band is specified in the band_thick variable.

  var ocutter = new Cylinder(new Vector3d(0,-10*CM,0), 
                             new Vector3d(0,10*CM,0),size+pattern_thick+band_thick);  
  var icutter = new Cylinder(new Vector3d(0,-10*CM,0), 
                             new Vector3d(0,10*CM,0),size+band_thick);
  var cutter = new Subtraction(ocutter,icutter);
  
  var body = Intersection(gyroid, cutter);    
  
  result = body;
  
  if (band_thick > 0) {
    var oliner = new Cylinder(new Vector3d(0,-10*CM,0), 
                              new Vector3d(0,10*CM,0),size+band_thick);
    var iliner = new Cylinder(new Vector3d(0,-10*CM,0), 
                              new Vector3d(0,10*CM,0),size);
    var liner = new Subtraction(oliner,iliner);
    result = new Union(result,liner);
  }
  
  var fplane = new Plane(new Vector3d(0,-1,0),new Vector3d(0,width/2,0));
  var bplane = new Plane(new Vector3d(0,1,0),new Vector3d(0,-width/2,0));


  result = new Subtraction(result,fplane);
  result = new Subtraction(result,bplane);


  s = ringSizeToRadius(16) + 6*MM;  // Hardcode to show sizes changes better
  var scene = Scene(result, new Bounds(-s,s,-s,s,-s,s));
  scene.setVoxelSize(0.05*MM);
  return scene;

 

The result looks like this:

This is better, but it still contains some sharp edges around the pattern. The second technique is to use a blend on the boolean combination operations. The default operation of booleans such as a Union, Intersection or Subtraction to combine datasources typically create hard edges. Notice how the liner and pattern seem very distinct. A blend allows you to smooth out these transitions. All booleans have a setBlend method you can use to blend the results together. The parameter is in physical units which represents the distance to smooth over. The larger the distance the more smoothing. Here is our ring now with some blending applied.

High Search Space Scripts

I classify these scripts as high search space scripts. There are a lot of non printable and non interesting rings,but buried inside are some real gems. This can be fun but it does make it challenging if you want to expose this type of creator to novice users. ShapeJS will have more tools soon that will help with the printability aspects. For the aesthetics, perhaps we can use some of the new deep learning algorithms to help us understand what looks good. I’m thinking of a user interface that shows you a bunch of random rings, you swipe Tinder style to rate them. It then uses these to train a recognizer of your style. Then it presents you news rings that are more likely to your tastes. Likely a pipe dream currently but could be something in the future. For now we’ll have to assume the user is interested enough to play with the script and find interesting patterns on their own.

Take a look at the Pattern tab on the final creator here:

This tab has several parameters available to travel through the design space. The Period,Thickness and Height parameters control the overall pattern. The Location and Rotation params move the ring geometry to different areas in the pattern. Consider this like driving the pattern around to find the right parking space. The last parameter, Blend let’s you change the amount of blending that’s used. This changes the overall look a fair bit and can also be used to get around some wallthickness issues to remove or thicken small pieces.

A few more pictures to wet your appetite. This is a close up of a printed piece:

And this is a montage of a few different parameter settings. I really like the range of different patterns you can get from this script.

I added this creator to the ShapeJS Examples page, you can find the completed script here: VolumePattern Example.

You may also like
Shapeways
How to Set Up the Shapeways Fulfillment App for Shopify
October 5, 2018
Products and Design
Bring this to the Winter Games: The app that turns your best ski runs into trophies
February 12, 2018
Products and Design
CAD vs. Modeling: Which 3D Software to Choose?
January 26, 2018