Basic Syntax
- var x = 42;
- module name() {}
- if (x > 0) {}
- for(var i = [1:10]) {}
- [1, 2, 3]
Operators
- + - * /
- < <= > >= == !=
- && || !
- vector[number]
Basic Shapes
- sphere(radius);
- cube(size);
- smooth_cube(size, radius=0.1);
- cylinder(radius, height);
- cone(radius, height);
SDF Operators
Specify a signed distance function manually:
- sdf(face(
sqrt(sqr(x) + sqr(y) + sqr(z)) - 2,
0.1))
Expressions:
- x, y, z - coordinates of current point
- a + b, a - b, a * b, a / b, -a, sqrt(a), sqr(a), abs(a), sin(a), cos(a), exp(a), log(a), min(a, b), max(a, b), atan2(a, b), smooth_union(a, b, r)
- face(expr, size) - Continuous surface for expr, minimum tri size size. Every discontinuity in the SDF surface should be marked by a face.
Transformations
- translate([x,y,z]) {}
- rotate([x,y,z]) {}
- scale([x,y,z]) {}
Boolean Operations
- union() {}
- intersection() {}
- difference() {}
- smooth_union(r, detail=200%) {}
- smooth_intersection(r, detail=200%) {}
- smooth_difference(r, detail=200%) {}
- detail(size=0.1) {} - Set minimum feature size
- shell(thickness) {} - Create a hollow shell
Keyboard Shortcuts
- Tab - Indent code
- Shift+Tab - Unindent code
- Esc then Tab - Move focus out of editor (for screenreaders)
- Ctrl+5 - Generate mesh
- Esc - Return to preview
.png)

