OpenSCAD is a programming language for solid CAD objects.
OpenSCAD is free software for GNU/Linux, MS Windows and Mac OSX. It provides two main modeling techniques: First, constructive solid geometry (CSG) and second, extrusion of 2D outlines. Autocad DXF files are used as the data exchange format for the 2D outlines. In addition to reading DXF files, OpenSCAD can also read and create 3D models in the STL file format, which is commonly used for 3D printing. It is also possible to read design parameters from text files.
OpenSCAD is a completely text-based programming environment which is free, powerful, and open-source. However, it can be very slow to render complex objects, and some aspects of the language are unusual (such as the assignment of variables at compile time).
Getting Started with OpenSCAD:
- Go to http://www.openscad.org/ and download OpenSCAD for your operating system. In MacOSX, you may need to right-click on the application, in order to open it, as the executable is not signed. (Check out this link for the most up-to-date development version, which dates from 12/31/2014; note that Animation frame exporting seems to be broken for that version.)
- Copy-paste the following program for an “iterative form” into the white “Editor” area on the left half of the UI:
for ( i = [-2 : 2] ){ translate ([i*10, 0, 0]){ cylinder(h = 20, r1 = 8, r2 = 4); translate ([0,0, 20]){ sphere (r = 6+i); } } }
- From the OpenSCAD menu, select Design > Render. Wait a few moments. You should see this appear in the yellow area:
It’s also possible to use OpenSCAD to create 4D animations. In the OpenSCAD menu system, select View > Animate. Now in the lower right part of the UI, you will see an interface that allows you to specify the number of animation steps and the desired frames per second:
Now Change the code so that it uses the special “animation” variable, $t, which is swept from 0….1. You will now see an animation.
for ( i = [-2 : 2] ){
translate ([i*10, 0, 0]){
cylinder(h = 20, r1 = 1+8*$t, r2 = 4);
translate ([0,0, 20]){
sphere (r = 6+i);
}
}
}
An “Dump Pictures” checkbox allows you to export frames of this animation, which you can compile (in Photoshop etc.) to create an animated GIF:
Incidentally, another advantage of OpenSCAD is that it can “stub out” control parameters for end-user manipulation and exploration in external applications like the Thingiverse Customizer. The Customizer tool creates slider interfaces for select program variables exposed by the OpenSCAD programmer. An example of this can be seen in these Fraction Blocks (by Bitcraft Lab): http://www.thingiverse.com/thing:218491.
Tutorials to Follow:
- An overview of tutorials is here: http://www.makerbot.com/tutorials/openscad-tutorials/.
- Here’s a really simple tutorial: http://blog.cubehero.com/2013/11/19/know-only-10-things-to-be-dangerous-in-openscad/
- Here’s a good tutorial: http://edutechwiki.unige.ch/en/OpenScad_beginners_tutorial.
- This set of extremely simple tutorials covers setting up the OpenSCAD interface, how to make 2D forms, how to make some basic 3D forms, how to position those forms in 3D space, and the different ways to combine forms.
- There’s also Jestin Stoffel’s video tutorials: http://www.openscad.org/documentation.html.
- This tutorial explains how to prepare OpenSCAD code for the Thingiverse Customizer.
Key Resources for the OpenSCAD Language:
- Of course you will consult the core documentation: the OpenSCAD User Manual.
- This section of the manual guides your first steps with OpenSCAD.
- Next comes a very general overview of the OpenSCAD language.
- It’s crucial to understand that Variables are set at compile-time, not run-time.
- Also, be sure to see this page to understand variable scoping in OpenSCAD.
Also Noteworthy:
OpenSCAD has some particularly powerful functions that deserve your attention:
- difference() & intersect() — Constructive Solid Geometry (CSG) booleans on shapes.
- linear_extrude() & rotate_extrude() — Extrude a 2D curve into 3D. (Also see.)
- lookup() — Lookup table with linear interpolation.
- minkowski() — Convolve two shapes.
- hull() — Convex hull of several shapes.
Browser-Based Versions of OpenSCAD:
If you prefer not to install new software on your computer, alternatives exist which allow you, to a greater or lesser extent, to use OpenSCAD in your browser. Your mileage may vary, but if you wish, you may try the following: http://openscad.net | http://openjscad.org/.