Openscad Cheat Sheet



  1. Openscad Examples
  2. Openscad Commands

I've loved and used this cheat sheet for a few years, but it has not been available for weeks. Is there a replacement. Home; Downloads. Mac; Windows; Linux; BSD; Other Systems; Source Code; Learn.

Openscad tutorial

This is a tutorial on how to use OpenSCAD to design a 3D object via code instead of using a WYSIWYG editor like Tinkercad, Fusion360, etc. We are currently creating a customized media player to allow people to interact with MP3 artifacts. We’ve been working in Python to prepare the audio and wanted to generate the enclosure programmatically as well, ideally using open source software. OpenSCAD is a great open source solution for CAD and 3D printing projects.

Modules

Openscad Cheat Sheet

In OpenSCAD, you can quickly build duplicates of small parts into more complex designs using “modules”. By assigning variables to parameters, you can vary the size and location of these objects easily. Modules also help break a larger job into more manageable parts and keep the code nice and clean. The four modules below construct the main body of the enclosure, arrange the holes in the enclosure for our electronic components, add a texture to the enclosure, and assemble all the pieces together. After calling those four modules, all that is left to do is split the enclosure in two and render the halves as separate STL files for printing.

Main Enclosure Body

Making Holes for Electronics Components

Cheat

The second module creates all of the holes that we will place in the enclosure for our electronics components.

Adding a surface texture

The next module creates a texture on the surface of our enclosure from an image file. We wanted to use an image of JPEG artifacts for our project, but you could use anything you’d like, or skip this step entirely. Be sure to keep your PNG files very simple here, otherwise you will run into problems when trying to render. When our PNG file was 31kb it took many hours to render and resulted in a huge STL file that was impossible to print. We needed to get our PNG down to 6kb to make it render in a reasonable amount of time. This resulted in a 5mb STL file. Still kind of big, but reasonable. Below, we call the translate() function so that it sits right on the surface of our enclosure.

Bringing it all together

The final module assembles the previous three modules together.

Rendering and Printing

Now all we have to do is render using concat() and save as an STL!

That’s all there is to it! With the two halves rendered, all you have to do is save them as STL Files and then use your favorite 3D printing prep software to print.

If you’d like to learn more about OpenSCAD, here is a link to a great cheat sheet.

OpenSCAD is a free and easy programming language for expressing ideas for 3D printing.

Mac

System requirements: Mac OS X 10.9 or newer

OpenSCAD is also available on MacPorts:

Development Snapshots

Development snapshots are built irregularly. If you want access to a more recent development snapshot, please contact the mailing list.

Windows

System requirements: Windows XP or newer on x86 32/64 bit

Development Snapshots

Development snapshots are built irregularly. If you want access to a more recent development snapshot, please contact the mailing list.

Linux

Debian / Ubuntu / Kubuntu

OpenSCAD is available in the repositories of recent distributions.

For Ubuntu users:

To update to the latest release add the following PPA before installing OpenSCAD:

Install with

Fedora

OpenSCAD is available in Fedora official repositories. To install, run the following command:

If you want the MCAD library:

Please note that you'll find OpenSCAD 2014.03 in Fedora 21 and lower. In case you'd like to use 2015.03 in Fedora 21, you can use a Copr repo with it.

openSUSE

OpenSCAD is available from software.opensuse.org

Other Linux

The following generic binary Linux packages are available:

Development Snapshots

Linux - AppImage

Please try the automatically built snapshots first if you are running a supported distribution (see below), the following AppImage builds are still experimental.

Linux - Snap

Snap packages are available, as those are built against an older Ubuntu (16.04) those are using some older components which can cause known display issues, so if possible use one of the specific distribution packages below.

Linux - Distribution Packages

The packages are automatically built based on the master branch on github.

Note: The packages are called 'openscad-nightly' so it's possible to install the development snapshot packages in parallel to the release version from the official repositories.

Debian / Ubuntu packages built on OpenSUSE build service

To install the packages, the release key must be added with apt-key to the key-ring to allow apt-get / aptitude to validate the packages.

Key ID: 75F3214F30EB8E08 (valid till 2021-04-18)
Key UID: home:t-paul OBS Project

NOTE: If you get errors about an expired key valid till 2019-02-07, please re-import via the following command.

After the key is added, the repository URL needs to be configured. This can be done by creating a new file /etc/apt/sources.list.d/openscad.list with the URL specific to the distribution.

The repository links below are shown as https, please check for your installation if https is supported. In Debian/Ubuntu this is usually handled by the apt-transport-https package. OBS also supports HTTP links, but it's recommended to use https whenever possible.

Debian 9 (Stretch)
Debian 10 (Buster)
Debian Testing
Openscad cheat sheet
Debian Unstable
Ubuntu 16.04
Ubuntu 17.10
Ubuntu 18.04
Ubuntu 18.10
Openscad
Ubuntu 19.04

Openscad Examples

Ubuntu 19.10
Ubuntu 20.04
openSUSE packages built on OpenSUSE build service
openSUSE Leap 15.0 (64-bit only)
openSUSE Leap 15.1 (64-bit only)
openSUSE Tumbleweed
Fedora packages built on OpenSUSE build service
Fedora 27 (64-bit only)
Fedora 28 (64-bit only)
Fedora 29 (x86_64, i586, armv7l, aarch64, ppc64le)
Fedora 30 (x86_64, i586, armv7l, aarch64, ppc64le)
Fedora 31 (x86_64, armv7l, aarch64, ppc64le)
Fedora Rawhide
Arch Linux

To install OpenSCAD from git on Arch Linux the openscad-git pkgbuild is available on AUR.

BSD

FreeBSD (>=10)
OpenBSD

Openscad Commands

OpenSCAD is available for amd64, i386 and macppc in OpenBSD packages:

Other Systems

It's possible to build OpenSCAD on other systems as long as a C++ compiler and the prerequisite software libraries are available.

Source Code

You can also access the latest source code on GitHub: