OpenSCAD

Syntax

module name(...) { ... }

function name(...) = ...

include <....scad>

use <....scad>

2D

circle (r=radius | d=diameter)

polygon ([points])

polygon ([points], [paths])

square ([width, height], center)

text (text, size, font, halign, valign, spacing, direction, language, script)

3D

cube (size)

cube ([width, depth, height])

cylinder (h, r|d, center)

cylinder (h, r1|d1, r2|d2, center)

polyhedron (points, triangles, convexity)

sphere (radius | d=diameter)

Transformations

translate ([x, y, z])

rotate ([x, y, z])

scale ([x, y, z])

resize ([x, y, z], auto)

mirror ([x, y, z])

color ("colorname")

color ([r, g, b, a])

offset (r|delta, chamfer)

hull()

Boolean operations

Modifier Characters

*

Disable

!

Show only

#

Highlight / debug

%

Transparent / background

Mathematical

Functions

Other

children ([idx])

echo (...)

for (i = [start:end]) { ... }

for (i = [start:step:end]) { ... }

for (i = [..., ..., ...]) { ... }

if (...) { ... }

import ("....stl")

intersection_for (i = [start:end]) { ... }

intersection_for (i = [start:step:end]) { ... }

intersection_for (i = [..., ..., ...]) { ... }

linear_extrude (height, center, convexity, twist, slices)

projection (cut)

render (convexity)

rotate_extrude (convexity)

surface (file, center, invert, convexity)

List Comprehensions

[ for (i = range|list) i ]

[ for (i = …) if (condition(i)) i ]

[ for (i = …) let (assignments) a ]

Special Variables

Number of module children

Minimum angle

Minimum size

Number of fragments

Animation step

Viewport rotation

Viewport translation

Viewport camera distance

Notes