Scripting an Object Into Life with OpenScad


Are you looking for a free and OpenSource CAD program? Are you hesitant to take the time to go through hours of on-line tutorials to learn a program that might not use that often? Do you think programming is rad? OpenScad might be your tool. Let me talk about what I have been using it for and what makes it interesting.

As part of a summer project with the Creative Technologies Association at BSU, I have have been modeling 3D objects with OpenScad. The main object has been a button enclosure for a big red button that we bought from Boise’s scientific surplus store called the Reuseum. I had been introduced to OpenScad through friends at OpenLab Idaho (Wow, lots of… Openness), and chose to use it because, of all the modeling software out there, I knew that I wouldn’t have to deal with any licensing or accounts or free trials. Blender would have been another option, but I didn’t choose for reasons I’ll explain. It was a quick download and I was off.

The gist of OpenScad is that instead of using a slew of tools and design modes to come to a finished product, you have what is called a textual description language. Your shape will be defined by lines of code and will exist as those lines of code until you export the object as a different file type. While OpenScad works on the same principles of other design software, like defining geometry by combining shapes in an intersection or difference, defining these operations are written as a statement much in the same way that you would in any programming language.

cylinder(30,r1 = 7, r2=7);


For example, this is the code to create two primitive shapes, a cylinder, and cube. These shapes happen to be overlapping so I can demonstrate some of the operations that are useful for defining objects.

cylinder(30,r1 = 7, r2=7);

Here is the difference operator, which as you might see is good for subtracting

cylinder(30,r1 = 7, r2=7);


Here we have the product of the intersection operator, which is only the material that is part of both of the primitives. This is just like the intersection of a Venn diagram.

Other than operations like these, OpenScad does not have a whole more to it. What you have is primitive objects(like the ones in the examples), transformations(for moving objects around in space), operations, and then mathematical functions. Instead of having the function that you are looking buried somewhere in a submenu of a submenu like you would with Blender, with OpenScad, you may be figuring how to execute that function as a combination of mathematical functions and operations onto a set of primitive objects.

As I’m writing this, I can see how this can be sort of intimidating. I think that most people don’t want to be handed an electromagnetic theory book when they ask how to get their cell phone connected. Creating an object using only very primitive tools seems like it’s more trouble than it is worth, but depending on what you are doing, it can end up being much more simple than using a fully featured design program. I have preferred this software so far because once I have an object in mind, being familiar with the basic tools is all I need to start devising a strategy that will result in a simple but functional part.

There are some obvious limitations to a design tool that requires you to do a good deal of the heavy lifting. I have yet to see anyone come up with a good solution for a simple loft function, where you take two 2D surfaces and fill the 3D space in between them. You will also not find any of the simulation and rendering capabilities that you find with more full featured software.

I think that OpenScad is ultimately good for very straight-forward projects and is great for people who enjoy programming (I guess it’s why they call it CAD for programmers). It may be that I like it just because I think that it is an interesting thought exercise, but what I have ended up with are functional parts, so I can’t say that it is a trivial thought exercise. I guess I’ll just keep doing what I’m doing!


One thought on “Scripting an Object Into Life with OpenScad

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s