Book Image

Simplifying 3D Printing with OpenSCAD

By : Colin Dow
5 (1)
Book Image

Simplifying 3D Printing with OpenSCAD

5 (1)
By: Colin Dow

Overview of this book

Want to bring your 3D designs to life with OpenSCAD, but don’t know where to start? Simplifying 3D Printing with OpenSCAD will teach you the key skills so that you can focus on your ideas, not troubleshooting your 3D printer. With the help of this book, you’ll build a solid foundation in 3D printing technology, the software used for designing your objects, and an analysis of the G-code produced by the 3D printer slicer software. You’ll also get to know your 3D printer and find out how to set up a printing job effortlessly — from configuring the parameters to build well-defined designs. Consider yourself a practical learner? Use real-world examples such as designing and printing a 3D name badge, model rocket, and laptop stand, to dive into the world of 3D printers build your skillset. By the end of this 3D printing book, you'll be ready to start designing and printing your own 3D printed products using OpenSCAD and being your ideas into reality.
Table of Contents (16 chapters)
1
Part 1: Exploring 3D Printing
5
Part 2: Learning OpenSCAD
9
Part 3: Projects
13
Part 4: The Future

Simplifying our code with modules

As we've seen, OpenSCAD code can start to become quite complex. This not only makes it more difficult to maintain but makes our coding prone to errors. An elegant way to deal with this is to break our code into modules. Although we can put any code we want into a module, it is best practice to keep a module limited to a single function. For example, a good way to break up the Thumbs Up award would be by using code to create the base, code to create the Thumbs Up symbol, and code to create the plaque.

The syntax to create a module in OpenSCAD is the word module, followed by opening and closing parenthesis and open and closing curly braces:

module name_of_module(parameters)
{
     body_of_module
}

As we can see, modules are similar in their syntax to the difference, union, and intersection operations. It is a good idea to name the modules with verbs since they perform actions.

We will start exploring modules...