## 基础语法

var = value;

var = cond ? value_if_true : value_if_false;

var = function (x) x + x;

module name(…) { … }
name();

function name(…) = …
name();

## 常数

undef undefined value
PI mathematical constant π (~3.14159)

## 运算符

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)

knowledge/openscad/reference/language.txt · 最后更改: 2023/06/07 04:23 由 127.0.0.1