3D Printing Tutorial – Introduction (EN)

o\O/o

C2 – Computer-Aided Design

In this chapter, we’ll start by explaining what is a 3D object, and then we’ll figure out how to draw a 3D object. At the end of the chapter, you’ll be able to test what you have learned with a small quiz.

i. 2D vs 3D

Figure 1. Worm-Belly Ninja with approximately (more or less) 12 cm (cm means centimeter) wide and 22 cm tall.

When we print on a sheet of paper we are printing in two dimensions – 2D – we have a width and a height – the two dimensions of the paper.

For example, on Figure 1 you can see the drawing of the “Worm-Belly Ninja”. It is approximately 12 cm wide and 22 cm tall, having only these two dimensions. In this drawing we don’t know whether the belly is very bulging or not. To obtain that information we would need another measurement – the thickness or depth of the belly.

So let’s think about it a bit… We’ll draw our Worm-Belly Ninja on the paper from the side to clearly see what the worm’s belly looks like – Figure 2. What do you think? From the side its height is 22 cm, as already known, and its width is 8 cm. And now a question for you – how many dimensions does this drawing have? Is it a 2D drawing?

Figure 2. Worm-Belly Ninja with approximately 8 cm wide and 22 cm tall.

Good! The drawing in Figure 2, is a 2D drawing – it only has two dimensions, like the one in Figure 1.

Is everything clear so far? Do you have any questions? You can leave us a message, or ask your parents, or you teacher.

Now let’s move on to the next step. Ready? Can we draw, on paper, the Worm-Belly Ninja from a position where we can see all its three dimensions? In reality we can’t. What we can do is to create a representation that looks 3D, but on paper it will always be 2D. Try this test: can you rotate the drawing and see the other side of the Ninja? No, right? You can only see the Ninja’s representation on the sheet of paper – we can say that it’s a 2D drawing of a 3D object. Architects and engineers know some drawing tricks to make it appear 3D, but it isn’t really.

To have a true 3D representation we need to be able to view it from any angle, rotate it, and see all three dimensions. You probably have never created a digital 3D drawing, but you have certainly made 3D representations (or models) of dolls, cars, or other things you invented. Can you think of an example? I bet you hadn’t considered this… What example did you think of? Play dough? Good! And clay? Exactly, that’s another way to create 3D models of objects. These aren’t digital models, but modeling with clay or play dough are excellent examples of creating 3D representations of objects.

Since we want to print something with a 3D printer, we can’t just tell the printer “Look at that piece of play dough!” Instead, we need to make a digital 3D model that we’ll then send to the printer. How do we do that? Yes, using a computer and a program running on that computer. There are many such programs, a family of programs we call Computer–Aided Design (CAD). Generally, CAD refers to the software (or a file generated by that software) that lets you create precise digital models of objects (2D or 3D).

There are many advantages to designing with a computer. One main advantage is that we can define the dimensions, the measurements, of the object with precision. This means we can specify the exact size of any part of the object. Other important benefits are: being able to plan, visualize, and easily modify the part before building it, and to share it.

Computer-aided design is something professionals such as architects, engineers, designers, and artists do every day – it’s part of their job. They can design houses, furniture, toys, video game environments, trains, or even rockets. But in fact anyone can learn how to do it… you can too! Want to try? There are several programs that let you create CAD drawings. Here we’ll use the opensource program – OpenSCAD.

ii. OpenSCAD

Why using OpenSCAD? 

OpenSCAD is a free and user-friendly software. 

It allows to introduce the idea of describing geometric shapes with words by using simple commands, while still letting you describe them precisely. Each figure that is drawn can be saved and reused later, and even combined with other figures.

On the program’s website there is plenty of information, documentation, and examples. You can try the program before installing it locally on your computer. Open the OpenSCAD page and then click About at the top; then scroll to the bottom of the page and you’ll find a list of Related Projects. There you’ll discover some projects inspired by OpenSCAD that let you experiment with it without installing anything.

So let’s get started. Below is a general overview of how the program works.

We can think of constructions with LEGO pieces. When we build a house or a boat with LEGO bricks, we snap the pieces together. These can be cubes, wheels, or pieces of various shapes. With OpenSCAD we use the same strategy: we use shapes that the program already knows and combine them to create whatever we want.

The basic shapes that the program knows are: cube, sphere, and cylinder. Since this is a computer program, these shapes are specified with specific words or expressions known by the software; otherwise the program won’t understand what we mean. These words are:

  • cube(…) – for a cube;
  • sphere(…) – for a sphere;
  • cylinder(…) – for a cylinder.

These are the elementary shapes of the program. They are the building blocks we’ll use to create a digital object.

In addition to knowing the shapes, we need to know what to do with them. When we build a LEGO boat we attach pieces in various ways: some on top, some underneath, some inside… To tell the computer how we want to use the shapes we use operations. We’ll stick to the simple operations: union, intersection, and difference. Just like the shapes above, in OpenSCAD we must specify these operations with their own keywords so the program can understand. These keywords are:

  • union (…) – for union;
  • intersection (…) – for intersection;
  • difference (…) – for difference.

Did you notice that the program’s keywords are in English? Easy right? For now, don’t worry about the (…) placeholders. Soon, you’ll understand these better.

Nothing was yet mentioned about the meaning of these operations. However, first we want to invite you to explore the idea behind these three operations: union, intersection and difference. Next, you can play with 2D forms and operations:

 

 

 

Did you get the idea? Yes, it’s true that it was only 2D. Well observed!

  • Union – combine the pieces into a single one. Note that even when they’re separated they become a single object.
    Use the expression/command union ( … ) in OpenSCAD;
  • Intersection – keeps only the part where both shapes overlap. Note that if they don’t overlap the result is… empty… nothing.
    Use the expression/command intersection ( … ) in OpenSCAD;
  • Difference – subtract one part from the other. Note that if there is no overlap, the first shape remains unchanged.
    Use the expression/command difference ( … ) in OpenSCAD;

Now let’s try a 3D example that you can copy and run in OpenSCAD:

// A small brick: length=20 mm, with=10 mm, thickness=5 mm.
// cube ( [20, 10, 5] );  

// *****************************************************
// Draw a hole in the middle of the brick:

// Operation difference - Subtract to the 1st shape (cube) to the 2nd (cylinder)
difference() { 
    cube ( [20, 10, 5] ); // the brick - 1st shape 
 
    // Operation translation - moves what is described next to it, in the direction fo the defined vector.
    // In this case, we move a cylinder, radius 2 mm and height 6 mm, in the direction of vector [10, 5, 2.5].
    // This is the direction of the brick's center. This way the cylinder will go through the brick. 
    #translate ( [10, 5, 2.5] )  cylinder ( h=6, r=2, $fs=0.6 ); 
}

Running this in OpenSCAD you’ll see a small rectangular block – a brick – with a round hole. After copying the code into the program’s editor, press F5 so it knows it can now display the object. You can play with the numbers to get an idea of what they represent. Each time you modify a value, press F5 again to see the result. Happy experimenting!

One note: the red cylinder is not part of the final object, which is why it has a different color; it’s shown only so you know it represents the 3D shape that was removed from the brick, to create the hole.

So far all of this may seem very simple… how will we design dolls, cars, and other things?! For now, it’s important to play around with the program, try out the operations, and combine multiple shapes. Sometimes you’ll notice you misspelled a word, and the program will “spit out” an error… Understanding how this works will make you a master, but you need to tinker a bit more!

Later we’ll return to OpenSCAD, and at that point we’ll dive deeper into CAD modeling. We’ll also learn how can we tell the printer what we want to print. 🙂

In summary:

  • A drawing on paper has only two dimensions – 2D.
  • CAD stands for Computer-Aided Design.
  • CAD programs let you use a computer to create a digital 3D representation of an object.
  • OpenSCAD is a CAD program.
  • We make OpenSCAD drawings using shapes and operations on those shapes.
  • To make a 3D model (with OpenSCAD) we must use the program’s specific keywords.
  • The best part is that we can share, modify, and save our work for later reuse!

 

* * * Want to test what you’ve learned about CAD? * * *
* * Solve a small quiz.Here!* * *

To explore:

 

Ready for the next chapter? Do you have any doubts or questions to ask? Great!
Leave us a message here.

Don’t forget… HAVE FUN!