Modifier Characters
*
- disable
!
- show only
#
- highlight / debug
%
- transparent / background
2D
circle(radius | d=diameter)
square(size,center)
square([width,height],center)
polygon([points])
polygon([points],[paths])
text(text,size,font,direction,language,script,
halign,valign,spacing,em)
import("….extformats: DXF|SVG", center, convexity)
projection(cut)
3D
sphere(radius | d=diameter)
cube(size, center)
cube([width,depth,height], center)
cylinder(h,r|d,center)
cylinder(h,r1|d1,r2|d2,center)
polyhedron(points, faces, convexity)
import("….extformats: STL|OFF|AMF|3MF", center, convexity)
linear_extrude(height,v,scale,center,twist,slices,
segments,convexity)
rotate_extrude(angle,start,convexity)
surface(file = "….extformats: DAT|PNG",center,convexity)
Transformations
translate([x,y,z])
rotate([x,y,z])
rotate(a, [x,y,z])
scale([x,y,z])
resize([x,y,z],auto,convexity)
mirror([x,y,z])
multmatrix(m)
color("colorname",alpha)
color("#hexvalue#rgb|#rgba|#rrggbb|#rrggbbaa")
color([r,g,b,a])
offset(r|delta,chamfer)
fill()
hull()
minkowski(convexity)
Lists
list = […, …, …];
- create a list
var = list[2];
- index a list (from 0)
list2 = list1.xyzz;
- swizzling
Objects
obj = object(…,name=value,…);
obj = object(…,[…,["name",value],…],…);
obj = object(…,object,…);
obj = object(…,[…,["name"],…],…);
var = obj.name;
var = obj["name"];
has_key(object,"name");
Boolean operations
union()
difference()
intersection()
List Comprehensions
Generate [ for (i = range|list|object) i ]
Generate [ for (init;condition;next) i ]
Flatten [ each i ]
Conditions [ for (i = …) if (condition(i)) i ]
Conditions [ for (i = …) if (condition(i)) x else y ]
Assignments [ for (i = …) let (assignments) a ]
Flow Control
for (i = [start:end]) { … }
for (i = [start:step:end]) { … }
for (i = […,…,…]) { … }
for (i = …, j = …, …) { … }
for (i = object) { … }
intersection_for(i = [start:end]) { … }
intersection_for(i = [start:step:end]) { … }
intersection_for(i = […,…,…]) { … }
intersection_for(i = object) { … }
if (…) { … }
let (…) { … }
Type test functions
is_undef
is_bool
is_num
is_string
is_list
is_function
is_object
Other
echo(…)
render(convexity)
children([idx])
assert(condition, message)
assign (…) { … }
Functions
concat
lookup
str
chr
ord
search
version
version_num
parent_module(idx)
textmetrics(text,size,font,
direction,language,script,
halign,valign,spacing,em)
fontmetrics(size, font, em)
Mathematical
abs
sign
sin
cos
tan
acos
asin
atan
atan2
floor
round
ceil
ln
len
let
log
pow
sqrt
exp
rands
min
max
norm
cross