var x = 42;
module name() {}
if (x > 0) {}
for(var i = [1:10]) {}
[1, 2, 3]
+ - * /
< <= > >= == !=
&& || !
vector[number]
sphere(radius);
cube(size);
cylinder(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) {}
smooth_intersection(r) {}
smooth_difference(r) {}
detail(size=0.1) {}
- Set minimum feature sizeTab
- Indent codeShift+Tab
- Unindent codeEsc
then Tab
- Move focus out of editor
(for screenreaders)Ctrl+5
- Generate meshEsc
- Return to previewsmooth_union(0.1) { sphere(1); translate([0.8, 0, 0]) sphere(0.7); }