I used it for a project recently and found it to be really nice and expressive. I love that it's got a functional feel but you can do loops and compose modules in a really powerful way.
I used it for a project recently and found it to be really nice and expressive. I love that it's got a functional feel but you can do loops and compose modules in a really powerful way.
if (some_condition) {
x = 2;
}
x doesn't get set to 2. Or even better, this: x = 2;
echo("x = ", x);
x = 5;
This prints out that x = 5.I work with these kinds of things a lot, having that clear divide between declarative and imperative operations on whatever being expressed isn't only easier to learn and read, it's far more expressive and powerful for complex systems.
I'm just saying its odd behavior makes a lot more sense once you know it's meant to be declarative, and you can make a lot more headway when working with it.
- you can't store objects in variables, so code looks convoluted with deep nesting as you need to apply multiple transforms to objects
- there are no real variables, more like constants that take the value of the last assignment, so you can't do basic stuff like x = min(x, 5)
- you can't access object attributes (size, etc.) so it's not possible to generate features that depend on another object. You always need to have lots of parameters in scope. A simple use case would be to punch 4 holes in the corners of a box cover.
- string functions are very limited, there is only str() to convert a value to string but with no control on the formatting, there is no printf-equivalent
``` module thing(x) { cylinder(r=x,h=10); }
translate([10,0,0]) thing(5); x = min(4,2) + 1; translate([-10,0,0]) thing(x); ```
works for me.
i =0;
for (j = [1:5]){
echo(i);
i=i+1;
}
keeps printing "1" instead of 0 to 4