3D Printing

Laurent software Tutorials and 3D models
Tutorials

Modelize your first 3D shape with openSCAD #3

3. Combining objects

Create simple shapes is cool but we want to create more complexes objects by combining multiple shapes to render exactly what we want.

 

a. Union

First of all let’s do combination with using union():

$fn = 100;

union(){

    cube(10);

    cylinder(10,10,10);

}

 

b. Difference

You will tell me what’s the point by doing a union of shapes? When you do difference, union becomes essential very fast.

difference() will allowed you to suppress a part of a shape with an other shape, example:

difference(){   

    translate([0,0,-1]) cylinder(20,5,5);

    cube(10);

}

Here we used a cylinder and removed matter from it with the angle of a cube. When you do a difference it’s always the first object who is display and the second one who is removed.

Tip: sometimes the object became very complicated and we don’t see clearly the objects it’s why you can use the # at the beginning of the line to visualize the removed object.

 

difference(){   

    translate([0,0,-1]) cylinder(20,5,5);

    #cube(10);

}

 

It’s why union is very useful because you can do a difference on a more complexes object, example:

$fn = 100;

difference(){

    union(){

        cube(10);

        cylinder(10,10,10);

    }

    translate([0,0,-1]) cylinder(20,5,5);

}

 

c. Hull

A last functionality to combine shapes that can be very useful is hull(). With hull you can combine 2 shapes with a link, example:

$fn=100;

hull() {

   cube([20,20,1],center=true);

   translate([0,0,20]) cylinder(1,8,8);

}

 

d. Exercise 3

Try to reproduce this shape (correction)

 

Leave a Reply

Your email address will not be published. Required fields are marked *