Designing with OpenSCAD

 

If you’re an experienced programmer then you’re going to love this. But even if you’ve never written a line of code before in your life, you’ll be able to learn the basics of OpenSCAD and get started modeling right away!  Even better, you’ll be able to add variables and parameters to your models so that you can customize and modify your designs very easily when you want to change things.

Step 1. Get OpenSCAD

Start by downloading a free copy of OpenSCAD

You should also bookmark the very useful OpenSCAD User Manual and OpenSCAD Cheat Sheet. The best way to learn code is by example, and the OpenSCAD user manual includes example code for all its commands and operations. The fastest way to find reference information is just to Google it; for example, searching for “OpenSCAD for loop” will get you pretty quickly to the documentation page you need for reference.

 

Step 2. Jump right in with tutorials and videos

For a quick start, check out the Hello OpenSCAD one-page starter document with OpenSCAD sample files. For extensive documentation and examples, see the Thingiverse OpenSCAD Jumpstart page and OpenSCAD discussion group. Or, get started in less than 10 minutes by watching and playing along with the video PolyBowls – A simple OpenSCAD code walkthrough.

https://www.youtube.com/watch?v=4nMHhzHu234

If you like learning by video then you should also check out Patrick Conner’s video playlist of OpenSCAD tutorials. This playlist is how some of us at 3SPACE initially learned about OpenSCAD, and the videos are very clear, simple, and easy to follow.

 

Step 3. Learn from inside the code itself!

Watching videos and reading tutorials is great, but to really learn to code you have to get in there and type it yourself. If you haven’t done that yet, then try out this OpenSCAD Tutorial Code written by former JMU 3SPACE student Tony Mannino. Tony’s tutorial code will help you learn how to create basic OpenSCAD objects, how to modify those basic objects, and even how to combine objects and create code loops.

The way to use this tutorial code is to download it, open it in OpenSCAD, and then start un-commenting pieces of code to see what they do.

More precisly, to use this tutorial, try un-commenting some code to make it active, then press “F5” (or “Function-F5” on some smaller or laptop keyboards) to see the result of the code in the graphics window. “Commented” code is ignored by the compiler, so only uncommented code will be run and displayed.

So how do you un-comment something?  Comments in OpenSCAD can appear two different ways: First, anything preceded by the double-slash “//” will be ignored. For example, to see what the piece of code below does in OpenSCAD, you would erase the comment symbol “//” at the start of the line in the OpenSCAD Tutorial Code file, and then compile the code with “F5”. The result should be a sphere of radius 10mm. If you want to make the sphere go away again, then just put the comment symbol back in.

//sphere(10); 

The second way that comments can appear in OpenSCAD is between the start-comment code “/*” and the end-comment code “*/”. For example, to un-comment the code snippet below, remove the start and end codes and then compile with “F5”. The result should be a translated sphere of radius 10mm.

/*
translate([25,0,0]) {
 sphere(10);
}
*/

Good luck with OpenSCAD, and have fun!

 

Portions of this tutorial also appear by the same author in her "Tutorial Tuesday" column at the Shapeways blog