OpenSCAD: Solid 3D Modeller For Programmers

Priya Ravindran is M.Sc (electronics) from VIT University, Vellore, Tamil Nadu. She loves to explore new avenues and is passionate about writing

0
2278

Three-dimensional (3D) modelling has been in vogue for decades. The first thing you would imagine on hearing the term is a piece of complicated graphics on the screen—something you can move around and view from different angles. The mind creates small videos of choosing one extra component and moving it into that small hole you can see on the screen, moving around the rest to make space for this or deleting that extra length from rectangular section R2; in essence, a powerful graphical user interface (GUI).

A look at OpenSCAD

OpenSCAD is one such tool for 3D modelling, but this is where the similarities end. Although you still get to physically see things on the screen, you do not move these around. Instead, you code. You code to create something new, edit the code to make changes in what you see and delete lines of the code to remove something. You have direct access to your very own backend library—the script you write.

OpenSCAD software lets you create solid 3D computer-aided design (CAD) objects. Taking help from OpenCSG library and Computational Geometry Algorithm Library (CGAL), the tool creates beautiful geometry and graphics on the screen. This text based tool is what we try to explain in this article.

A fully parametric 3D printer designed using OpenSCAD by Sara Rodriguez
Fig. 1: A fully parametric 3D printer designed using OpenSCAD by Sara Rodriguez

What OpenSCAD is not

Before you begin with the tool’s specialities, let us clear out general misconceptions.

Not for the artist in you.

OpenSCAD is a 3D modelling tool that focuses on CAD aspects of designing. So this is not your typical tool for, say, creating a computer animation. But if it is a machine part you want to model, or maybe an exploded view of a heart, this is your go-to tool.

Not an interactive modeller.

Unlike the usual case where you have a window on which you draw the object, OpenSCAD works like a 3D compiler. Whatever you want to model has to be scripted into a file. The tool reads the file and renders the 3D model.

What OpenSCAD offers

Does describing your model in textual form limit your design in the way you make it or view it? Decide for yourself! Let us take a step back and figure out what all features OpenSCAD offers to you.

Flexibility.

As you write a script for every aspect of your model, you have complete control in your hands. Consequently, making any change during any step of modelling or designing something with configurable parameters is not difficult.

Customisability.

The way you introduce customisability into your design is by parametrising it using parameters or top-level variables. There was even a project under Google Summer of Code programme in 2016, which aimed at offering an auto-generated GUI associated with a customisable design, making it easier to both create and use such designs, and an authoritative standard for how to specify meta-data to guide the generation of such a GUI.

Details for the above can be found at website

A variety of model views.

Thorough analysis of a model is very important to arrive at needed precision and accuracy in replicating any 3D structure. To help you achieve this level of perfection, OpenSCAD allows you to view every model in different ways or views.

The initial model view that crops up is CGAL surface view, indicating surface-level representation. It then proceeds to CGAL grid view for complex 3D models. The scaffolds beneath can be seen as a wireframe, creating an effect like the view of Eiffel Tower. If you need a high screen frame rate, this relatively-simple and fast-rendering view should be your choice. You could also have OpenCSG view, or put all of these in one frame for a thrown-together view that gives you as wholesome a look at your design as possible.

Creating animations.

An animate option lets you create something similar to GIF files that keep circulating online. Specify the number of steps and frames per second, and you can observe the animation as the program re-evaluates the code as time progresses.

Use with your favourite editor.

Be it Emacs, Notepad++, VIM or Visual Studio Coke, minimise OpenSCAD editor, open your own, save after changing the file. OpenSCAD automatically updates its database, letting you smoothly mix and match tools to find the combination that works for you. You can also extend this to work with multiple screens—one for 3D view and another for the code, side by side.

OpenSCAD customiser
Fig. 2: OpenSCAD customiser

How to work with OpenSCAD

It is clear that this software is different and has some useful tricks up its sleeve. It might seem a little complicated to use at first, but once you know your way around, you will surely enjoy the experience.

LEAVE A REPLY

Please enter your comment!
Please enter your name here