OpenSCAD User Manual/Command Glossary

This is a Quick Reference; a short summary of all the commands without examples, just the basic syntax. The headings are links to the full chapters.

''' Please be warned: The Command Glossary is presently outdated (03 2015). '''

Please have a look at the Cheatsheet, instead:

http://www.openscad.org/cheatsheet/

Mathematical Operators
&#43; &#45;  // also as unary negative * / % // this is mod

< <= == != >= >

&&  // logical and &#124;&#124;  // logical or !    // logical not

?  : 

Mathematical Functions
abs ( &lt;value&gt; )

cos ( &lt;degrees&gt; ) sin ( &lt;degrees&gt; ) tan ( &lt;degrees&gt; ) asin ( &lt;value&gt; ) acos ( &lt;value&gt; ) atan ( &lt;value&gt; ) atan2 ( &lt;y_value&gt;, &lt;x_value&gt; )

pow( &lt;base&gt;, &lt;exponent&gt; )

len ( &lt;string&gt; )  len ( &lt;vector&gt; )   len ( &lt;vector_of_vectors&gt; ) min ( &lt;value1&gt;, &lt;value2&gt; ) max ( &lt;value1&gt;, &lt;value2&gt; ) sqrt ( &lt;value&gt; ) round ( &lt;value&gt; ) ceil ( &lt;value&gt; ) floor ( &lt;value&gt; ) lookup( &lt;in_value&gt;, &lt;vector_of_vectors&gt; )

String Functions
str(string, value, ...)

Primitive Solids
cube(size =, center = );

sphere(r = );

cylinder(h =, r1 = , r2 = , center = ); cylinder(h =, r = );

polyhedron(points = [[x, y, z], ... ], triangles = [[p1, p2, p3..], ... ], convexity = N);

Transformations
scale(v = [x, y, z]) { ... }

(In versions > 2013.03) resize(newsize=[x,y,z], auto=(true|false) { ... }        resize(newsize=[x,y,z], auto=[xaxis,yaxis,zaxis]) { ... }  // #axis is true|false resize([x,y,z],[xaxis,yaxis,zaxis]) { ... } resize([x,y,z]) { ... }

rotate(a = deg, v = [x, y, z]) { ... } rotate(a=[x_deg,y_deg,z_deg]) { ... }

translate(v = [x, y, z]) { ... }

mirror([ 0, 1, 0 ]) { ... }

multmatrix(m = [tranformationMatrix]) { ... }

color([r, g, b, a]) { ... } color([ R/255, G/255, B/255, a]) { ... } color("blue",a) { ... }

Conditional and Iterator Functions
for ( = ) {...}

intersection_for ( = ) {...}

if {...} else {...}

assign ( =, = , ...) {...}

CSG Modelling
union {...}

difference {...}

intersection {...}

render(convexity = ) { ... }

Modifier Characters
! { ... } // Ignore the rest of the design and use this subtree as design root * { ... } // Ignore this subtree % { ... } // Ignore CSG of this subtree and draw it in transparent gray
 * 1) { ... } // Use this subtree as usual but draw it in transparent pink

Modules
module name(, , ...) { ...&lt;module code&gt;...} Variables can be default initialized &lt;var1&gt;=&lt;defaultvalue&gt;

In module you can use children to refer to all child nodes, or children(i) where i is between 0</tt> and <tt>$children</tt>.

Include Statement
After 2010.02 include <filename.scad> (appends whole file)

use <filename.scad> (appends ONLY modules and functions)

filename could use directory (with / char separator).

Prior to 2010.02 <filename.scad>

Other Language Features
$fa is the minimum angle for a fragment. The default value is 12 (degrees)

$fs is the minimum size of a fragment. The default value is 1.

$fn is the number of fragments. The default value is 0.

When $fa and $fs are used to determine the number of fragments for a circle, then OpenSCAD never uses less than 5 fragments.

$t

The $t variable is used for animation. If you enable the animation frame with view->animate and give a value for "FPS" and "Steps", the "Time" field shows the current value of $t.

function name(&lt;var&gt;) = f(&lt;var&gt;);

echo(&lt;string&gt;, &lt;var&gt;, ...);

render(convexity = &lt;val&gt;) {...}

surface(file = "filename.dat", center = &lt;boolean&gt;, convexity = &lt;val&gt;);

2D Primitives
square(size = &lt;val&gt;, center=&lt;boolean&gt;); square(size = [x,y], center=&lt;boolean&gt;);

circle(r = &lt;val&gt;);

polygon(points = [[x, y], ... ], paths = [[p1, p2, p3..], ... ], convexity = N);

3D to 2D Projection
projection(cut = &lt;boolean&gt;)

2D to 3D Extrusion
linear_extrude(height = &lt;val&gt;, center = &lt;boolean&gt;, convexity = &lt;val&gt;, twist = &lt;degrees&gt;[, slices = &lt;val&gt;, $fn=...,$fs=...,$fa=...]){...}

rotate_extrude(convexity = &lt;val&gt;[, $fn = ...]){...}

DXF Extrusion
linear_extrude(height = &lt;val&gt;, center = &lt;boolean&gt;, convexity = &lt;val&gt;, twist = &lt;degrees&gt;[...]) import (file = "filename.dxf", layer = "layername")

rotate_extrude(origin = [x,y], convexity = &lt;val&gt;[, $fn = ...]) import (file = "filename.dxf", layer = "layername")

STL Import
import("filename.stl", convexity = &lt;val&gt;);