Zum Inhalt springen
Back to Tutorials

Designing Your First Vase

Vases are one of the most popular 3D-printed objects, and for good reason — they're functional, decorative, and a great way to learn parametric design. In this tutorial, you'll use CADFaber's Code Editor to create a twisted vase that you can customize with sliders.

Why Code-Based Design?

While the Visual Builder is great for simple shapes, code-based design with JSCAD offers several advantages for parametric objects like vases:

  • Parametric control: Every dimension is a variable that can be adjusted with a slider. Change the radius, and the entire vase updates instantly.
  • Repeatability: Save your code and regenerate the same vase with different parameters anytime.
  • Complexity: Operations like twisting, scaling along an axis, or creating patterns are trivial in code but difficult or impossible with drag-and-drop.

Step 1: Open the Code Editor

Open the CADFaber Editor and switch to Code mode using the tabs in the toolbar (or press Ctrl+2). You'll see the Monaco code editor on the left and the 3D viewport on the right.

Step 2: Load the Twisted Vase Template

Click the "Templates" dropdown at the bottom of the code editor and select "Twisted Vase". The editor will load a pre-written JSCAD script that creates a parametric vase.

Let's look at the code:

const jscad = require('@jscad/modeling')
const { circle } = jscad.primitives
const { extrudeLinear } = jscad.extrusions

const getParameterDefinitions = () => [
  { name: 'radius', type: 'number', initial: 15,
    min: 5, max: 50, step: 1, caption: 'Radius' },
  { name: 'height', type: 'number', initial: 40,
    min: 10, max: 100, step: 1, caption: 'Height' },
  { name: 'twist', type: 'number', initial: 90,
    min: 0, max: 360, step: 10, caption: 'Twist (deg)' },
  { name: 'segments', type: 'int', initial: 6,
    min: 3, max: 12, step: 1, caption: 'Segments' },
]

const main = (params) => {
  const profile = circle({
    radius: params.radius,
    segments: params.segments
  })
  return extrudeLinear({
    height: params.height,
    twistAngle: params.twist * Math.PI / 180,
    twistSteps: 20
  }, profile)
}

module.exports = { main, getParameterDefinitions }

Understanding the Code

The code has three main parts:

  1. Imports: We import circle (a 2D shape) and extrudeLinear (which turns a 2D shape into a 3D solid by pulling it upward).
  2. Parameter Definitions: The getParameterDefinitions function tells CADFaber to create sliders. Each parameter has a name, type, default value, min/max range, and a human-readable caption.
  3. Main Function: The main function receives the parameter values and returns a 3D geometry. Here, we create a circle and extrude it upward with a twist.

Step 3: Render and Adjust Parameters

Click "Render" (or press Ctrl+Enter) to see the vase in the 3D viewport. Below the code editor, you'll see automatically generated parameter sliders:

  • Radius: Controls the vase's width. Try 20-30 for a medium vase.
  • Height: How tall the vase is. 60-80mm makes a good desktop vase.
  • Twist: The rotation in degrees from bottom to top. 180° creates a half-turn, 360° a full spiral.
  • Segments: The number of sides. 6 gives a hexagonal cross-section, 3 makes it triangular, 12 approaches a circle.

Adjust the sliders and the vase updates automatically after a short delay. This is the power of parametric design — one model, infinite variations.

Step 4: Making It Your Own

Here are some modifications you can try:

Add a Base

Most vases need a solid base. You can add one by creating a short, untwisted extrusion and combining it with the vase using union:

const { union } = jscad.booleans

const main = (params) => {
  const profile = circle({
    radius: params.radius,
    segments: params.segments
  })

  // Base (no twist)
  const base = extrudeLinear(
    { height: 3 }, profile
  )

  // Vase body (with twist)
  const body = extrudeLinear({
    height: params.height,
    twistAngle: params.twist * Math.PI / 180,
    twistSteps: 20
  }, profile)

  return union(base, translate([0, 0, 3], body))
}

Make It Hollow

For a real vase, you need to hollow it out. Create a slightly smaller cylinder and subtract it:

const { subtract } = jscad.booleans
const { cylinder } = jscad.primitives

// Inside the main function:
const inner = cylinder({
  radius: params.radius - 2,  // 2mm wall thickness
  height: params.height - 3   // Leave bottom solid
})
return subtract(vase, translate([0, 0, 3], inner))

Step 5: Check Printability

Before exporting, run the Print Analysis (printer icon in the toolbar) to verify your vase is printable:

  • Watertight:The mesh should be closed (manifold). If you see "open edges", check that your boolean operations are correct.
  • Wall thickness: For FDM printing, walls should be at least 1.2mm thick (2-3 nozzle widths).
  • Overhangs: Twisted vases usually print well because each layer is only slightly rotated. But extreme twists (360°+ on a short vase) can create problematic overhangs.

Step 6: Export and Print

Export your vase as STL Binary using Ctrl+E and open it in your slicer. Here are recommended print settings for vases:

  • Layer height: 0.2mm for standard quality, 0.12mm for smooth curves
  • Infill: 0% (vase mode) or 10-15% for structural strength
  • Vase mode: Most slicers have a "Spiral Vase" or "Vase Mode" option that prints the walls in a single continuous spiral. This is ideal for thin-walled vases.
  • Material: PLA is fine for decorative vases. PETG if you want to use it with water (PLA isn't watertight without post-processing).
  • Supports: Usually not needed for twisted vases, but check the overhang analysis.

Going Further

Now that you've created your first parametric vase, explore JSCAD's other capabilities:

  • extrudeRotate — Create shapes of revolution (bowls, rings)
  • hull — Create smooth, organic shapes from multiple primitives
  • colorize — Add colors for multi-material printing

Check the Templates library for more starting points, including gears, organizers, and cookie cutters.


Open CADFaber Editor — Try the Twisted Vase template now.