OpenSCAD

This is a very awesome open source 3D modeling tool created by Clifford Wolf. It is a CSG (Constructive Solid Geometry) based 3D modeling program where you create your objects using a geometric programming language that is very similar to C

Language Documentation

This section contains a brief documentation of the OpenSCAD language. Please also have a look at the examples to get a better impression on how the language constructs described here can be used.

Basic syntax

..TO BE WRITTEN..

Expressions

..TO BE WRITTEN..

Primitive Solids

cube();

Parameters:
size = 1
center = false

Creates a cube at the origin of the coordinate system. When center is true the cube will be centered on the origin, otherwise it is created in the first octant. The argument names are optional if the arguments are given in the same order as specified above.

sphere();

Parameters:
r = 1

Creates a sphere at the origin of the coordinate system. The argument name is optional.

cylinder();

Parameters:
h = 1
r1 = 1
r2 = 2
center = false

Creates a cylinder at the origin of the coordinate system. When both radii are same it is also possible to specify a single radius using the argument name r. The argument names are optional if the arguments are given in the same order as specified above.

polyhedron()

Parameters:
points = [ [x y z], … ], triangles = [ [p1 p2 p3..], … ]

Create a polyhedron with the specified points and triagles. (The 'pN' components of the triagles vector are 0-indexed references to the elements of the points vector.)

Transformations

scale(v = [x y z]) { … }

Scales its child elements using the specified vector. The argument name is optional.

rotate(a = deg, v = [x y z]) { … }

Rotates its child a degrees around the specified vector (rooted in the origin of the coordinate system). The argument names are optional if the arguments are given in the same order as specified above.

Alternatively the a parameter may be a vector of three degrees. In this case the child nodes are rotated around the positive x, y and z axis (in this order) by the specified number of degrees and the v argument is ignored and may be left unspecified.

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

Translates (moves) its child elements along the specified vector. The argument name is optional.

multmatrix(v = […]) { … }

Multiplies the geometry of all child elements with the given 4x4 matrix.

CSG Modelling

union() { … }

Creates a union of all its child nodes.

difference() { … }

Subtracts the 2nd (and all further) child nodes from the first one.

intersection() { … }

Creates the intersection of all child nodes.

render(convexity = 1) { … }

Always calculate the CSG model for this tree (even in OpenCSG preview mode). The convexity parameter specifies the maximum number of front sides (back sides) a ray intersecting the object might penetrate. This parameter is only needed for correctly displaying the object in OpenCSG preview mode and has no effect on the polyhedron rendering.
Modifier Characters

% { … }

Ignore this subtree for the normal rendering process and draw it in transparent gray (all transformations are still applied to the nodes in this tree). This is called the "Background Modifier".

  1. { … }

Use this subtree as usual in the rendering process but also draw it unmodified in transparent pink. This is called the "Debug Modifier".

! { … }

Ignore the rest of the design and use this subtree as design root. This is the "Root Modifier".

  • { … }

Simply ignore this entire subtree. This is the "Disable Modifier".
Control Statements
..TO BE WRITTEN..
DXF Extrusion
..TO BE WRITTEN..
Surface Extrusion
..TO BE WRITTEN..
Functions
..TO BE WRITTEN..
Modules
..TO BE WRITTEN..
Author

OpenSCAD has been written by Clifford Wolf.

Unless otherwise stated, the content of this page is licensed under GNU Free Documentation License.