基础语法
var = value;
var = cond ? value_if_true : value_if_false;
var = function (x) x + x;
module name(…) { … }
name();
function name(…) = …
name();
include <….scad>
use <….scad>
常数
运算符
n + m Addition
n - m(Subtraction)
n * m(Multiplication)
n / m(Division)
n % m(Modulo)
n ^ m(Exponentiation)
n < m(Less Than)
n <= m Less or Equal
b == c Equal
b != c Not Equal
n >= m Greater or Equal
n > m Greater Than
b && c Logical And
b || c Logical Or
!b Negation
Special variables
$fa minimum angle
$fs minimum size
$fn number of fragments
$t animation step
$vpr viewport rotation angles in degrees
$vpt viewport translation
$vpd viewport camera distance
$vpf viewport camera field of view
$children number of module children
$preview true in F5 preview, false for F6
Lists
list = […, …, …]; create a list
var = list[2]; index a list (from 0)
var = list.z; dot notation indexing (x/y/z)