Loading

OpenSCAD

Difficulty: Intermediate  Type: Design with code
Platforms: Mac, Windows, Linux, Web  Cost: Free

Go to OpenSCAD

Write simple code to generate 3D printable designs that can include geometric objects, text, and modifiable dimensions.

OpenSCAD is great at making parametric designs — models represented by numbers that can be easily adjusted to change the size, shape, or any other aspect of a design. If you want to make models with precise measurements, specific tolerances, moving parts, or enclosed hinges, or ones that use mathematical or procedural information, then OpenSCAD is one of your best free design options. 

That may sound complicated, but in fact OpenSCAD is easy to learn even if you’ve never written code before, you can learn how to use OpenSCAD fairly quickly, and there are a lot of resources and examples online. OpenSCAD is a great choice if you’ve already used Tinkercad or Sculptris and you’re looking to level up your design skills or if you’re interested in learning how to write basic code.

With OpenSCAD, you can define variables in your design that are modifiable at any point of the design process, as well as sets of variables that depend on other variables. For example, you could use OpenSCAD to design a hinged box where the length of each of the hinges depended on the length of the lid, and define a parameter so that you could easily modify the clearance inside each of the hinges just by changing one number in your code. OpenSCAD also has the ability to handle loops, conditional statements, mathematical equation and calculations, and other algorithmic information that allow you to easily make complex designs.

Every model that OpenSCAD exports will be a high quality, solid, watertight STL file that can be understood by 3D printer software like MakerBot Desktop or other model slicers. Unlike programs like Sculptris, OpenSCAD was written specifically to create 3D printable models, and therefore it never exports bad or broken geometry. Of course, it’s still possible create designs that are difficult for your 3D printer to print, but with OpenSCAD that won’t be the fault of an error in your STL file.

On top of all that, OpenSCAD powers every model in the Thingiverse Customizer. By just adding a few comments to your OpenSCAD code, you can convert your parametric 3D designs into customizable models that people can modify with sliders, dropdown menus, and text input. For example, you could design a name tag that allows Thingiverse users to type in their own name, or a phone case that a user could size to fit their make and model of phone without the user having to interact with OpenSCAD code. Being able to create 3D models in OpenSCAD opens up a whole new world of interactive design possibilities.

Jumpstart

Get started right away: Download OpenSCAD and then use the sphere(r=radius); and translate([x,y,z]); commands to make a simple snowman.

ThingsThings Designed with OpenSCAD

Thingiverse OpenSCAD Customizers by mathgrrl Aug 15, 2015

Thingiverse Customizers

These are some of the best Customizers on Thingiverse. Customizer models on Thingiverse are generated from OpenSCAD code. Use the Customizers to create your own custom versions of each model, or click View Source to view the OpenSCAD code.

OpenSCAD Designs by mathgrrl Aug 15, 2015

OpenSCAD Designs

These Thingiverse designs were created with OpenSCAD and include downloadable code, modules, or libraries that you can modify yourself in OpenSCAD. Use the code from these models to learn how to create your own parametric designs with OpenSCAD.

OpenSCAD Resources by mathgrrl Aug 15, 2015

OpenSCAD Resources

Image converters, color tools, height maps, rulers, text editors, and other technical OpenSCAD resources. Many of these aren’t models to 3D print; instead they are code files and tools that help you get advanced functionality out of OpenSCAD.

ThingsGetting Started with OpenSCAD

To get started with OpenSCAD, download the most recent version and open the program. You’ll see a text Editor on the left side of the screen and a yellow Preview window on the right, with a Console log below for reporting compile and error messages. (You can also use OpenSCAD online, in your browser, but you’ll have somewhat limited functionality; we recommend downloading the free OpenSCAD software and working locally on your computer.) “OpenSCAD” is pronounced “open-ess-cad”, but lots of people choose to say “open-scad” instead; you’ll hear both in common usage.


Type, preview, export

In OpenSCAD, designs are created with code. Here’s a simple example: Type sphere(20); into the Editor (don’t forget the semicolon), and press “F5” (or “function-F5” on some laptops). You should see a sphere appear in the Preview window. If you wanted to export this sphere for 3D printing, you could now press “F6” to render the geometry of your object, and then use File > Export > Export as STL to generate an STL file for 3D printing. This is how OpenSCAD works in general: first type code into the Editor, then press “F5” to see a Preview of what you’ve made, and when you are finished with your design press “F6” to render the geometry and then “Export” to obtain an STL for 3D printing.


Documentation

OpenSCAD has excellent online documentation where you can learn about commands, options, and syntax. Check out the resources below.

OpenSCAD Docs


Basic Commands

transform

To make simple designs in OpenSCAD, you only need to know a few commands. Here are links to documentation about the most basic of those commands.

  • Geometric shapes: Cubes, spheres, and cylinders are the basic building blocks in OpenSCAD. Cubes and cylinders are actually more general than they sound; you can make any kind of rectangular box with the cube() command by defining different values for length, width, and height, and you can make cones with the cylinder() command by defining the top radius and the bottom radius separately. You can also make 2D shapes like circle() and square(), although any 2D shapes will have to be thickened before you can 3D print them.
  • Transformations: You can determine the placement of objects in 3D space by using the translation() modifier, and rotate objects by using the rotate() command. You can also change an object’s size in any dimension with scale(), or make reflected versions of objects with mirror().
  • Boolean operations: You can make a hole in an object by using the difference() command; this command works by drawing an object and then removing from that object the space taken up by any subsequent objects that you list. For example, you could make a cube with a cylindrical hole through the center, or a cylinder with a series of half-sphere potholes in it. You can also group objects together with union or obtain the region where two or more objects intersect with intersection().
  • Extrusions: You can make more complex shapes in OpenSCAD by starting with a 2D shape and then extruding that shape through some distance, possibly while twisting or scaling, using the command linear_extrude(). For even more interesting options, try extruding around an axis with the rotate_extrude() command.
  • Text: An exciting update to OpenSCAD in early 2015 included built-in options for creating text, using the fonts in your own computer’s Font Library. Use the text() command to include text in your designs for labels, nametags, or personalization. The text command works particularly well with difference() to get embossed or stencil effects, or with union() to obtain a raised effect.
  • Resolution: The $fn modifier determines the number of facets used in circles, spheres, and cylinders. In other words, $fn controls the resolution of your design. Use low values of $fn for fast-compiling draft versions or an angular low-poly look, or raise $fn to large values for smoother, final models. You can set $fn globally for your entire design, or insert it into individual circle, sphere, or cylinder commands to set resolution locally.

Beginner Tutorial Playlists

Patrick Conner has an excellent series of OpenSCAD tutorial videos on YouTube. He goes over the basics slowly and clearly, and offers great tips for organizing your code. Even if you're an absolute beginner to computer code, these videos can help you get started with OpenSCAD quickly and easily. Once you watch those, check out David Dobervich’s series of three OpenSCAD tutorial videos on YouTube, for another introduction to basic shapes, transformations, and modules.



Beginner OpenSCAD Tutorials and Projects

For more introductory resources, including tutorials and 3D modeling walkthroughs for OpenSCAD, try the links below.

ThingsGoing Further

Preparing OpenSCAD Designs for Thingiverse Customizer

Thingiverse Customizer is an app on Thingiverse that allows designers to add user-friendly sliders and controls to their OpenSCAD designs. Customizable Things make up a large portion of the popular content on Thingiverse, because users can personalize and modify Customizable things to fit their needs before 3D printing.

Customizer
  • How does OpenSCAD code become a Customizer design? It’s very easy to set up your OpenSCAD design for the Thingiverse Customizer by adding some comments to your code. When an OpenSCAD file is opened in the Customizer, global variable assignments are automatically turned into user modifiable fields. Comments that precede the variables are printed as remarks in the Customizer, and comments after the variables can create drop-down selectors or sliders with upper and lower bounds. You can also make parameter tabs, import images, and more.
  • How do I upload an OpenSCAD file to the Customizer? To create a Customizable design on Thingiverse, start as you normally would by selecting Upload a Thing! from the Create menu. In addition to the usual things you would do to create a Thing (uploading STL files and Gallery images, creating title and description, etc), you have to do two additional things. First, drag or upload your SCAD file into the Thing. Second, add the tag “customizer” to your Thing. After you Save or Publish your Thing, an Open in Customizer button will automatically appear above the Download This Thing! button. Thingiverse users can still download your demo STL files for immediate 3D printing, or they can open your design in the Customizer to change parameters before downloading.
  • Examples: Every Customizable design on Thingiverse runs on commented OpenSCAD code. To see the code, click on Open in Customizer from the Thing page, and then select View Source. Alternately, you can download the SCAD file itself from the Thing Files for that model. For example, atartanian’s Customizable Easy Gyro model is a simple model with nicely commented OpenSCAD source code to start learning from.
  • Documentation: For more in-depth information, see the Customizer Developer Documentation and Best Practices Document. One especially useful feature of the Developer Documentation is the Preview Example; you can paste OpenSCAD code in the left panel, and preview how the Customizer will present that code on the right.

Intermediate and Advanced Commands

OpenSCAD is easy to learn and can produce nice models with nothing but simple code, but it also has a lot of design power under the hood. When you’re ready to move beyond basic transformations of basic and extruded forms, try exploring the commands below.

  • Polygons and polyhedra: Create your own 2D shapes edge by edge with the polygon() command, or construct 3D forms face by face with polyhedron(). In each of these commands, you define the vertices of your object and then list the paths or triangular faces that should connect those vertices.
  • Next-level forms: Create insets, offsets, and chamfers of 2D shapes using the offset command, or obtain the convex hull of a collection of objects with hull. If you’re feeling adventurous and don’t mind the slowdown from calculations, try creating “sums” of objects using the minkowski command.
  • Next-level code: When you’re ready to explore more programming possibilities in OpenSCAD, create iterative designs with for loops, conditional commands with if/else statements, and conditional variable assignments with ternary operators. You can also include mathematical functions and recursive calculations into your code with functions, or collect your code into reusable procedures called modules.
  • Importing files: Bring a 2D DXF image or a 3D STL model into OpenSCAD using the import command. You can also use surface on an imported DAT text file to create height maps.

Intermediate and Advanced OpenSCAD resources

Top