2. Computer-aided design (CAD)#

The purpose of this unit is to familiarize ourselves with the different CAD software tools, and to choose the one best-fitting to our needs. We have been introduced to Inkscape, OpenSCAD and FreeCAD. We will then have to design a lego piece comprising a complying mechanism on one of these CAD tools. We will 3D-print this piece next week.

2.1 The tools#

I chose to work with OpenSCAD. It is a CAD (computer aided design) software tool that enables you to design objects based on code. I didn’t follow any tutorial, but I just used the openscad cheat sheet. You can click on any operation of this cheat sheet, and it opens a page with more explanations about this specific command.

2.2 The piece#

This was the piece I wanted to create#

this is the piece I created

2.3 The code#

This is the code I used#
// This first part creates the first cube with the holes in it
L = 15.8; // cube length
W = 7.9;  // cube width
H = 3.2;  // cube height

h = 1.7; // cylinder height
r = 2.4; // cylinder radius

p = 3.9; // placement of the first cylinder on the cube
x = 11.7; // x direction placement of the second cylinder on the cube
h2 = 0.7; // flexlink thickness
    difference(){
    cube([L,W,H]);
    translate([p,p,-1])cylinder(h+1,r,r,$fn=50);
    translate([x,p,-1])cylinder(h+1,r,r,$fn=50);
    }
// This part creates the 2 cylinders on the first cube
translate([p,p,H])cylinder(h,r,r,$fn=50);
translate([x,p,H])cylinder(h,r,r,$fn=50);

// This part creates the second cube with the holes in it
difference(){
    translate([50,0,0])cube([L,W,H]);
    translate([50+p,p,H-h])cylinder(5,r,r,$fn=50);
    translate([50+x,p,H-h])cylinder(5,r,r,$fn=50);
    }
// The number 5 above can be any number large enough for the cylinder to protude from the cube for a correct difference
// This part puts the 2 cylinders on the second cube
    translate([50+p,p,-h])cylinder(h,r,r,$fn=50);
    translate([50+x,3.9,-1.7])cylinder(h,r,r,$fn=50);

// This part creates the bridge between the 2 pieces
translate([L-0.1,0,0])cube([50-L+0.2,W,h2]);

2.4 Possible improvements#

Looking back at it now, I realize I should have used variables like cube or cylinder height, radius etc. This would make the code much more easy to read and to correct. However, since the piece is now printed and that it worked out fine, I am not going to spend more time changing the code.

2.5 Licence#

A licence is a label that you add to your work to tell people if and how they can use your work. (ex. you can use it for yourself but not for commercial purposes, or you can use it but you have to give credit to the author, etc.) Pretty much all intellectual property on the internet (songs, images, videos, articles,…) are protected by a licence. This webpage explains the different licences you can use. I chose the licence that permits people to do whatever they want with the work as long as they give credit to the author.

lego_piece_with_flexlink © 2024 by Martin Molitor is licensed under CC BY 4.0