One of my favorite hobbies is making rolling ball sculptures.  I usually make RBSs out of copper but being a geek I thought it would be cool to make a virtual sculpture and 3D print it on Shapeways. 

I started first by trying to model an RBS with Blender.  I quickly realized that doing anything in Blender takes quite a time commitment and has a steep learning curve.  I tried evaluating some other 3D modeling programs but every package seemed too difficult to use to build an RBS for my apparently little brain.

I realized quickly that whenever I made a virtual 3D model, I would need to be able to easily build it and modify it.  Well, modifying a rolling ball sculpture has consequences such that any change made higher up will affect a portion of the track lower down.  Being a computer programmer kind of guy, I thought it would be interesting to try to make a virtual model programmactically which would give me the freedom of making something which could be very accurate and forgiving as far as modifying the model.

Step 1: Use VRML to Create a Simple 3D Virtual Model

To start I decided to use VRML (Virtual Reality Modeling Language).  VRML comes in a few flavors.  There's VRML 1.0, 2.0 and then came X3D.  X3D is sort of XML based and the latest and probably last version of VRML.  I had already played with VRML 2.0 before so I went with that because I was too lazy to learn X3D.  Looking at it, though, it's very similar to VRML so it really is that I'm just that I'm too lazy really to try to learn it.

VRML allows you to describe a 3D scene by using primitives like cubes, spheres, extrusions, meshes, etc.  There's options for placing an object or a group of objects in xyz space as well as the ability to scale and rotate them.  VRML is fairly easy to learn and use.  Since it has been around a while, there's plenty of example code on the web so google to your heart's content.

To create a VRML file, you simple create a file using notepad or your favorite text editor and create it with a ".wrl" extension.

On the first line you put:

#VRML V2.0 utf8

Then you put your code for your shape or shapes.  For an RBS I basically use Extrusions for everything.  Here's an example of a RBS Rail:

Transform {
  translation 0 0 0
  children Shape {
    appearance Appearance {
      material Material {
  diffuseColor 0.757827 0.771796 0.771797
  ambientIntensity 0.5
  specularColor 0.708205 0.708205 0.708205
  emissiveColor 0.000000 0.000000 0.000000
  shininess 1
  transparency 0.000000
      } # end material
    } # end appearance
    geometry Extrusion {
      beginCap TRUE
      endCap TRUE
      creaseAngle 0
      solid TRUE
      crossSection [
      0.00150000 0.00000000,
      0.00121353 0.00088168,
      0.00046353 0.00142658,
      -0.00046352 0.00142658,
      -0.00121353 0.00088168,
      -0.00150000 0.00000000,
      -0.00121353 -0.00088168,
      -0.00046353 -0.00142658,
      0.00046352 -0.00142659,
      0.00121352 -0.00088168,
      0.00150000 0.00000000
      ] # end cross section
      spine [
0 0 0,
0 0 -0.01,
0 -0.01 -0.02,
0 -0.02 -0.02
      ] # end spine
    } # end extrusion
  } # end shape

You can end with this code but it's not really necessary usually:

  type "EXAMINE"
} # end NavigationInfo

So what does it all mean?

The first line identifies a VRML file.
The "geometry Extrusion" section defines the extrusion with endcaps, a circular crosssection of xy points, which gets extruded across 4 xyz points.
The "Shape" section defines attributes about the shape which surrounds the geometry Extrusion section.
The "Transform" section defines either where to move the object xyz or scale or rotate the object.  Several Transforms can surround other transforms.  So, for example the inside transform can be for rotation, there could be another that surrounds that transform that could be for scale, and another transform which surrounds both of the others which could be for xyz translation.
The "NavigationInfo" section is for some VRML viewers to know what to do.  You can go into examine mode, or go into flythrough mode, there may be other modes you could do, I don't know them all.

<p>Any chance I can buy the marble run above--the grey one on the right side! I don't have a 3dprinter, so can I get it already made? How much and I will pay right away! </p>
Thanks for your message. Unfortunately, that sculpture is not available. My apologies. I do have other sculptures that may be 3d printed at Shapeways.<br>https://www.shapeways.com/product/PUUT3SNAW/john-3-16-rolling-ball-sculpture-marble-run?optionId=8941378<br>https://www.shapeways.com/product/3RSUFAXLB/super-tiny-rbs-marble-run-rolling-ball-sculpture?optionId=352919
<p>This is a great instructable, the sculptures look brilliant. I recognise your screen-name, when I was making RBS a few years ago your website and creations were my favourite :) </p>
<p>Hi, thanks a lot for this instructable, it helped me tons with my final year CS studies project. I have a VRML question and maybe you can help:</p><p>Assuming I'm limiting my RBS size to a sphere of radius x, do you know of a way to get a &quot;negative&quot; (or complement) of my RBS inside a sphere (of radius x) ? In other words, get my RBS as &quot;tunnels&quot; inside a sphere ?</p><p>I know that it's not very useful for RBSing but that's not exactly my project (though the shape are very similar).</p><p>Thanks for your help so far and maybe further.</p>
Great intro, thank you! I've been trying out some of the techniques and there's one thing I haven't been able to work out how to do. How do you get the vrml to subtract a shape from an existing one in order to cut a hole, like the gills in your raspberry pi case for instance?
vrml can't do boolean operations. So no add, no subtract, no xor. I did the grill the hard way by making a bunch of sticks using a -for- loop. You could make most of the box, then take it into blender to do the boolean subtract. For example, make the box and make some characters, then take it into blender select the two objects and do the boolean subtract. I hope that helps.
Wow! Nice!
These are awesome! Could totally open a new dimension for RBSes. I would appreciate a little more depth on the algorithms so we can follow the instructions. In particular, I'm curious how you worked out the banking angle and smoothly joined sections with different bank. <br> <br>Thanks for posting!
I figure the parser that does a lot of the work would be a whole new topic for another instructable. Anyway, for the banking, if you can imagine, I have an invisible center rail on which I rotate the other two rails. So when I want to turn left, the right rail goes up and in a little and the left rail goes down and in a little according to a z rotation. The track is sort of built in short steps. So the parser sort of figures about 3 steps before the next turn and 3 steps into the next turn to incrementally start banking. After a curve the parser un-banks for about 3 steps before the end of the curve and 3 steps after the curve until it's back to normal no bank for straight track or banked to the next curve for curves.To figure the bank, at first I just guessed and manually set the bank based on the diameter of the curve and that worked. Later, I figured a formula to do the same thing. I figured that this incremental banking was not smoothing so a wrote a function that would smooth the entire track sort of in an Fast Fourier Transform (FFT) sort of and averaging over several steps fashion. I hope that helps.
Yes, that makes sense. Thanks for your quick reply.
Great first Instructable! That Pi case needs its own Instructable too! :D
Those look amazing, nicely done!
Wow, this is really good.
Sweet! This is great stuff.

About This Instructable




More by swirlingbrain:How to Make a Copper Rolling Ball Sculpture Programmatic Creation of a 3D Model for 3D Printing 
Add instructable to: