Parametric 3D Modeling II - Advanced OpenSCAD

Welcome to your second lesson in parametric 3D modelling!
Today you’ll learn how rotate_extrude works—turning a 2D profile into a 3D form by spinning it around an axis. We’ll use a maths idea you already know—the sine wave—and shape it into a graceful vase. The vase you designed will be 3D-print, here’s an example of what you’ll have at the end:

Without further ado, let’s get started!

Here is the code that you can directly copy and paste into OpenSCAD for your convenience:

// Sine-driven vase (solid)
// $fn = 100 → splits the circle into 100 slices (more = smoother)
$fn = 100;   // number of circle slices

H  = 180;    // vase height
r0 = 20;     // base/average radius (overall size)
A  = 12;     // wave size (bigger = curvier sides)
k  = 2;      // how many waves from bottom to top
N  = 120;    // how many points we sample along the height

// Radius at height y.
// Uses sine to make the sides “wiggle” gently.
// NOTE: OpenSCAD uses degrees, so 360*k*(y/H) is in degrees.
function r(y) = r0 + A * sin(360 * k * (y / H));

// Spin the 2D outline around the Z-axis to make the 3D vase.
// The outline is built from points: [x = r(y), y = height].
rotate_extrude(angle = 360)
  polygon(points =
    concat(
      [[0,0]],                                 // start on axis at the base
      [ for (i=[0:N]) [ r(i*H/N), i*H/N ] ],   // sampled curve up to y = H
      [[0,H]]                                  // return to axis at the top
    )
  );

Great work so far!

When you’re ready to explore further, check out MakerWorld’s MakerLab for lots of pre-made OpenSCAD tools and examples: makerworld.com/en/makerlab. Feel free to tinker, remix, and create whatever you like. Remember: every function you see there is built the same way you designed your vase—using code to define shapes and operations. Happy modelling!

Next
Next

Parametric 3D Modeling I - OpenSCAD Vase