This app is for Math enthusiasts... It requires some knowledge about sine, cosine and parametric curves...

A short example: Creating a spring


All examples below may be tried with the 3D pipe app, so you can experiment changing parameters. More examples are provided in the 3D pipe app itself, just hit "View Samples".


  • The variable t defines the time from 0 to 2*pi
  • X, Y, Z define a 3D curve as a function of t.
  • D defines the width in mm of the generating circle/polygon as a function of time.
  • S defines the generating shape: circle, hexagon, pentagon, square, triangle, ribbon.
  • If S is not a circle, TW defines the twist angle of the generating shape as a function of time

This formula will generate a torus:

3D pipes sample: torus

Try it

D can be modified as a function of time t.

This formula will generate a cone and by modifying S a variety of pyramids:

3D Pipes sample: Cone

Try it

If S is not a circle, TW can be used to twist the generating shape as a function of time.

3D pipes sample: helicoidal

Try it

The easiest way to generate a printable Mobius strip. Twist TW starts at 0 and ends at pi.

3D pipes sample: Mobius strip

Try it

Giving the ribbon a constant twist of pi/2, a ring is transformed to a washer.

3D pipes sample: washer

Try it


Expressions are not case sensitive.

There is a single predefined constant: pi (3.14159....)

The variable t (time) ranges initially from 0 to 2*pi

Some auxiliary variables can be used, namely:   a, b, k, r, n, w

Auxiliary variable assignment is of the form:  variable = expr;
Several assignments can be done on the same line, like
a = (t-pi)/2; b=t/(2*pi); a
Note that the last term must be the value applied to X, Y or Z...

Variables u and v are used to generate surfaces, see here.

Variables x, y, z, d can be used once they have been computed.

Following arithmetic operators can be used: + - * / < > =  +=  -=  *=  /=  <=  >=  ==  != 
and the conditional operator ? vt : vf see here.

Following functions can be used: sin(), cos(), asin(), acos(), sinh(), cosh(), abs(), exp(), log(), pow(), random(), sqrt(), tan(), atan2(), round(), floor().
pow() needs two parameters, like pow(n, 5) n to the power of 5, atan2() needs 2 parameters: y and x, random() has no parameters and generates a random number between 0 an 1.


Using auxiliary variable n to define turn count of a spring.

3D pipes sample: Spring

Try it

Using variables x, y, z, d once they have been computed

3D pipes sample: Using X, Y, Z, D

Try it

Using hyperbolic function cosh.
sinh and cosh are available only on modern browsers.

3D pipes sample: Table

Try it

Modifying t range from [0, 2*pi] to [-1, +1]

3D pipes sample: Changing t range

Try it


Conditional expressions are of the form: condition ? 'value if true' : 'value if false'


Truncated pyramid with twisted handle

3D pipes sample: Truncated pyramid with twisted handle

Try it

Locking key

3D pipes sample: Locking key

Try it


The app automatically generates u and v variables. u and v initially range from 0 to 2*pi. This allows defining complex u, v surfaces.
When u and v are used in the formula, a new shape control is displayed. It allows displaying true 3D surfaces.
Therefore, u and v variables can be used in 2 modes:
  • Pipe mode :
    16 values of v are used and for each v, 32 values of u are generated. The selected shape follows the X ,Y, Z 3D curve to generate a volume.
  • Surface mode  :
    u, v are used to generate a surface. Note that in most cases, this does not generate a closed printable volume. Therefore, an additional control is displayed. By checking it, the surface is given a 2mm thickness and becomes printable.


A very simple u, v pipe plane. 16 pipes are generated in the Y direction

3D pipes sample: Pipe plane

Try it

A very simple printable u, v surface with 2mm thickness

3D pipes sample: Simple u v surface

Try it

Printable surface of revolution. The generating curve is Z. Note the v==0? condition to avoid 0/0 division.

3D pipes sample: Water drop, surface of revolution

Try it

A non printable Mobius strip. Note that v range is modified from [0,2*pi] to [-1,1].
There's a much easier way to define a printable Mobius strip

3D pipes sample: Mobius strip

Try it

A non printable Klein bottle

3D pipes sample: Klein bottle

Try it

Klein bottle partial 3D print
Partial 3D print showing inside of Klein bottle,
using above formula with


Hit a texture switch for more realistic rendering.
Use Grid 32*32 and Grid 32*4 to visualize volume creation.
Note that STL files do not support texture. If you are the lucky owner of a full color 3D prnter or using a print service, you should first Publish your model (public, unlisted or private), then on the player page hit the Download switch. You may then save your textured model in standard OBJ format.

3D pipes sample: Textured Klein surface
A printable textured Mobius surface

Try it


Formula expressions follow standard Javascript syntax.
Therefore it is possible to create constructs like:
  • if (condition) {statements; value;} else {statements; value}
  • switch(expression) {case value: statements; value; break; ... case... ; default:... }

The following example shows the use of "switch" to generate a tetrapod. It uses the fact that for each value of v, 32 values of u are generated. The first 4 "v" values out of 16 are used.

X Expression: 
u = u / pi / 2; // u range from 0 to 1
a = floor(v/pi*8); // a range from 0 to 15, a=0 top leg, a=1 left leg, a=2 right leg, a = 3 back leg, a>3 discard
b = 1.5 * u; // scaling
switch(a) {
  case 0: case 3: 0; break; // top leg, back leg
  case 1: -b*cos(pi/6); break; // left leg
  case 2: b*cos(pi/6); break; // right leg
  default: 0;}

Y Expression:
switch(a) {
   case 0: 0; break; // top leg
   case 1: case 2: -b*sin(pi/6); break; // left and right legs
   case 3: b; break; // back leg
   default: 0;}

Z Expression:
   case 0: b; break; // top leg
   case 1: case 2: case 3: -b*sin(pi/6); break; // left, right, back legs
   default: 0;}

D Expression:
a>3 ? 0 : 8*(2.5 - b); // truncated cone, use 1.5 instead of 2.5 for full cone

Try it

On the same principle, an octopod, using ribbon and twist:


Try it


Variables units and ranges
  • All angles are assumed to be in radians.
  • X, Y, Z range from -16 to 16. If bigger they will be clipped.
  • The actual print size in mm is obtained by multiplying X, Y, Z by 12.5.
  • The build plane (the grey plane) X range and Y range are -2 to +2.
  • The shape is always Z translated to be above the build plane.
  • D is in mm, TW is in radians.


  • Do not use both u and v as general purpose auxiliary variables. If you do so, the app will assume that you are using u, v surface coordinates and unpredictable results may occur. The safe way is to use a, b, k, r, n, w auxiliary variables.
  • When drawing a printable surface, a tiny line may appear on the shape. This has no impact on the final 3D print result.

Credit: Big thanks to Robert Ferréol and his site from which many examples were taken.