OpenSCAD is freely available open source software that enables nondesigners to easily create 3D designs using a text-based programming language. Itâ??s a great language for beginners because the instant 3D visualization gives you immediate feedback on the results of your code. This book channels OpenSCADâ??s visual benefits and user-friendliness into a STEAM-focused, project-based tutorial that teaches the basics of coding, 3D printing, and computational thinking while you develop your spatial reasoning by creating 3D designs with OpenSCAD.

Presuming no prior experience with either programming or 3D design, each chapter builds a scaffolded understanding of core concepts. Youâ??ll start by defining, drawing and displaying geometric primitives with text-based code, then expand your creative toolbox with transformation operations â?? like rotating, reflecting, scaling, and combining shapes.

As the projects become more sophisticated, so will your programming skills; youâ??ll use loops for replicating objects, if statements for differentiating your designs, and parameterized, self-contained modules to divide longer scripts into separate files. Along the way, you'll learn 3D printing tips so that you can produce physical mementos of your progress and get physical feedback that lets you correct mistakes in real time. In addition, the book provides hands-on and accessible design exercises at the end of each chapter so that you can practice applying new concepts immediately after they are introduced.

Youâ??ll learn:

â?¢Programming basics like working with variables, loops, conditional statements, and parameterized modules

â?¢Transformation operations, such as rotate, reflect, and scale, to create complex shapes

â?¢Extrusion techniques for turning 2D shapes into elaborate 3D designs

â?¢Computational-thinking concepts, including decomposition, abstraction, and pattern recognition

â?¢OpenSCADâ??s Boolean, Minkowski and hull operations for combining multiple 3D shapes into one

â?¢3D design fundamentals, like navigating the xyz-axis, orthogonal vs. perspective views, and constructive solid geometry

â?¢Organizing bigger designs into separate files to make code more readable and collaborative

Accessibly written for a wide audience (advanced middle schoolers, high school students, college students, artists, makers and lifelong-learners alike), this is the perfect guide to becoming proficient at programming in general and 3D modeling in particular.

Table of Contents

  1. Title Page
  2. Copyright
  3. About the Authors
  4. Acknowledgments
  5. Introduction
    1. What Is OpenSCAD?
    2. Who This Book Is For
    3. Why Learn to Code with OpenSCAD?
    4. 3D Printing and OpenSCAD
    5. What’s in This Book
    6. Terminology and Conventions Used in This Book
    7. A Brief Introduction to 3D Design with OpenSCAD
    8. Understanding 3D Points
    9. Using the OpenSCAD 3D-View Toolbar
    10. Final Tips for Getting the Most Out of This Book
  6. Chapter 1: 3D Drawing with OpenSCAD
    1. Why Use OpenSCAD?
    2. Getting Started with OpenSCAD
    3. Drawing Basic 3D Shapes
    4. Drawing Cuboids with cube
    5. Drawing Spheres with sphere
    6. Drawing Cylinders and Cones with cylinder
    7. Importing 3D Models with import
    8. Modifying Basic Shapes
    9. Moving Shapes
    10. Smoothing Curves with $fn
    11. Combining 3D Shapes with Boolean Operations
    12. Subtracting Shapes with difference
    13. Carving Out Overlapping Shapes with intersection
    14. Grouping Shapes with union
    15. Getting Ready for 3D Printing
    16. Summary
    17. Design Time: 3D Shapes
    18. Big Projects: 3D Shapes
  7. Chapter 2: More Ways to Transform Shapes
    1. OpenSCAD Shape Transformations
    2. Rotating Shapes with rotate
    3. Reflecting Shapes with mirror
    4. Scaling Shapes with resize
    5. More Ways to Combine 3D Shapes
    6. Combining Shapes with hull
    7. Combining Shapes with minkowski
    8. Combining Transformations
    9. Summary
    10. Design Time: Transforming Shapes
    11. Big Projects: Transforming Shapes
  8. Chapter 3: 2D Shapes
    1. Drawing Basic 2D Shapes
    2. Drawing Circles with circle
    3. Drawing Rectangles with square
    4. Drawing Polygons with polygon
    5. Drawing Words with text
    6. Applying Transformation and Boolean Operations on 2D Shapes
    7. Extruding Shapes Vertically with linear_extrude
    8. Extruding Shapes Along a Circle with rotate_extrude
    9. Growing and Shrinking a Shape with offset
    10. Importing 2D Shapes with import
    11. Summary
    12. Design Time: 2D Shapes
    13. Big Projects: 2D Shapes
  9. Chapter 4: Using Loops and Variables
    1. Leaving Notes with Comments
    2. Writing Single-Line Comments with //
    3. Writing Multiline Comments with /* */
    4. Repeating Code with a for Loop
    5. Debugging for Loops with echo
    6. Using Variables and Arithmetic
    7. Naming Variables
    8. Applying Mathematical Operations on Variables
    9. Using Math and Variables Inside for Loops
    10. Using Arithmetic to Create Unique Patterns
    11. Using Nested Loops to Draw 2D and 3D Grids
    12. Generating the Windows in a Skyscraper with Nested Loops
    13. Triple Nesting to Create a 3D Grid of Shapes
    14. Summary
    15. Design Time: Loops and Variables
    16. Big Projects: Loops
  10. Chapter 5: Modules
    1. Simplifying Code with Modules
    2. Splitting Your Design into Multiple Files
    3. Adding Parameters to Your Modules
    4. Building a LEGO Brick
    5. Sharing and Collaborating
    6. Summary
    7. Design Time: Modules
    8. Big Projects: Modules
  11. Chapter 6: Dynamic Designs with if Statements
    1. Using if Statements
    2. Defining Complex Conditions
    3. Choosing Boolean Operators
    4. Using Logical Operators to Combine Boolean Expressions
    5. Following an Expanded Order of Operations
    6. Making Two-Way Choices with if…else Statements
    7. Using Extended if Statements
    8. Using Nested if Statements
    9. Useful Applications of if Statements
    10. Setting Up a Design Mode and Print Mode
    11. Using Random Numbers as a Design Element
    12. Summary
    13. Design Time: if Statements
    14. Big Projects: Decisions
  12. Chapter 7: Designing Big Projects
    1. The Design Cycle
    2. Leaning Tower of Pisa Model
    3. Step 1: Investigate—Define Multiple Views
    4. Step 2: Plan—Apply Computational Thinking
    5. Step 3: Create—Use a Walking Skeleton Approach
    6. Step 4: Evaluate—Decide Which Design Process Steps to Repeat
    7. Walking Skeleton: Building the Leaning Tower of Pisa
    8. Iteration 1: Connecting the Tower’s Basic Building Blocks
    9. Iteration 2: Finding Repetition in the Middle Section
    10. Iteration 3: Adding More Details to the Middle Section
    11. Iteration 4: Adding Details to the Top Section
    12. Iteration 5: Adding Details to the Bottom Section
    13. Final Evaluation of the Design Cycle
    14. Design Organization Overview
    15. Summary
  13. Afterword
    1. Learn More About OpenSCAD
    2. The Open Source Ethos
    3. Motivation and Ecosystem
    4. Online Citizenship
    5. OpenSCAD and the Maker Movement
    6. Making and Creative Problem-Solving
    7. 2D Fabrication
    8. Physical Computing
    9. Makerspaces
    10. Final Ideas for More Practice
    11. Customizable Measuring Spoons
    12. Customizable Vacuum Tool
    13. Customizable Flowerpots
    14. Drawer Box
    15. Lab Clamps
    16. Chess Set
    17. Pegboard Wizard
  14. Appendix A: OpenSCAD Language Reference
    1. Syntax
    2. Operators
    3. 2D Shapes
    4. 3D Shapes
    5. Boolean Operations
    6. Shape Transformations
    7. Loops, Decisions, and List Comprehensions
    8. Other Shape Operations
    9. Modifier Characters
    10. Special Variables
    11. Mathematical Functions
    12. Other Functions
  15. Appendix B: OpenSCAD Visual Reference
    1. 3D Primitives
    2. 2D Shapes
    3. Combining Shapes
    4. Transformations
    5. Loops
  16. Index