var x = 42;module name() {}if (x > 0) {}for(var i = [1:10]) {}[1, 2, 3]+ - * /< <= > >= == !=&& || !vector[number]sphere(radius);cube(size);smooth_cube(size, radius=0.1);cylinder(radius, height);cone(radius, height);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 pointa + 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.translate([x,y,z]) {}rotate([x,y,z]) {}scale([x,y,z]) {}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 sizeshell(thickness) {} - Create a hollow shellTab - Indent codeShift+Tab - Unindent codeEsc then Tab - Move focus out of editor
(for screenreaders)Ctrl+5 - Generate meshEsc - Return to preview
smooth_union(0.1) {
sphere(1);
translate([0.8, 0, 0])
sphere(0.7);
}