More on Parametrics

Parametric 3D Printing!

Some nitty-gritty on parametric 3D printing.  The print head’s movements are intrinsically a parametric equation, since it moves in x, y and z as three functions of the time, t.  For this reason, any printable shape at all could be described by a sufficiently complex parametric equation.  A lot of shapes are easier described by the descrete assembly of lines generated by analyzing mesh data, which is why we have Skeinforge, but this post is about how to actually make 3D prints of parametric objects, so let’s get started!

You can download the GCode-spitting scripts I’m using to see this all in action.  I’ve tried to comment these scripts pretty generously, but if I’ve left anything out, leave a note in comments and I’ll see if it can be made clearer.

First, there’s the setup GCodes and MCodes, a lot like what you’ve seen at the beginning of other GCodes.  No raft this time, but if you want one you can always build your own; they’re pretty easy to bodge together with for loops.  Next, the loop structure of these parametric prints matches the behavior of a typical 3D print: describe the geometry of one layer on the innermost loop, and then have an outer one which increments the position of the z-stage by one layer thickness.

This structure is about the only thing that’s locked in for parametric printing.  (You can probably even break that rule, but you’d better know what you’re doing if you do!)  From here on you can do pretty much anything, although remember there’s no skeinforge settings here to rescue you if there’s overhang.  When parametric prints go bad, they can go really bad.  However, once you’ve written out to GCode, the viewers that come with Skeinforge can be used on them.  (Skeinview is a great sanity check here!)

On to what I’ve done so far: most of my 3D parametrics so far have been straightforward combinations of trigonometric functions.  One nice thing about trig functions (at least, sine and cosine) is that they will never return values outside the range [-1, 1], making it easy to predict and control the size of a 3D print, if not its exact shape.

In para_02.py you’ll see the trig functions being used for one of their simplest parametric applications: describing a circle.  On each layer, X is set to the cosine of the input and Y is set to the sine.  The print head moves in 62 steps of a tenth of a radian each, drawing a circle, and then moves up to the next layer.

The 2D profile laid down on each step can be a function of the current height, so there’s no need for parametric prints to be simple profile prisms.  I’ve experimented with scalling the profile by Z (multipy xval and yval by some function of zval) and rotating the profile, which is done by the following formula which you may or may not remember from Geometry class:

x’ = x cos T – y sin T

y’ = x sin T + y cos T

Note in my example I’ve pulled x’ and y’ off to the side so that calculating x’ doesn’t mess up the value of x when calculating y’.  In para_03.py I made it a function GCode objects can perform on themselves.  The range of spiral shapes and wobbly surfaces that can be concocted from just these base parameters is pretty broad, but there’s a lot of room to explore.  Here’s some things I haven’t done yet, but which someone should:

* Threaded rods and worm gears are screw-spun extrusions, which should be a natural fit for this technique.

* Any profile at all can be used as a base, up to and including pre-computed profiles and solid shapes peeled from Skeinforge output.

* Parametric equations for step functions would be if statements.  A big list of things could be done this way.

* Shapes represented in polar coordinates could be generated using the inner loop as an iteration on those instead.  Z would probably have to stay Cartesian though.

* Recursion and relative coordinates for fractal boundaries.

* Hijack some of Skeinforge’s functionality, calling functions like infill from within the GCode-generating script to extend the capability of parametric modeling dramatically.

* Integrate a formula box with a code-generating script and a 3D GCode viewer to create a parametric modeling suite.  (Hey, I can dream, right?)

3 Comments »

  1. Worm Gears Said,

    July 1, 2009 @ 1:59 am

    Pretty cool information, I always like to know about worm gears as my knowledge Worm gears are very useful gear for mining and other industries Worm gears are used when large gear reductions are required. Worm gear has a unique property of easily turning the gear.

    I appreciate your knowledge. Keep it up!

  2. Renoir Said,

    July 1, 2009 @ 4:19 am

    Could you use parametrics to generate a parabolic curve shape to use as a former to create a parabolic mirror? It might be useful to create a mould?

    Come to that, you could always attach a polisher to the end of the RepRap head and use it to polish the mirror too!

  3. Demented Chihuahua Said,

    July 1, 2009 @ 8:22 am

    That’s not dreaming too much. Lots of commercial packages allow 3d modeling with parametric flavors. Generally these progress from sketching, extruding, and locking the model and then applying equations describing the relationships to the various dimensions until the model is fully constrained. Close to what you talked about with the outline thing. Nice post.

    Demented

Leave a Comment